Renaming Layers after PDF Import - Removing the "PDF_" Prefix and merging similar layers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
Thanks in advance for your help!
The Scenario: When I import a PDF file Autocad adds a prefix of "PDF#_" to all the layers.
If you import several PDFs then you get incremented prefixes (PDF_LayerName, PDF2_LayerName, PDF3_LayerName, PDF4_LayerName....). The "#" symbol is never part of the prefix.
If you start with a document that has 50 layers and the PDF you are importing also has 50 layers and u import 5 of them you then have 300 layers (250 new layers + 50 from your original document). Many imported layers may have the same name as layers in your original document but they will have the PDF#_ prefix (ie Layer 0 (from original document), PDF_Layer 0 (imported), PDF2_Layer 0 (imported), PDF3_Layer 0 (imported), PDF4_Layer 0 (imported), PDF5_Layer 0 (imported).
I would like to be able to do the following: search through all the layers and find any with a "PDF#_" prefix (ie PDF#_Layer 0). If one is found then scan the list of layers to see if there is a layer with the same name excluding the prefix (Layer 0) and merger these into Layer 0.
Assuming my original document had 50 layers and the pdf i was importing had 50 layers and the layer names were the same in both models then this script would take my 300 layer document (after 5 imports) back to a 50 layer document.
I got some help to get this far (from a few of you - I apologize if I have mangled your code) but it still doesn't work and I am lost as to how to fix it.
Thank You!!