Hi!
I am trying to to make a script work for my AutoCAD, script that changes layer colours to one in my colour book - I have a set of commands already like:
-LAYER
Set
FEATURES
Color
COlorbook
Color Book One
Terrain
FEATURES
which works, however sometimes a certain file is missing a layer from that list and therefore the script fails. Is there a way to make its o the script ignores the missing layer and moves to the next command?
Thanks!
Hi,
Thanks for the reply.
From what I understand, I dont need to make a layer as the layers are already there in the DWG file (see Attachment 1) These layers in the attachment have a default colour which I need to change using a script to a colours from my colour book. (See attachment 2) here you see the content of the script - it contains all possible layer names and what colour from the colour book they should have.
However when I try to run the script, and one of the layers is missing (which happens, not all files will contain the entire list of these layers some can have 5 layers from the list and other can have 12+) it fails with the following command: Cannot find layer "FEATURES", this can happen to any layer that is not present.
Its very strange, as the script works when it only has a list of layers that are currently present in the DWG file - So for example if Terrain, Road, Greenspace are the only layers and script only contains these 3 then it works. But I can not make individual scripts for individual files as it destroys the idea of having to change these colours quickly.
Hence why I am trying to see if someone knows why the script would not work. I am taking this on from someone who is no longer present so any input or suggestions are very welcome.
Thanks,
Oh my yes! I I understood it finally! sorry!
It worked! However, like you said it creates empty layers and colours them in - Is there a purge all command I can add at the end?
I tried something like
-Purge
A
O
But the above didnt work - any suggestion?
Thank you!
Can't find what you're looking for? Ask the community or share your knowledge.