Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Below is a lisp which saves the current drawing Layer state of Model Space, Paper Space Layouts and Paper Space Layout Viewports.
During use it will flip back and forth between the Text window and the Graphics screen.
Would a lisp master please take a look and offer a suggestion as how I may prevent the flipping back and forth please.
;; Prepared by standing on the shoulders of others...
;; Many thanks to Henrique (hmsilva) for the bulk of this code
;; Many thanks to unknown author for the balance of this code
;; Many thanks to Henrique (hmsilva) for the bulk of this code
;; Many thanks to unknown author for the balance of this code
(defun c:LSVPorts (/ _ctab layst nt i ss vp)
(setq _ctab (getvar 'CTAB))
(foreach x (layoutlist)
(setvar 'CTAB x)
(if (and (= 0 (getvar "tilemode")) (>= (getvar "cvport") 2))
(command "_.pspace")
)
(command "_.zoom" "_E")
;;PAPERSPACE LAYOUT TAB LAYERSTATES
(IF (layerstate-has (getvar "CTAB"))
(layerstate-delete (getvar "CTAB"))
)
(COMMAND "-LAYER" "A" "S" (getvar "CTAB") "" "" "")
(graphscr)
(princ)
(if (setq ss (ssget "_X"
(list '(0 . "VIEWPORT")
'(-4 . "!=")
'(69 . 1)
(cons 410 x)
)
)
)
(repeat (setq i (sslength ss))
(setq hnd (ssname ss (setq i (1- i)))
ent (entget hnd)
vp (cdr (assoc 69 ent))
)
(if (> vp 1)
(progn
(if
(not
(and (= 0 (getvar "tilemode")) (>= (getvar "cvport") 2))
)
(command "_.mspace")
)
(setvar 'CVPORT vp)
(setq layst (strcat x " VP " (itoa vp)))
(list '(0 . "VIEWPORT")
'(-4 . "!=")
'(69 . 1)
(cons 410 x)
)
)
)
(repeat (setq i (sslength ss))
(setq hnd (ssname ss (setq i (1- i)))
ent (entget hnd)
vp (cdr (assoc 69 ent))
)
(if (> vp 1)
(progn
(if
(not
(and (= 0 (getvar "tilemode")) (>= (getvar "cvport") 2))
)
(command "_.mspace")
)
(setvar 'CVPORT vp)
(setq layst (strcat x " VP " (itoa vp)))
;;PAPERSPACE LAYOUT TAB VIEWPORT LAYERSTATES
(IF (layerstate-has layst)
(layerstate-delete layst)
)
(COMMAND "-LAYER" "A" "S" layst "" "" "")
(graphscr)
(princ)
)
)
)
)
(command "_.pspace")
)
)
)
)
(command "_.pspace")
)
(Command "Model")
(Command "ZOOM" "E")
(Command "ZOOM" "E")
;; MODEL SPACE LAYERSTATE
(IF (layerstate-has (getvar "CTAB"))
(layerstate-delete (getvar "CTAB"))
)
(COMMAND "-LAYER" "A" "S" (getvar "CTAB") "" "" "")
(graphscr)
(princ)
(IF (layerstate-has (getvar "CTAB"))
(layerstate-delete (getvar "CTAB"))
)
(COMMAND "-LAYER" "A" "S" (getvar "CTAB") "" "" "")
(graphscr)
(princ)
(setvar 'CTAB _ctab)
(princ)
)
(princ)
)
Solved! Go to Solution.