If you're going to do all those property assignments in separate Layer commands, then you need to finish each one:
(if (tblsearch "LAYER" newLayerName)
(progn
(command "_.LAYER" "_thaw" newLayerName "") ;; Thaw if layer already exists
(command "_.LAYER" "_set" newLayerName "") ;; Make it current
)
(progn
;; Create new layer with specific properties
(command "_.LAYER" "_make" newLayerName "")
;; Set layer properties manually
(command "_.LAYER" "_color" "cyan" newLayerName "") ;; Explicitly set color to cyan
(command "_.LAYER" "_Lweight" "50" newLayerName "") ;; Set line weight to 0.50mm
(command "_.LAYER" "_Ltype" "Continuous" newLayerName "") ;; Set line type to Continuous
(command "_.LAYER" "_Plot" "yes" newLayerName "") ;; Make layer plottable
(command "_.LAYER" "_Transparency" "0" newLayerName "") ;; Set transparency to 0
;; Make the new layer current
(command "_.LAYER" "_set" newLayerName "")
)
)
And that last command is unnecessary -- the Make option earlier will have set it current in the process, and in all those property assignments, newLayerName can be replaced with "" as the default.
But don't do that. You can combine as many Layer operations in one command as you want. And I would not bother to check whether it exists -- just Make it, and it won't matter if it already exists, and it will become current. I would Thaw it first just in case -- it can't be made current if it's Frozen -- and it won't matter if it doesn't yet exist.
All the above-quoted code can be replaced with just this:
(command "_.LAYER"
"_thaw" newLayerName
"_make" newLayerName
"_color" "cyan" ""
"_Lweight" "50" ""
"_Ltype" "Continuous" ""
"_Plot" "yes" ""
"_Transparency" "0" ""
""
)
Consider whether you need to do that linetype assignment. Continuous is the default for new Layers, so it's unnecessary, unless it's possible that the Layer already exists with some other linetype, and you want to correct that.
Also, earlier, there's no point in checking whether Layer "0" exists -- it always does, and can't be Purged or Renamed, so there's no point in Making it [though that's permitted]. It should be Thawed just in case, but that and making it current are all you need:
(command "_.LAYER" "_thaw" "0" "_set" "0" "")
Kent Cooper, AIA