nmulder
2009-07-15, 10:02 PM
I need some input. I have created a LISP routine that, after .las selection from user, will restore the layerstate through the viewport. At least that is what I am going for. Our CAD dept. has as a standard importing a given layer state through the viewport to not only restore the frozen/off layers, but to also vpfreeze the layers. When a model space layer state is imported through a viewport, it also vp freezes the frozen layers for that viewport.
I am trying to get the LISP to automate that. First, I am not sure if my counter is working correctly (to import .las into multiple vports, if applicable). Second, when a layer state is restored by LISP it doesn't seem to vpfreeze, though all other layer settings are restored.
If layerstate-restore command works a little different than doing it manually, I'd like to incorporate code to vpfreeze the frozen layers as part of the same routine, to match company standard.
Any help is appreciated.
Thanks.
Here is my code:
(defun c:ILS2 (/ _path laspath lasfile las_use)
(vl-load-com)
(setvar "ctab" "layout")
(setq _path (getvar "dwgprefix"))
(setq laspath (strcat _path "Xrefs\\"))
(setq lasfile (getfiled "Select a Layer States(.LAS) file to import:" laspath "las" 16))
(layerstate-import lasfile)
(setq las_use (vl-filename-base lasfile))
(setq vp_set (ssget "x" (list (cons 0 "Viewport"))))
(setq cntr 1)
(while (< cntr (sslength vp_set))
(command ".mspace")
(layerstate-restore las_use)
(setq cntr(+ cntr 1))
)
(command ".pspace")
(princ)
)
I am trying to get the LISP to automate that. First, I am not sure if my counter is working correctly (to import .las into multiple vports, if applicable). Second, when a layer state is restored by LISP it doesn't seem to vpfreeze, though all other layer settings are restored.
If layerstate-restore command works a little different than doing it manually, I'd like to incorporate code to vpfreeze the frozen layers as part of the same routine, to match company standard.
Any help is appreciated.
Thanks.
Here is my code:
(defun c:ILS2 (/ _path laspath lasfile las_use)
(vl-load-com)
(setvar "ctab" "layout")
(setq _path (getvar "dwgprefix"))
(setq laspath (strcat _path "Xrefs\\"))
(setq lasfile (getfiled "Select a Layer States(.LAS) file to import:" laspath "las" 16))
(layerstate-import lasfile)
(setq las_use (vl-filename-base lasfile))
(setq vp_set (ssget "x" (list (cons 0 "Viewport"))))
(setq cntr 1)
(while (< cntr (sslength vp_set))
(command ".mspace")
(layerstate-restore las_use)
(setq cntr(+ cntr 1))
)
(command ".pspace")
(princ)
)