LISP: layerstate-restore - restoreflags

LISP: layerstate-restore - restoreflags

Anonymous
Not applicable
1,584 Views
1 Reply
Message 1 of 2

LISP: layerstate-restore - restoreflags

Anonymous
Not applicable

At our company we use layer states in our drawings, and for easy switching between layer states a small lisp allows us to quickly switch between them. When selecting a layer state from the ribbon, all layers not defined by the layer state are turned off, when using our LISP this doesn't happen, and it would be best that it did.

 

The code is really simple for each layerstate:

 

 

(defun c:100 ()
	(layerstate-restore "LMAN_100" (acet-currentviewport-ename))
	(command "REGENALL")
)

 

 

The REGENALL is added for fun.

 

According to Autodesk the code is built as follows:

 

 

(layerstate-restore layerstatename viewport [restoreflags])

restoreflags
Type: Integer
Optional numeric sum affecting how the layer state is restored.
1 -- Turn off all layers not in the restored layer state
2 -- Freeze all layers not in the restored layer state
4 -- Restore the layer state properties as viewport overrides (requires viewport to be not a nil value).

 

 

So the solution would probably be to insert the "restoreflags". Can't figure out how to do it though. Anyone an idea?

 

 

 

0 Likes
1,585 Views
1 Reply
Reply (1)
Message 2 of 2

user181
Mentor
Mentor

Just put the number after the (acet-currentviewport-ename) like below. If you want it restored as viewport overrides and layers not in state turned off add the 4 and 1 and use 5

 

(defun c:100 ()
(layerstate-restore "LMAN_100" (acet-currentviewport-ename) 5)
(command "REGENALL")
)

EESignature