copy current vp layers to other vp

Discussion in 'AutoCAD' started by kedovac, Jul 16, 2004.

  1. kedovac

    kedovac Guest

    i would like to ask if anybody knows where to find lisp that will enable me to select one viewport and copy layer states to another viewport inside the same drawing( all layer properties should match including current vp freeze). where i work they use in one drawing several viewports and they have differnet layers frozen in different viewports.
    thanks.
     
    kedovac, Jul 16, 2004
    #1
  2. kedovac

    Paul Turvill Guest

    The easiest way is to simply copy the entire viewport.
    ___

    me to select one viewport and copy layer states to another viewport inside
    the same drawing( all layer properties should match including current vp
    freeze). where i work they use in one drawing several viewports and they
    have differnet layers frozen in different viewports.
     
    Paul Turvill, Jul 16, 2004
    #2
  3. kedovac

    OLD-CADaver Guest

    <<The easiest way is to simply copy the entire viewport. >>

    That would copy the viewpoint as well, not necessarily desirable.
     
    OLD-CADaver, Jul 16, 2004
    #3
  4. kedovac

    kedovac Guest

    to copy entire viewport is not a good solution. viewports are already created and they are showing different terrain.
     
    kedovac, Jul 16, 2004
    #4
  5. kedovac

    Paul Turvill Guest

    Then it sounds like your original post was misleading. You indicated you
    wanted identical layer states in the two viewports. If that's the case,
    erasing one of the "original" ones, then copying the one that is to be
    identical is still the solution.

    If that's not the case, what is it you're *really* trying to accomplish?
    ___

    created and they are showing different terrain.
     
    Paul Turvill, Jul 16, 2004
    #5
  6. kedovac

    kedovac Guest

    i'm trying to find a lisp routine that will allow me to copy layer states from one viewport to another. to copy viewport is not a solution that works for me. thanks for your time.
     
    kedovac, Jul 16, 2004
    #6
  7. kedovac

    Jeff Mishler Guest

    Do a search in this group, or possibly the land-desktop group, looking for
    my name and this subject around the first of the year. I wrote a couple
    routines that save a selected viewport's layers states then you can select
    any other viewports to put those states to.

    Jeff

    --
    For additional help, try out www.cadvault.com
    remove USES from email address to reply
    from one viewport to another. to copy viewport is not a solution that works
    for me. thanks for your time.
     
    Jeff Mishler, Jul 16, 2004
    #7
  8. kedovac

    Jeff Mishler Guest

    Well, I found the file after all. To make 2 viewports match exactly, use the
    vplayer/thaw/all in the target viewport first.

    Good luck,
    Jeff
    Code:
    ;| Functions to copy, and later place, the vpfrozen 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 copy vplayers 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)
    )
    
     
    Jeff Mishler, Jul 16, 2004
    #8
  9. kedovac

    kedovac Guest

    hi Jeff,
    thank you so much for your help. i tried lisp and it worked great. thanks again.
     
    kedovac, Jul 16, 2004
    #9
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.