Hi, I know all the possible ways to lock or unlock viewport but what I'm not able to create is a macro or an override key to let me "Pan" the view of initially locked Viewport.
Let's say I worked on an existing detail in model space.
Then I know I will have to adjust the viewport by panning (no scale change) a little bit to see the detail entirely.
Normally I would select or get in the viewport, then unlock, then pan, then relock, ( then get out the viewport, then zoom extend in paperspace, then get back to modelspace ( ... I got a LISP that get these final steps done ) )
Now, and to have dreamed about this since at least 10 years, I would like to do this :
Double-click to get in the locked viewport, SHIFT + MIDDLE MOUSE BUTTON to let me PAN freely, release keys to be back to a locked viewport.(My problem if I accidently f_ckedup the scale by rolling (zooming) the middle mouse button)
Wonder if it's clear?
If impossible, a LISP to lock or unlock the viewport ( if = locked -> unlock, if = unlocked -> Lock) ?
Any reason you cannot just simply resize the locked viewport, outside of the viewport, and move it when you are done encompassing the larger detail? That's the simplest fix ever.
Thank you for you answer, 100% right, but this needs a couple more clicks/risks that I would like to avoid:
Stretching the viewport (at least one time, maybe more)
Move the viewport (at least one time, maybe more) (And I always forget I can override OSNAP and POLAR/ORTHO to get it the first time)
I can see my Override project to help in a couple of other situations...
Which can be a viewport that fit the frame you have for printing, perfectly, that you need to reposition the view (needs to unlock, pan and relock)
Wich can be I just drawn a new variant of a detail next to the original in modelspace and I need to create a viewport for it. Let's say I would choose to copy the locked viewport of the original detail next to it and then Unlock the VP, pan to the new detail and relock or more messing arround and Stretch the viewport to get to see the detail, Re-Stretch the viewport to fit the detail one side and re-stretch final to fit the other side, move the VP to it's place.
Wich can be the same but for more views copied from the first locked one... Would need to select multiple viewports then call up Properties or QuickProp tool, go to display lock to unlock, panning every view to satisfaction, reselect all VP, re-call Properties to lock all VP...
Etc..
.... How much times a day I am missing the Lock/Unlock taskbar button and bring up the "Scale list" or the "Add scale to annotative...." ?
Well anyway... if it's not possible to temporarly override the lock state of the VP while in it, to pan, I think i'll at least find a way to a LISP that would Lock or Unlock the current active VP with a keyboard command alias... I'm at this point!
Try this LISP. Your imaginary workflow would be awesome, but this is not the case. With this routine you need to double click VP, run command LPAN (could be assigned Keyboard Shortcut, or F* key), finish PAN by hitting ENTER or ESC, double click to leave VP.
BTW very good routines for VP lock/unlock are on theswamp.org HERE (free registration required). Color framing is very good visual control /red - locked, green unlocked...
EDIT: Ifyou're usedto PAN with holding the wheel, this modification might fit you better.
If you succeed finding a free hotkey combination, you can also use the CUI command (keyboard shortcuts) and assign the following modified "unLock" macro (AVPuL) to a "button down" event (or to a separate hotkey) and a "restore" macro (AVPre) to a "button up" event (or a second hotkey):
I tell people to never pan in a viewport. It's just too easy to change the scale while pressing the wheel. Adjusting the viewport instead of the view is just so easy. (Who really cares about a couple of clicks?)
Rob
Drafting is a breeze and Revit doesn't always work the way you think it should.
.... what I'm not able to create is a macro or an override key to let me "Pan" the view of initially locked Viewport. .... (My problem if I accidently f_ckedup the scale by rolling (zooming) the middle mouse button) ....
This may not do everything you envision, but see what you think:
(defun C:PanV (/ vp vpData vpID vpObj vpLocked); = PAN in a Viewport [whether locked or not]
(if (= (getvar 'tilemode) 0)
(progn ; then -- proceed
(command "_.pspace"); start there
(if
(and
(setq vp (car (entsel "\nSelect Viewport to Pan in: "))); picked something
(setq vpData (entget vp))
(member '(0 . "VIEWPORT") vpData); picked the right kind of thing
); and
(progn ; then -- proceed
(setq
vpID (cdr (assoc 69 vpData)); [doesn't seem to be in VLA Properties]
vpObj (vlax-ename->vla-object vp)
vpLocked (= (vlax-get vpObj 'DisplayLocked) -1); T or nil
); setq
(command "_.mspace"); get into Model Space,
(setvar 'cvport vpID); and force into that Viewport
(if vpLocked (vlax-put vpObj 'DisplayLocked 0)); unlock if necessary
(command "_.pan" pause pause)
(if vpLocked (vlax-put vpObj 'DisplayLocked -1)); relock if originally locked
(command "_.pspace")
); progn -- then [selected a Viewport]
(alert "\nNothing selected, or not a Viewport."); else
); if [selected a Viewport or not]
); progn -- then [in a Layout]
(alert "You must be in a Paper Space Layout, not in the Model tab."); else
); if [in a Layout or not]
); defun
One difference is that you select the Viewport by picking its boundary, not by double-clicking to get into it. In fact, if you're in Model Space through a Viewport when you start, it takes you out to Paper Space and asks you to select, so you can do this in a different Viewport than the one you're in when you start.
So far, it does only one Pan, in pick-two-points mode rather than dynamically, not the Pan-around-all-you-want that would be preferable. But the pick-two-points variety may be the only way to positively prevent the accidental scaling that can happen if you use the mouse wheel. It would probably be possible to have it recall that mode of Panning until you tell it you're done, so you can fine-tune the view in one running of the command, rather than recalling it and reselecting the Viewport if you don't get it to where you want.
BUT, this works in any Viewport, whether locked or not. If it's locked, it unlocks it for Panning and then re-locks it. If it's unlocked, it leaves it that way.
If you succeed finding a free hotkey combination, you can also use the CUI command (keyboard shortcuts) and assign the following modified "unLock" macro (AVPuL) to a "button down" event (or to a separate hotkey) and a "restore" macro (AVPre) to a "button up" event (or a second hotkey):
(...)
Hi and thanks for your answer.
I'm not sure If I understood well, maybe that's too much for me :
At first I understood that I could, via CUI/Keyboard shortcut/Temporary Override Keys create a new T.O.Key
So I load up your lisp, than try to figure out how to write the macro 1 and 2... only way I found was
Macro 1 (key Down) : (c:AVPul)
Macro 2 (key up) : (c:AVPre)
And assign SHIFT+1 to this
But doesn't work because it's an override so a command must be running and if I start the PAN command it returns :
"Viewport is view-locked. Switching to Paper space."
So AVPul can't be triggered
How to get the Up / Down key to work?
------
Then maybe another way which would be
1. To be in a locked viewport and fire up AVPul from hot key combination (CTRL+SHIFT+2) to unlock viewport
2. Pan
3. fire up AVPre from another hot key combination (CTRL+SHIFT-3)
But didn't test it out because this...
Leads me to another final way by mixing up the LPAN lisp found above with a mouse button click action:
SHIFT+Button3 (middle mouse button) triggers LPAN (created a new "command" in CUI command list with macro calling : (c:LPAN) (right way?))
------
Finally, this 3rd way is pretty fast to get to Pan my inially locked viewport... seems to have to issue...
+ Lazy pro tip to that suits my workflow : Adding to get to PSPACE after ending PAN...
I get my imaginary workflow to be real I guess...!!
But yess it would certainly be cool to understand how to set the macro down and up keyboard key and everything but if it's to complicated, I can live with that last setup I just described... It's pretty fast!
I tell people to never pan in a viewport. It's just too easy to change the scale while pressing the wheel. Adjusting the viewport instead of the view is just so easy. (Who really cares about a couple of clicks?)
Can't argue on this! Humm well I could say that my "ZOOMFACTOR" is so hard that I can't miss the change of the scale if it ever happens... Could also buy a decent computer mouse (mice?) 🙂
So far, it does only one Pan, in pick-two-points mode rather than dynamically, not the Pan-around-all-you-want that would be preferable. But the pick-two-points variety may be the only way to positively prevent the accidental scaling that can happen if you use the mouse wheel. It would probably be possible to have it recall that mode of Panning until you tell it you're done, so you can fine-tune the view in one running of the command, rather than recalling it and reselecting the Viewport if you don't get it to where you want.
BUT, this works in any Viewport, whether locked or not. If it's locked, it unlocks it for Panning and then re-locks it. If it's unlocked, it leaves it that way.
Wow, interesting, I'll check it out and it's true that it's a risky workflow I'm trying to get but I assume... as it get me to be so much faster while preparing/modifying all layouts... and as I said, I think ZOOMFACTOR is the key to this accidental scaling... I'm working at 75...