sketch11 Posted May 28, 2021 Posted May 28, 2021 Is there a way for a viewport (in paper space) to follow objects as they are moved in model space. I was wondering if there's a setting which says "follow this block" or something similar. Or is coding required? Quote
CyberAngel Posted May 28, 2021 Posted May 28, 2021 It is possible to create a view object that is linked to a viewport. It is possible to add various objects to a group. If you grouped a view with your block, you might be able to do what you want. Just spitballing here. Of course, this gets hideously complex in a hurry. What happens if there are two blocks and you move one? What if the items aren't coplanar? How do you manage viewport scale? Good luck. 1 Quote
sketch11 Posted May 28, 2021 Author Posted May 28, 2021 OK no worries, it sounds too difficult then. Quote
CyberAngel Posted May 28, 2021 Posted May 28, 2021 3 minutes ago, sketch11 said: OK no worries, it sounds too difficult then. Don't misunderstand, I wasn't telling you not to try it. I don't know enough about your scenario to have an opinion about that. Someone else here may have a better, more elegant solution that does exactly what you want. 1 Quote
Dadgad Posted May 28, 2021 Posted May 28, 2021 (edited) If I wanted to do this somewhat predictably, I might do something like this. Draw a rectangle or other polygon in Modelspace to essentially frame the view or Objects in question. If you later move or create a new viewport, double click inside of it to activate it, then use the ZOOM command with Object commandline option, and choose the frame which you created. It will zoom to fit, don't forget to check your viewport scale and lock the viewport. As long as you move the frame with the object, you should be good. Edited May 28, 2021 by Dadgad septugenarian 1 Quote
BIGAL Posted May 28, 2021 Posted May 28, 2021 (edited) A lisp could read the viewport details in particualr scale, unlock if locked, jump to model space, pick a point, then jump back paperspace and reset Center and Customscale. Not tested. ; IAcadPViewport 3dd11c70 : TeighaX Interface of rectangular object created in paper space that display view ; ; Property values : ; ; Application (RO) = #<VLA-OBJECT IAcadApplication 000000002C756D60> ; Center = (135.0 100.0 0.0) ; CustomScale = 0.448933782267116 ; Height = 136.0 ; Width = 196.0 You need to use the trans function to work out the XYZ etc. Did drawgrid in paperspace based on model pick pt so have the answers but need to rewrite it to suit. Edited May 28, 2021 by BIGAL 1 1 Quote
sketch11 Posted May 29, 2021 Author Posted May 29, 2021 OK thanks. What if the view was linked to a single block which was a bounding rectangle, wherever this went the viewport would follow. Quote
BIGAL Posted May 29, 2021 Posted May 29, 2021 (edited) I dont think you can do this auto update. If say one block or a block with a attribute say layout number then run a lisp and would update. still thinking about it. Post a sample dwg with say 2viewports and 2 blocks. Try this ; pick new pt in a viewport ; By AlanH May 2021 (defun c:vpmove ( / lockv sss obj pt ) (command "._PSPACE") (prompt "\nPick viewport ") (setq sss (ssget "_+.:E:S" (list (cons 0 "Viewport")))) (setq cspace (cdr (assoc 69 (entget (ssname sss 0))))) (setq obj (vlax-ename->vla-object (ssname sss 0))) (if (= (vla-get-objectname obj) "AcDbViewport") (progn (if (= (vla-get-displaylocked obj) :VLAX-TRUE) (progn (setq lockv "Y") (vla-put-displaylocked obj :VLAX-FALSE) ) ) (command "Mspace") (setvar 'cvport cspace) (setq pt (getpoint "\nPick new point ")) (command "zoom" "C" pt "") (if (= lockv "Y")(vla-put-displaylocked obj :VLAX-TRUE)) (command "pspace") ) ) (princ) ) Edited May 30, 2021 by BIGAL Quote
Recommended Posts
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.