swmeche Posted October 8, 2014 Posted October 8, 2014 Hello, I have been trying to inport survey data that includes a descriptor into autocad from an excel file, with some prior forum posts on here I've been successful completing that. Now I am trying to change the layers as part of the data entry, the idea being that all my points are on the base layer "0" and that the text goes into either a "Good" or "Bad" layer with different colors. I thought I had this figured out but the "clayer" command doesn't close out when a space is given, does anyone have ideas on what might solve this? I have zero coding/lisp background so hopefully the answer isn't that, any help you could give would be appreciated though. Attached is a sample excel sheet with the two basic sets of info arrangements I have now for comment/review. point+text exemple.xls Quote
steven-g Posted October 8, 2014 Posted October 8, 2014 The problem is that the command clayer expects a text input which is fine, but it also accepts a space as text, so where your script is correct in using a space for the equivalent of "enter" it all breaks down with certain commands another similar one is "-layer", this also mucks things up. Someone else might have a different method, but I either use excel VBA to create a script file and code in the line returns, or physically create the seperate lines of text which makes your code column larger than your data, (another method would be to split your data over 3 lines each time, it depends where it comes from). Anyway attached is one way if you select the 3 cells colored yellow and drag/copy the formulas down it should repeat correctly for as many rows as you need (the formulas are setup to start at row 8 if you move things about they will need adjusting). Good luck PS Welcome to CADTutor point+text exemple.xls Quote
swmeche Posted October 9, 2014 Author Posted October 9, 2014 Steven, Thanks for the quick reply and your take on the solution, that was the one way I was thinking of doing it to keep everything in excel. I actually ended up taking the dive into AutoLISP after coming across a clearly written walkthrough on the cad-notes . com site "Your first Autolisp program". I created a basic program that defined three new functions with the clayer command inside that works well with my excel sheet, both are attached below for anyone to work with themselves since this seems like a very common issue for us beginners. My solution had me create a lisp but it was very painless and keeps the excel data all in one row, which lets me go into my actual data files and easily modify it onto an end column to run through the heavy data sets. This may not be the most elegant solution for advanced users but I'll take it. good layer.LSP revised point text exemple.xls Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.