@JohnC_ISM wrote:
.... how do i make it search like *hatch/Hatch
....
(command "_.chprop" "_last" "" "_layer" "E-Hatch" "")
....
it used to be Ehatch and now its E-Hatch sometimes old drawings are used about 50% of the time so im just tryna make it so the lisp works for everyone regardless of old or new drawing is open.
It can check through all the possibilities for the Layer name until it finds the one that is in the current drawing [or, the first one it finds, if there are more than one of them]:
(command
"_.chprop" "_last" "" "_layer"
(cond ; find a Layer that exists
((tblsearch "layer" "E-hatch") "E-hatch")
((tblsearch "layer" "Ehatch") "Ehatch")
((tblsearch "layer" "Hatch") "Hatch")
((tblsearch "layer" "Whatever") "Whatever")
("0")
); cond
"" ; conclude CHPROP
)
[That would not be case-sensitive.]
It will stop looking as soon as it finds one of those Layer names exists and uses it. I added a there-aren't-any fallback to put it on Layer 0, so that it can't cause an error, since that Layer will always exist, but it could be made to just keep it on the current Layer instead.
Kent Cooper, AIA