Lee Mac Posted December 1, 2010 Posted December 1, 2010 (edited) Spurred into life by this thread, I thought I'd update an old program of mine. I have created this program to enable a user to extract the layer information from multiple drawings in a directory to either Text/CSV file. Example of XML data output using XSL to display data in a CSS styled HTML Table: Enjoy! Lee Code can be found here Edited January 12, 2011 by Lee Mac Quote
pBe Posted December 1, 2010 Posted December 1, 2010 Nice code Lee. Question.. Can you exclude Xref Layers. Btw: can you put up a tutorial for Error trappin on you site Its one of my many weaknesses Quote
Lee Mac Posted December 1, 2010 Author Posted December 1, 2010 Nice code Lee.Question.. Can you exclude Xref Layers. Thanks pBe Nice idea - I'm thinking of creating a dialog for this in which the user can select directories/change & toggle headings/change the padding character - and now, with your idea: toggle display of XRef layers Btw: can you put up a tutorial for Error trappin on you siteIts one of my many weaknesses You mean the creation of Error handlers or using conditionals to allow to null user input? Quote
pBe Posted December 1, 2010 Posted December 1, 2010 Thanks pBe You mean the creation of Error handlers Yup... I'm basically zero on this one Your welcome, Glad i can contibute Lee Mac its the least i can do. Quote
Lee Mac Posted December 1, 2010 Author Posted December 1, 2010 Yup... I'm basically zero on this one I did actually write an tutorial on the topic a while back - but it needs severe updating... will see what I can do when I get a minute Quote
pBe Posted December 1, 2010 Posted December 1, 2010 Great... no rush, I have all day Thanks Lee ... l:D Quote
Lee Mac Posted December 1, 2010 Author Posted December 1, 2010 Code updated to Version 1.1 This version includes a far greater number of fields and allows the user to also write to an XML file. Enjoy! Lee Quote
irneb Posted December 2, 2010 Posted December 2, 2010 Lee, just as a suggestion. The colour of the layer could be the normal ACI number as your routine extracts. But what about RGB values? I suggest changing (itoa (vla-get-Color layer)) to: (if (= (vla-get-ColorMethod (vla-get-TrueColor layer)) acColorMethodByACI) (itoa (vla-get-Color layer)) (strcat "\"RGB:" (itoa (vla-get-Red (vla-get-TrueColor layer))) "," (itoa (vla-get-Green (vla-get-TrueColor layer))) "," (itoa (vla-get-Blue (vla-get-TrueColor layer))) "\"" ) ) But then since the RGB uses commas to separate the values, this might interfere with CSV. That's why I've surrounded the value with double quotes, this usually solves that issue. Quote
Lee Mac Posted December 2, 2010 Author Posted December 2, 2010 Nice idea Irneb, I'll look to include that in the next version - thanks for the feedback mate Quote
kam1967 Posted December 2, 2010 Posted December 2, 2010 I'm happy to get you back into the programming mode again, Lee Mac. I just downloaded the program and will let you know what I think. You're awesome already for having gone this far! Spurred into life by this thread, I thought I'd update an old program of mine. I have created this program to enable a user to extract the layer information from multiple drawings in a directory to either Text/CSV file. The user can change the headings and, if writing to a text file, the padding character used (currently a space). Enjoy! Lee Code can be found here Quote
Lee Mac Posted December 2, 2010 Author Posted December 2, 2010 I'm happy to get you back into the programming mode again, Lee Mac. I just downloaded the program and will let you know what I think. You're awesome already for having gone this far! Thanks Kam Your thread spurred me into updating some old code I had lying around and I just got a bit carried away with it Hope you like it ! Quote
kam1967 Posted December 2, 2010 Posted December 2, 2010 Just got done testing it and I really love it, Lee. I noticed that there were a couple of suggestions on this new routine. I don't think they pertain to me. However, I wonder if it's possible to provide option for two things: 1) The option to extract directly from within the file or from a directory of files 2) The option to include or exclude the xref layer information 3) The option to extract each drawing's layer information into its own tab (not sure if it's possible) I suggested these to save time, in case we have to format the file. Lastly, do you know of a software that would pull all these information back into Autocad? If not, I can find a way around it via a script. You've gone above and beyond already, so I'm perfectly happy if you're beat and want to move on. Thanks again!! Quote
Lee Mac Posted December 2, 2010 Author Posted December 2, 2010 Glad you like the program Kam, I do have a few things I intend to add to it also With regards to your suggestions: 1) The option to extract directly from within the file or from a directory of files Maybe I have misunderstood, but this should already be possible with the current code... 2) The option to include or exclude the xref layer information This will be added 3) The option to extract each drawing's layer information into its own tab (not sure if it's possible) Not possible with a CSV (by the very nature of a CSV file), but possible if writing to Excel (may include this option in a later version - we shall see). I suggested these to save time, in case we have to format the file. Lastly, do you know of a software that would pull all these information back into Autocad? If not, I can find a way around it via a script. You mean alter the drawings to match the information in the CSV? Nice idea - I don't currently know of software, but I should think software could be created to do such. You've gone above and beyond already, so I'm perfectly happy if you're beat and want to move on. Thanks again!! Thanks Kam Quote
kam1967 Posted December 3, 2010 Posted December 3, 2010 That's very cool. I appreciate the work you've done, Lee. Have a great one! Quote
pBe Posted December 3, 2010 Posted December 3, 2010 Minor thing Lee Mac Notice when you extract layer information, it absolutely gather all information on a particular layer including custom linetypes? Can you add info on the bottom of the text file the location of these custom linetypes, As an extra feature of course Quote
Lee Mac Posted December 3, 2010 Author Posted December 3, 2010 Minor thing Lee MacNotice when you extract layer information, it absolutely gather all information on a particular layer including custom linetypes? Can you add info on the bottom of the text file the location of these custom linetypes, As an extra feature of course Do you refer to the .lin definition file in which the linetypes are defined? Quote
Lee Mac Posted December 3, 2010 Author Posted December 3, 2010 Huge update to Version 1.2 Enjoy! Quote
kam1967 Posted December 4, 2010 Posted December 4, 2010 Awesome layer extraction tool, Lee. You did a wonderful job with the LayerExtractor information web page as well. Hats off to you, really. I hope everyone appreciates the quality tool that you've provided. Cheers! Quote
pBe Posted December 4, 2010 Posted December 4, 2010 (edited) Do you refer to the .lin definition file in which the linetypes are defined? Yup,only for those custom linetypes, settings not on the "out-of-the box" autocad really throws me off. like hatch patterns and the like. i had this crazy idea of recreating the custom linetype on the fly as soon as the code detects linetype other than the native ones. not even sure cad stores the path where the custom linetypes are? or is there? Edited December 4, 2010 by pBe Quote
Lee Mac Posted December 4, 2010 Author Posted December 4, 2010 Awesome layer extraction tool, Lee. You did a wonderful job with the LayerExtractor information web page as well. Hats off to you, really. I hope everyone appreciates the quality tool that you've provided. Cheers! Thanks once again Kam - I really enjoyed writing this one Yup,only for those custom linetypes, settings not on the "out-of-the box" autocad really throws me off. like hatch patterns and the like. i had this crazy idea of recreating the custom linetype on the fly as soon as the code detects linetype other than the native ones. not even sure cad stores the path where the custom linetypes are? or is there? I don't believe the location of the .lin file in which the linetype may be defined is disclosed, one would have to search all .lin files for the appearance of the definition should it be there at all. 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.