Jump to content

Pan in two MS viewports at the same time


nod684

Recommended Posts

just wondering....

 

i do a lot of projections when doing elevations / sections

and what i do is have the 2 viewports in model space in which the top vport shows the plan while the bottom shows the elevation / section am doing. Then using xlines, I project what is on the plan to my drawing below

.

now, is it possible to pan in one viewport and the other viewport follows too? can it be done thru lisp or some other tool?

Link to comment
Share on other sites

Pst. I removed the dots in your title - if this thread goes over two pages, dots in the title can make it non-accessible. On second thought, I renamed the tread :thumbsup:

 

Good question though, I will move this to the lisp-forum and hope you get a good answer (that I can use too!)

Link to comment
Share on other sites

Something like this?

;;; Pan in All Viewports (28-XI-2012)
(defun c:PAV( / oldCVPort oldCmdEcho listVPorts pointBase pointMove )
(setq listVPorts (mapcar 'car (vports))
      oldCmdEcho (getvar "CMDECHO")
      oldCVPort  (getvar "CVPORT"))

(setvar "CMDECHO" 0)
(if (and (setq pointBase (getpoint           "\nBase point: "))
         (setq pointMove (getpoint pointBase "\nNew point: ")))
 (foreach itemVPort listVPorts
  (setvar "CVPORT" itemVPort)
  (command "_PAN" pointBase pointMove)
 )
)

(setvar "CVPORT"  oldCVPort)
(setvar "CMDECHO" oldCmdEcho)
(princ)
)

Link to comment
Share on other sites

  • 1 year later...

please anyone could help on this issue

 

 

New point: int of ; error: AutoCAD variable setting rejected: "CVPORT" 1

 

 

 

;;; Pan in All Viewports (28-XI-2012)
(defun c:PAV( / oldCVPort oldCmdEcho listVPorts pointBase pointMove )
(setq listVPorts (mapcar 'car (vports))
      oldCmdEcho (getvar "CMDECHO")
      oldCVPort  (getvar "CVPORT"))

(setvar "CMDECHO" 0)
(if (and (setq pointBase (getpoint           "\nBase point: "))
         (setq pointMove (getpoint pointBase "\nNew point: ")))
 (foreach itemVPort listVPorts
  (setvar "CVPORT" itemVPort)
  (command "_PAN" pointBase pointMove)
 )
)

(setvar "CVPORT"  oldCVPort)
(setvar "CMDECHO" oldCmdEcho)
(princ)
)

Edited by SLW210
Added Code Tags
Link to comment
Share on other sites

please anyone could help on this issue

 

 

New point: int of ; error: AutoCAD variable setting rejected: "CVPORT" 1

 

;;; Pan in All Viewports (28-XI-2012)
(defun c:PAV( / oldCVPort oldCmdEcho listVPorts pointBase pointMove )
(setq listVPorts (mapcar 'car (vports))
      oldCmdEcho (getvar "CMDECHO")
      oldCVPort  (getvar "CVPORT"))

(setvar "CMDECHO" 0)
(if (and (setq pointBase (getpoint           "\nBase point: "))
         (setq pointMove (getpoint pointBase "\nNew point: ")))
 (foreach itemVPort listVPorts
  (setvar "CVPORT" itemVPort)
  (command "_PAN" pointBase pointMove)
 )
)

(setvar "CVPORT"  oldCVPort)
(setvar "CMDECHO" oldCmdEcho)
(princ)
)

 

 

kindly observe proper posting of codes...

must be inside quotes.

 

anyway, i did not get this error. still using it till now.

Im using AutoCAD 2014

Edited by SLW210
Link to comment
Share on other sites

Yathishkumar, please pay attention that this tool is intended to be used for navigation in Model Space as per Nod684's request. Based on the error you received it appears that you attempted to use it in Paper Space.

Link to comment
Share on other sites

Hi Msasu

 

i am using in paperspace viewports

 

first i click inside of one viewport and second viewport

then i type command pav

 

 

thanx

Link to comment
Share on other sites

  • 4 months later...

MSasu,

 

How can I modify the code so that it will only pan the viewports in the current layout tab instead of trying to pan in all of the viewports in the whole drawing?

Link to comment
Share on other sites

Hopefully this should fix it to be working as expected in all MS/PS situations...

 

;;; Pan in All Viewports (28-XI-2012)
(defun c:PAV ( / oldCVPort oldCmdEcho listVPorts pointBase pointMove )

(if (and (eq (getvar 'tilemode) 0)
         (eq (getvar 'cvport) 1))
 (command "_.MSPACE")
)

(setq listVPorts (mapcar 'car (vports))
      oldCmdEcho (getvar "CMDECHO")
      oldCVPort  (getvar "CVPORT"))

(setvar "CMDECHO" 0)
(if (and (setq pointBase (getpoint           "\nBase point: "))
         (setq pointMove (getpoint pointBase "\nNew point: ")))
 (foreach itemVPort (vl-remove 1 listVPorts)
  (setvar "CVPORT" itemVPort)
  (command "_PAN" pointBase pointMove)
 )
)

(setvar "CVPORT"  oldCVPort)
(setvar "CMDECHO" oldCmdEcho)
(princ)
)

Link to comment
Share on other sites

New point: ; error: AutoCAD variable setting rejected: "CVPORT" 2/6/1

 

same error like cvport 1/2/6 for defendant layouts.

may be system variable.

but it's good tool.

 

 

thanks

yathishkumar

Link to comment
Share on other sites

Thanks for the code Marko. It's alot closer to what I'm looking for but when I run it, the viewport that gets activated pans correctly. My other viewport however not so much. I know the reason is that my UCS is rotated in one of the viewports. Is there any way to take this into account? Right now to pan both viewports, I draw a line in paperspace, copy it so there's an identical line on top of both vports, then chspace the line into each vport and then use -pan command end select the end points of the line so the view pans the direction and distance equally.

 

Hopefully this should fix it to be working as expected in all MS/PS situations...

 

;;; Pan in All Viewports (28-XI-2012)
(defun c:PAV ( / oldCVPort oldCmdEcho listVPorts pointBase pointMove )

(if (and (eq (getvar 'tilemode) 0)
         (eq (getvar 'cvport) 1))
 (command "_.MSPACE")
)

(setq listVPorts (mapcar 'car (vports))
      oldCmdEcho (getvar "CMDECHO")
      oldCVPort  (getvar "CVPORT"))

(setvar "CMDECHO" 0)
(if (and (setq pointBase (getpoint           "\nBase point: "))
         (setq pointMove (getpoint pointBase "\nNew point: ")))
 (foreach itemVPort (vl-remove 1 listVPorts)
  (setvar "CVPORT" itemVPort)
  (command "_PAN" pointBase pointMove)
 )
)

(setvar "CVPORT"  oldCVPort)
(setvar "CMDECHO" oldCmdEcho)
(princ)
)

Link to comment
Share on other sites

  • 2 years later...

Hello Guys, this is two years old, but a very useful thread! Thank you very much to all who contributed. I'd like to ask if the lisp could also correct same zoom between two MS viewports while it pans with the PAV?

Cheers!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...