Jason,
We are using 2005 here, so I can't look at the new features. Hopefully, one of these days . . .
Anyway, I tried to get an if/then statement working for about 1-2 hours this morning, to no avail.
I decided to try writing the routine to immediately delete a layer state "old", whether or not it existed. Then save a new layer state with the same name. It appears to work, except that I get an annoying command window pop-up each time that has to be closed.
Here's what I've got:
(defun c:SWL ()
(setvar 'cmdecho 1)
;Delete the layer state "OLD".
(command "-layer" "state" "delete" "OLD" "" "" "")
;Create the layer state "OLD".
(command "-layer" "state" "save" "OLD" "" "" "")
;Thaw a list of layers:
(command "-layer" "thaw" "*WATER*,*ROAD*,*BND*,*CURB*,*GUTTER*,*SIDEWALK*,XREF,*LOT,*BND_PHASE*,*LOT_NO,SURV_PNTS_WATER"
;Create a layer:
"make" "SURV_PNTS_WATER" "color" "white" "" "ltype" "continuous" ""
;Turn off all layers except the current layer:
"off" "*" "no"
;Turn on a list of layers:
"on" "*WATER*,*ROAD*,*BND*,*CURB*,*GUTTER*,*SIDEWALK*,XREF,*LOT,*BND_PHASE*,*LOT_NO" "")
(setvar 'cmdecho 0)
(princ)
)
I'd still like to test to see if "old" exists before deleting it; but I can't figure that out. Also, I'd like to prevent the command window pop-up from appearing.
Any help would be appreciated.
CAD77