Add Ctrl+Mouse Scroll Wheel Function?

Add Ctrl+Mouse Scroll Wheel Function?

Anonymous
Not applicable
2,492 Views
8 Replies
Message 1 of 9

Add Ctrl+Mouse Scroll Wheel Function?

Anonymous
Not applicable

Hi,

 

I'm having some trouble zooming with the mouse wheel. In the regular 2D Wireframe viewport a Zoom Factor of about 15 is perfect, but in my other viewport (Realistic/Perspective) it zooms way to fast when I do that. In Perspective Mode I only need a Zoom Factor of 3.

I can only change the Zoom Factor globally and not differently for different viewports, so I'm wondering if there's a way to add a function or setting which makes the Zoom go 5x faster when holding the Ctrl button while scrolling?

 

I can't find any mouse wheel settings in CUI and I don't know if it's possible to do it with a script somehow.

Any ideas?

0 Likes
Accepted solutions (2)
2,493 Views
8 Replies
Replies (8)
Message 2 of 9

dlanorh
Advisor
Advisor
Look at the system variable "ZOOMFACTOR". You should be able to come up with a short script or lisp to change or toggle this between the values you need. "ZOOMFACTOR" default value is 60, so you need to experiment to find the two new values that you need to set it.

I am not one of the robots you're looking for

0 Likes
Message 3 of 9

Kent1Cooper
Consultant
Consultant

I haven't worked with reactors, but I like to imagine one could be built that would react to any change in the VIEWDIR System Variable.  If there are two 0.0 values and one [positive or negative] 1.0 value in it, the point of view is orthogonal from some direction, and it would set ZOOMFACTOR to 15, but if not, it would set it to 3.  Would something like that serve your purpose?

Kent Cooper, AIA
0 Likes
Message 4 of 9

doaiena
Collaborator
Collaborator
Accepted solution

Give this a try and tell us if it does what you need. It should work both in a single viewport and a multiple viewport workflow.

(defun OnSysVarWillChange (Reactor lst)

;if either the viewdir or vport changes,
;check the perspective var and set the zoomfactor var accordingly
(if (or (= (car lst) "VIEWDIR") (= (car lst) "CVPORT"))
(cond
((= (getvar "PERSPECTIVE") 1) (setvar "ZOOMFACTOR" 3));zoom factor for perspective view
((= (getvar "PERSPECTIVE") 0) (setvar "ZOOMFACTOR" 15));zoom factor for orthogonal view
)
)
)
;set up the reactor
(if (not Reactor)
(setq Reactor (vlr-sysvar-reactor nil '((:vlr-sysVarWillChange . OnSysVarWillChange))))
)

 

Message 5 of 9

Anonymous
Not applicable

Thank you, this seems to work very well!

 

Still would like to easily switch between a slower and faster zoom by holding the Ctrl-button while scrolling. Is that something that can be added in code?

0 Likes
Message 6 of 9

Anonymous
Not applicable

Hmm, it seems that in some drawings, the ZOOMFACTOR stays at 3, even when switching back to Parallel Perspective. It only switches from 15 to 3, but not back.

0 Likes
Message 7 of 9

doaiena
Collaborator
Collaborator
Accepted solution

It turns out that just changing the visual style from lets say Realistic + Perspective to 2dWireframe doesn't trigger the reactor, although variables like "VSFACESTYLE" are changing. I've coupled the function with a second reactor this time and it works in all the scenarios i've tested. Give it a shot and tell me if it does the trick now.

(defun ReactorFun (Reactor lst)

;if either the viewdir, vport or visual style changes,
;check the perspective var and set the zoomfactor var accordingly
(if (or (= (car lst) "VIEWDIR") (= (car lst) "CVPORT") (= (car lst) "VSCURRENT"))
(cond
((= (getvar "PERSPECTIVE") 1) (setvar "ZOOMFACTOR" 3)) ;zoom factor for perspective view
((= (getvar "PERSPECTIVE") 0) (setvar "ZOOMFACTOR" 15)) ;zoom factor for orthogonal view
)
)
)

;set up the var reactor
(if (not SysVarReactor)
(setq SysVarReactor (vlr-sysvar-reactor nil '((:vlr-sysVarChanged . ReactorFun))))
)
;set up the command reactor
(if (not CommandReactor)
(setq CommandReactor (vlr-command-reactor nil '((:vlr-commandEnded . ReactorFun))))
)
Message 8 of 9

Anonymous
Not applicable

Much better, thanks!

 

Any ideas on the Ctrl+scroll-function? Is it possible?

0 Likes
Message 9 of 9

doaiena
Collaborator
Collaborator

I dont think Ctrl+scroll is possible in AutoLisp, though it should be a fairly easy task in .NET. Ask your question in those forums.