For anyone interested, I am sharing a simple tool that helps with quickly focusing the view/center of rotation at the exact spot on the model under the cursor, at any time (including in-command). It was designed as a quick one-shot view adjustment to make the viewport navigation and rotation more efficient and intuitive.
There are currently ways in Rhino to achieve similar thing (_MoveTargetToObjects centers target at selection’s bounding-box, ‘Place Target’ from ViewProperties, or well hidden feature of Ctrl+Shift+RMB-drag rotation around the point on object under cursor, without camera position change…). Yet none of them was too handy for quick, precise and repetitious view adjustments while modeling. Since making this small tool, I got addicted to using it, so I decided to share it here in case anyone else finds it useful in the way they work with Rhino.
To install, please download this script, save on your HD, and drag-and-drop into Rhino viewport. DIG_SetTargetToCursor.rvb (3.8 KB)
I would suggest setting an easily accessible keyboard shortcut via menu Tools>Options >Keyboard to DIG_SetTargetToCursor (like Ctrl+W, Ctrl+Q…) so the quick retargeting is handy. (or as MMB macro in an unlikely event one doesn’t use it for anything else already)
The 2nd command (_DIG_SetTargetToCursorSteps) allows to configure the number of view smooth transition steps for retargeting (default=6). ‘1’ will make it instant.
EDIT: the only limitation I know of so far is it would not work on locked objects under cursor.
Below is a quick preview of how it works, including the ability to run it while in-command like drawing curves, scaling objects etc. which I find the most handy for precise snaps and selections.
Thanks, Jarek - I had a chance to give this a spin this morning - very nice, I’ll see how I like it on a hot key during the day - it seems like it could be very handy. One cool thing so far is that it can be used to rotate the camera by keeping the mouse pointer near one edge of a viewport.
thanks for the feedback and trying it out. It definitely only makes sense to have a hotkey for it so it can be invoked instantly, with no need of clicks or pressing enter, and often as the view is navigated.
I tried it as MMB macro which was the most handy, but I don’t want to sacrifice my Gumball toggle that has been there so far
Two things (wishes) came to my mind while trying the best configuration for this tool:
ability to add MMB-double-click macro assignment as additional Mouse option
allowing to reconfigure SPACEBAR from being a repeat of Enter/ RMB. This could mean either enabling Spacebar as another hotkey or even better, allow SPACEBAR+Key cobmos for more hotkey customizations.
Let me know if you have any other thoughts or suggestions for this tool.
Hi Jarek - just a thought… but I wonder if it might make sense, assuming it is fast enough, to fire a ray from the cursor in the view direction and set the target to the first object intersection it hits. It looks like that is not what is happening now - so sometimes the new target is in space and the thing that was visible under the cursor swings away when the view is pivoted.
In general, what you described is a simple idea of how it should work, ideally. Unfortunately the ShootRay method works only with Surf/PolySurf objects and I wanted it to work with any type, even including Control Points (if enabled). So I am using the PointPick method. The returned points on objects under cursor are sorted and the closest one to camera is used to re-target.
The only case it would not work should be if the object is locked since PointPick method ignores these. Are you seeing the problem you describe in any other scenario?
Hi Jarek - I tried with a near box and a far one - the target ended up in between someplace - I did this because a couple of times my hoped-for target was not at the center and often it is, and I wanted to see if that was just luck. If I can make a repeatable case, I’ll send it along. I was not being scientific, just a quick test…
Hi Pascal, what you describe should work, as long as either of the boxes is under the cursor while pressing the hotkey. In case nothing is under the cursor, camera would just rotate to center on that point and target would be on a Camera-Target line closest point to any closest object…
This should be really straight-forward with not many (except locked objects) cases where something may go wrong, so now I am curious to see if you can repeat the unscientific two-box test…
After reading about Pascal’s problems, I just realized a thing that should have been obvious …
The position is picked following Rhino’s selection rules, that is, it picks the closer surface in shading, but the closer isocurve/edge in wireframe.
Then I think you script is also useful to easily move, in wireframe, the target to a distant object, simply putting the cursor over an isocurve or edge.
Cool.
Thanks again.
P.S.
Here I edited your script to adapt it to my habits and environment …
I hope you don’t mind.
You are correct, the target selection is strictly based on Rhino’s picking mechanism… so if in Wirefame mode clicking on ‘empty’ area of the object, it will not pick a target on that object. I almost never work in Wireframe in non-Parallel views so I didn’t even consider this a problem This is possibly what Pascal encountered if trying it out in Wireframe mode.
Yes, if you are in Wireframe, you need to hover over edge or isocurve, just like when picking objects. I tried to ‘cheat’ and switch to Shaded with Redraw disabled before PointPick, but it doesn’t work - I guess redraw is needed to simulate the click on shaded object, so I have no good idea how to make the “whole” objects work in Wireframe so far…
Feel free to edit/enhance it! Curious what you did to adapt to your workflow - perhaps I can implement some more customizations apart from the # of animation steps…
I think there’s no need.
IMO the script works fine as it is,.
As i mentioned, I can use it to ‘jump’ to distant objects, which usually is not so easy using regular Rhino commands.
Then I’m glad that it work that way.
Nothing fancy or smart …
I only took away what I don’t need or slows down the workflow (not such a fast PC here …)
BTW … I wish that those nice RhinoScript methods were available in Python too.
… I would not have needed to ‘dive’ again in VBScript … I remember very little …
Yes, that’s definitely another advantage of it - once you retarget, the scroll-wheel zoom works very nice to quickly “jump” closer to the object that was a new target.
I saw you uncommented relocating the cursor - at first I thought it was good idea but then I kept falling off my mousepad
Here is one more addition, inspired by the need to have the ‘Retargetting’ script work under MMB, without giving up other macro already assigned to it. This script will allow to enhance the MMB-Macro functionality (for users that actually use Macro there), so it can have 4 different configurations, depending on the modifier key(s) pressed along with it. It may be useful independently of the script shared in this topic.
To use it, download, save on your HD and drag-and-drop into open Rhino viewport. ( Works in Rhino 6 and up only…)
Place ‘_NoEcho DIG_MMB_MacroEnhancer’ as MMB Macro (Options>Mouse>Middle Mouse Button>Run this Macro)
Then use ‘DIG_MMB_MacroEnhancerSettings’ command to define Macros for up to 4 cases (MMB-solo, CTRL+MMB, SHIFT+MMB, CTRL+SHIFT+MMB). Please note, for Aliases that use -Runscript(), like _DIG_SetTargetToCursor, a prefix of *** needs to be added for this to function properly.
For example a potential configuration could look like this:
So I am using the ReTargetting script as main MMB functionality, and CTRL+MMB to toggle Gumball…
I want to express my deepest gratitude for your macros.
I started using Rhino two years ago, but due to its learning curve and my proficiency with other software, I never fully got the hang of it.
This March, I challenged myself to do a project primarily in Rhino. For that, I extensively searched for macros, helpers, or anything that could improve my workflow and generally make working in Rhino smoother. I solely worked with rhino since then.
Over the last few days, I had to work on a rendering project in SketchUp. (I still haven’t fully grasped how to manage materials for rendering and change them quickly in Rhino, nor had the time to dive into it.) I used to think I was the unrivaled king of speed in SketchUp. However, I’ve now realized that with the time and skills I’ve developed in Rhino, SketchUp doesn’t even come close (aside from a few things, but every software has its quirks).
Long story short: your macro, along with many others, but yours in particular, has helped me truly enjoy working in Rhino. It allowed me to overcome the “initial” barrier and become really good and fast at what I’m doing—and it’s fun.
Thank you for that. I believe your functionality should be an integral part of Rhino’s approach to positioning objects in 3D space. For me, at least, it’s a game-changer, much like the BlockEdit_New plugin.
Sorry for the rather long message, and best regards,
Sebowim
P.S. Did you know that there’s a paid plugin on Food4Rhino that does the same as your macro?
Hello Sebastian,
I am glad to hear you find it useful as well. Since I came up with this it is indispensable for me as well.
Is the plugin you refer to on Food4Rhino called Sparrow?
If so, it’s my work, it builds up on this idea but offers much more functionality of MMB+key combination view navigation, unique functionality and more. It actually was much more developed since I published it but I did not have a chance to update the web documentation. Maybe you can give it a try as well!
The 3Dmouse community still needs better control over the whole camera frustum, and better drivers, and some actual savable rotation point(s). That would be sweet.
The viewport shouldn’t always have the rotation point stuck in the center.
The devs should get this figured out at some point in the next 10 yrs, cause this should’ve been figured out already. imo.
hey I just tried/bought sparrow, atleast to give smth. back. - and investigated the features.
I like the chance to use scripts and make it more versatile, but disliked some stuff / bugs(?):
dislike (1): restore title-view somehow doenst work in top view, in perspective, front and right it works
dislike (2): with your script I also got a point where I clicked this now via the plugin only shows when click-holding / click-moving
dislike (3): clicking resets the camera so I can focus on the part but pivoting does not, this I don’t quite get - I tried to get that behaviour of (2) by setting the pivot timing to 0.01 but then the camera is not focused
dislike (4): the pivoting is very slow, so it doesnt feel very responsive
like (5): what I very much like is that now the focus of the camera is not command - so I can revoke my last command via rightclick !! very cool
like (6): via the sub-object selection toggle (I think) I can leave sub-objects in selection filter on and toggle with that
like (7): as I already stated, to have the chance to revoke scripts via this - makes the mouse even more versatile
ps: I dont know how to get the license? I bought if off your store but didnt get a e-mail other than from paypal
Thank you, you should be getting the license instructions via email from tools@dig.gallery, please check your spam folder in case you don’t see the email or let me know here or via PM.
Thanks, this has been fixed now, I will send you the most recent version with lots of new functionality that has not been documented yet on the website along with the list of updates, including this one.
2,3 - I am not quite sure what you mean - would you be able to explain more or record some screen capture? We probably should take this discussion to PM or via email.
4 - which version or Rhino are you running? Any chance you can send me your SystemInfo generated from Rhino (Menu: Help > System Information)
You can get the same (not adding to undo stack) with the original script if we remove the “dot” object that shows the focus - you can check it out here: