Jump to content

Recommended Posts

Lee Mac

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.

 

 

LayerExtractV1-2.png

 

Example of XML data output using XSL to display data in a CSS styled HTML Table:

 

LayerExtractXML.png

 

 

Enjoy!

 

Lee

 

Code can be found here :)

Edited by Lee Mac

Share this post


Link to post
Share on other sites
pBe

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 :(

Share this post


Link to post
Share on other sites
Lee Mac
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 site

Its one of my many weaknesses :(

 

You mean the creation of Error handlers or using conditionals to allow to null user input?

Share this post


Link to post
Share on other sites
pBe
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. :)

Share this post


Link to post
Share on other sites
Lee Mac
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 :)

Share this post


Link to post
Share on other sites
pBe

Great... no rush, I have all day

 

Thanks Lee ... l:D

Share this post


Link to post
Share on other sites
Lee Mac

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

Share this post


Link to post
Share on other sites
irneb

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.

Share this post


Link to post
Share on other sites
Lee Mac

Nice idea Irneb, I'll look to include that in the next version - thanks for the feedback mate :)

Share this post


Link to post
Share on other sites
kam1967

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! :D

 

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 :)

Share this post


Link to post
Share on other sites
Lee Mac
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! :D

 

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 :D

 

Hope you like it !

Share this post


Link to post
Share on other sites
kam1967

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!!:thumbsup:

Share this post


Link to post
Share on other sites
Lee Mac

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!!:thumbsup:

 

Thanks Kam :)

Share this post


Link to post
Share on other sites
kam1967

That's very cool. I appreciate the work you've done, Lee. Have a great one!8)

Share this post


Link to post
Share on other sites
pBe

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 :)

Share this post


Link to post
Share on other sites
Lee Mac
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 :)

 

Do you refer to the .lin definition file in which the linetypes are defined?

Share this post


Link to post
Share on other sites
Lee Mac

Huge update to Version 1.2

 

Enjoy!

Share this post


Link to post
Share on other sites
kam1967

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!:thumbsup:

Share this post


Link to post
Share on other sites
pBe
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 by pBe

Share this post


Link to post
Share on other sites
Lee Mac
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!:thumbsup:

 

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.

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...