Trying to copy viewports and save layers states

Hey guys wonder if you can help,
I'm working on a set of drawings for a housetype that includes a number
alternative elevational treatments on a single model-space ele.
In my viewports I have various layers set as "freeze in this viewport"
to allow me to select the elevation I want. I now need to copy these
viewports onto a separate viewport to c reate some planning drawings.
When I do this, most, not all, of the layers become un-frozen.
Obviously this situation leaves me having to repeat work. I'm sure that
there is a way round this - does anybody know it?
Thanks in advance,
Reply to
Daniel J. Ellis
Loading thread data ...
Reply to
Michael Bulatovich
Sorry, layout
Reply to
Daniel J. Ellis
Yep, Here's a lisp to save the layer states (vp related) and then another to put them in another vp. Only works in the same drawing session....
;;;*********code starts here************ ;| Functions to copy, and later place, the fozen layers from one paperspace viewport to another. Works with both standard and polygonal viewports. This was created for use in one drawing at a time! The layers obtained with the copyvplayers function are not saved for use in another drawing or even another editing session.
Command: copyvplayers - creates the variable "laylist", if you think that the routine isn't working, check the value of this variable at the command line like this: Command: !laylist If this returns nil then the list hasn't been saved.
Command: putvplayers - freezes the layers obtained with copyvplayers in the selected viewport. If you want the 2 viewports to match exactly, make sure to reset the layers in the target viewport first.
(c) Jeff Mishler, June 2003 - Updated Jan. 2004 to work with Acad2004. |;
(defun c:copyvplayers (/ obj) (if (setq obj (entsel "\nSelect viewport to save layer data for: ")) (progn (setq obj (entget (car obj)) laylist nil) (if (and (= (cdr (assoc 0 obj)) "LWPOLYLINE") (setq vptest (member '(102 . "{ACAD_REACTORS") obj)) (setq vptest (member '(102 . "}") (reverse vptest))) (assoc 330 vptest) ) (setq obj (entget (cdr (assoc 330 vptest)))) ) (if (and (= (cdr (assoc 0 obj)) "VIEWPORT") (setq objlist (cdr (car (cdr (assoc -3 (entget (cdr (assoc -1 obj))(list "acad"))))))) (assoc 1003 objlist) ) (progn (foreach x objlist (if (= (car x) 1003) (setq laylist (cons (cdr x) laylist)) ) ) (setq laylist (reverse laylist)) ) (princ (strcat "\nInvalid Viewport entity {" (cdr (assoc 0 obj)) "} selected, or VP has no frozen layers, try again...")) ) ) ) (princ) )
(defun c:putvplayers (/ tempstr int smallstr vpent) (if laylist (progn (setq tempstr "") (foreach x laylist (setq tempstr (strcat tempstr x ",")) ) (setq tempstr (substr tempstr 1 (- (strlen tempstr) 1))) (setq oldecho (getvar "cmdecho")) (setvar "cmdecho" 0) (command "_undo" "_be") (while (not vpent) (setq vpent (entsel "\nSelect Viewport object: ")) ) (setq vpent (car vpent)) (while (> (strlen tempstr) 256) (setq smallstr (substr tempstr 1 256)) (setq int (vl-string-position (ascii ",") smallstr 0 t)) (setq smallstr (substr smallstr 1 int) tempstr (substr tempstr (+ int 1)) ) (command "vplayer" "f" smallstr "s" vpent "" "") ) (command "vplayer" "f" tempstr "s" vpent "" "") (command "_undo" "_end") (setvar "cmdecho" oldecho) );progn );if (princ) ) ;;;*********code ends here************
Reply to
Jeff Mishler
That'a amazing, thankyou very much indeed.
Reply to
Daniel J. Ellis

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.