@ryan.garland.1.ctr wrote:
.... Here is a screenshot of the code that I have started ....
I realize this isn't directly about your primary question, but I have a question and some suggestions about the code you have started.
It looks like if the LINE Layer exists, it will merge ARROW into it if that also exists, but will not do any of the other Layer settings. Those will happen only if LINE does not exist. Is that really what you want?
On the assumption that you want the other Layer stuff to happen in any case, there's a lot of consolidation possible.
There's no need to check whether a Layer exists to decide whether to create it. You can just give the Layer name to the Make or New option, and it won't matter whether it already exists. The only time it's advisable to check, in my opinion, is if it's possible that it exists with some different option(s) than your standard [such as a different color] and you want to let the User keep the non-standard setting(s).
I assume you're Making the MAJOR and MINOR Layers just to prevent a no-Layer(s)-found error in the LAYMRG if neither of them exists. In that case, since they are only going to be merged into LINE anyway, there's no point in assigning colors to them.
Using the New option followed immediately by the Make option with the same Layer name [LINE] is redundant -- the New option is wasted.
It may be valid, but it looks funny to me to Make Layer 0. It can't be Purged, so it will always exist, so all you need to do is Set it current. And only once, if you adopt the remaining suggestions.
A single (command) function can contain any number of commands, and a single Layer command any number of options. And in LAYER, most options can be applied to any number of Layer names with comma separators, including [for example] assigning the same Color to more than one Layer at once.
I think [without testing] that your entire screenshot content can be replaced with this:
(defun C:LayerCheck ()
(command
"_.layer"
"_new" "LINE,ARROW,MAJOR,MINOR,BUBBLE,DEV_LIST,EXISTING,PIDSYM,REDUCER,REVISION,TEXT,ZONE"
; [first 4 to prevent no-Layer(s)-found error(s) in LAYMRG]
"_color" 131 "LINE" "_color" 151 "BUBBLE" "_color" 91 "DEV_LIST,PIDSYM"
"_color" 40 "EXISTING" "_color" 11 "REVISION" "_color" 171 "TEXT" "_color" 191 "ZONE"
"_set" "0" ""
"_.laymrg" "_name" "ARROW" "_name" "MAJOR" "_name" "MINOR" "" "_name" "LINE" "_yes"
); command
); defun
[It's possible that it could be a little shorter by using Make options for the individual Layers, so that the Color options can use "" Enter to accept the current Layer for the color assignments. That would avoid the spelling out of Layer names twice, but would add back in all the individual Make option calls and "" Enters that are not needed in the above, and it would require two Color-91 assignments instead of one.]
Kent Cooper, AIA