How to copy a viewport to a different drawing?

Discussion in 'AutoCAD' started by Jeff-FRCH, Oct 27, 2004.

  1. Jeff-FRCH

    Jeff-FRCH Guest

    I am trying to copy a viewport from DWG1 to DWG2 such that it views the same area of the model. DWG2 is open but DWG1 is active. I can get all the properties of the original pviewport in DWG1 and recreate it in DWG2. The size is the same and the scale is the same, but it looks at a different portion of the model. How do I get the modelspace coordinates so the new pviewport matches the original?
     
    Jeff-FRCH, Oct 27, 2004
    #1
  2. If I understand correctly you are trying to match a viewport with a different model space but want it exactly in the same place as the first drawing. I believe there is an Express tool that takes a paperspace point and snaps it to a model space point or vice versa. You could put a node at the same location in each drawing and snap the paper space to that node ...

    David
    AcadComponents.com

    VisualDCL 2005 Guaranteed Bug Free ...
     
    AcadComponents, Oct 28, 2004
    #2
  3. Jeff-FRCH

    T.Willey Guest

    copy/paste has worked for me in the past.

    Tim
     
    T.Willey, Oct 28, 2004
    #3
  4. Jeff-FRCH

    SkintSubby Guest

    You should be able to copy / paste the vport from one drawing to another. Then click on the vport and turn it on.

    This new vport should have the same properties as the original (viewpoints, scale etc)
     
    SkintSubby, Oct 28, 2004
    #4
  5. Jeff-FRCH

    Jeff-FRCH Guest

    Copy / paste does work, but I am trying to do it programmatically. We have a lot of projects for the same client that use the same drawing format over and over. These are architectural renovations of department stores. I want to set up one drawing with say, 6 viewports for the areas being renovated and then copy this setup to the other 10 drawings automatically. All I want from the user is to select the objects to copy and the drawings to copy to.

    I've tried vla-copyobjects but the viewports come out corrupt and crash AutoCAD. I have another post asking for help with vla-copyobjects but have gotten no replies.
     
    Jeff-FRCH, Oct 28, 2004
    #5
  6. Jeff-FRCH

    James Allen Guest

    Does applying the same "target" and "twist" values not work?
    --
    James Allen, EIT
    Malicoat-Winslow Engineers, P.C.
    Columbia, MO
    have a lot of projects for the same client that use the same drawing format
    over and over. These are architectural renovations of department stores. I
    want to set up one drawing with say, 6 viewports for the areas being
    renovated and then copy this setup to the other 10 drawings automatically.
    All I want from the user is to select the objects to copy and the drawings
    to copy to.
    AutoCAD. I have another post asking for help with vla-copyobjects but have
    gotten no replies.
     
    James Allen, Oct 28, 2004
    #6
  7. Jeff-FRCH

    Jeff-FRCH Guest

    They have the same "target' and "twist". If I dump a pviewport object I don't see any properties that relate to the model. There has to be a relationship between the pviewport and modelspace.
     
    Jeff-FRCH, Oct 28, 2004
    #7
  8. Jeff-FRCH

    DaveS Guest

    This is how I set the viewport scale.

    VPortScale (/ (cdr (assoc 45 VPortEnt))
    (cdr (assoc 41 VPortEnt))))

    This is how I picked points in the viewport.

    (setq PLwrLeft (list (- (car (cdr (assoc 10 VPortIn)))
    (/ (cdr (assoc 40 VPortIn)) 2))
    (- (cadr (cdr (assoc 10 VPortIn)))
    (/ (cdr (assoc 41 VPortIn)) 2))
    0)
    PUprRight (list (+ (car (cdr (assoc 10 VPortIn)))
    (/ (cdr (assoc 40 VPortIn)) 2))
    (+ (cadr (cdr (assoc 10 VPortIn)))
    (/ (cdr (assoc 41 VPortIn)) 2))
    0)
    LwrLeft (trans 3 2 PLwrLeft)
    UprRight (trans 3 2 PUprRight))

    The (assoc 10 VPortIn) gets the center of the viewport. I subtracted
    half the width in paperspace, (assoc 40 VPortIn), from that to get the x
    of the lower left corner. The I subtracted half the height paperspace,
    (assoc 41 VPortIn), to get the y of the lower left.

    Of course I just added to go to the upper right.

    I then trans'd them points into paperspace. I hope some of this may be
    of value to you.

    Have fun,
    Dave
     
    DaveS, Oct 28, 2004
    #8
  9. Jeff-FRCH

    James Allen Guest

    Target, twist, scale, and custom scale (and direction) all relate to how you
    see the model. Unfortunately, target by itself doesn't define the 'viewctr'
    and there seems to be some other elusive property involved as well.

    Adjusting the target value does pan the view in the viewport, but I don't
    know what consequences might follow. And I think you would have to switch
    to dwg2 and even enter the new viewport in order to figure out how much to
    'pan' anyway. So that option's out (for lisp) if I'm not mistaken.

    You're sure the model is in fact in the same place in both drawings? Other
    than that, I'm not sure.

    Okay, I found this post that might be helpful.
    http://discussion.autodesk.com/thread.jspa?messageID=2302971 You might be
    able to save a view from the viewport in dwg1, copy the named view to dwg2,
    and use Bobby's code to apply that same view to the new viewport in dwg2.
    Actually, I don't think that will work either because it would also require
    switching to dwg2... <self, lisp methods only work in the current drawing>

    Maybe I'm just out of my league here, but I would like to know the answer as
    well. Maybe someone else will help us out here and tell us **what property
    we can use to get/set 'viewctr' in a pviewport without actually activating
    it or the drawing it is in**. <please>

    Good luck to us,

    James

    don't see any properties that relate to the model. There has to be a
    relationship between the pviewport and modelspace.
     
    James Allen, Oct 29, 2004
    #9
  10. Jeff-FRCH

    Jeff-FRCH Guest

    I have a work around that'll have to do for now. After the user selects the objects to copy I use the selection set in the copybase command to put the objects on the clipboard. I then have the user select the files to copy the objects to and I build and run a script file with pasteorig to place the objects in all the drawings. It seems to be working for all objects except xrefs, which is the normal behavior of pasteorig.
     
    Jeff-FRCH, Oct 29, 2004
    #10
  11. Jeff-FRCH

    Undoman Guest

    use disign centре ->
    in command line write "dc"
    -> load the drawing from which u want to copy the layout than from the menu layouts -> just double click on the wished drawing
    and its done
     
    Undoman, Oct 31, 2004
    #11
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.