There’s been talk about orienting objects on meshes or polysurfaces that would come handy in many cases (@leex, @laborda, @EricM, @pascal ).
Here is an experimental tool that should do that, with some more options. It’s a RhinoScript plugin that works in somehow ‘unorthodox Rhino’ way with limited command-line input but by pressing keys instead. See below for the key shortcuts map or press [ i ], and a video showing some of the workflow.
- In Rhino 5, to make a copy, press “c”. In Rhino 6 WIP only it is possible to also use LMB click.
- the regular Rhino snaps don’t work in real-time preview mode (can snap only to mesh vertex/edge). In order to have Snaps, use “Lock” mode [ v ]-key, from there with no interactive preview it is possible to use OSnaps. In “Lock” mode [c] will make a copy and prompt for the new item location, [ v ] will unlock the location.
- [ m ] will switch between keyboard transforms and regular mouse-driven transforms ( in mouse mode, once the specific transform key is pressed it will start prompting for mouse input)
- Obviously there may be some bugs and errors, so use with caution.
OrientObjectsOnObjects.rhp (60 KB)
For un-blocking: http://wiki.mcneel.com/rhino/unblockplugin
Hi Jarek thanks! , at first blush it looks like it probably does good things but so far I’m, finding it a little cryptic … I’ll poke some more.
Hi Pascal - yeah, I knew operating on objects with keyboard presses will be scary ; )
The workflow should be straight-forward (see below) - I am just curious if it works for other users since making Rhino 5 read the key presses in real-time is quite a hack.
Pick Items (Item = a collection of objects) and for each item pick a base point (and optionally a ‘normal’ direction - if skipped, World Z will be used)
Select base objects to orient on
From now on, just mouse-over the base objects - it should show the real-time preview of the Item being oriented. While doing so, you can transform the Item (w-s=scale, a-d=rotate, e-q=move), switch to next item (t-g), make a copy (c, or LMB in V6), etc. There are other options like changing the base point (b), flip (f), undo (u), reset transform (x), zoom to Item (o), lock Item in place (v); change scale mode from 1D to 3D (1,3), and transform method (m - mouse or keyboard); also, in case there are few base objects under the cursor, the ‘dot’ will turn cyan and (n) will toggle between the base objects for orientation. ® will show some more settings like the snap tolerances and the ‘step’ values of the keyboard-driven transforms.
Thanks alot for this tool Jarek!
I can imagine multiple cases where I could use it.
I’ll test it and share my experience as soon as I can.
First test here, works fine
May I ask how did you manage to catch key presses in Rhino ?
Nice tool. Many thanks !
Thanks for testing - good to know it works on your end as well.
As for catching key presses etc. :
In Rhino 6 (WIP) this should be much easier as we now have the 2 new methods for that:
“GetKey”, “GetAsyncKeyState” (with the 2nd one you can test for mouse clicks as well ).
In Rhino 5 it’s trickier. With RS only you can do it by reading the command line input, see the “RS_ReadKeyPress_Sample.rvb” attached.
You can do more in V5 by using the DynamicWrapperX2 object (download at the bottom of the page) - with this one you can read keys and mouse presses, plus do many more things, but it may be more complicated if your scripts are intended to be used by others (making sure they have it available too). See “RS_ReadKeyPress_Sample2_with_DynamicWrapperX2.rvb” example.
RS_ReadKeyPress_Sample.rvb (1.4 KB)
RS_ReadKeyPress_Sample2_with_DynamicWrapperX2.rvb (904 Bytes)
Thanks a lot for the info and the samples, Jarek !
This is a great tool. Thanks!
I’m wondering if there would be a way to implement object snaps in your tool?
It may be possible to have it working in future version in real-time.
For now you can get the osnaps working only in 'Locked" mode.
If you press L it will lock the item in place, then C will make a copy and prompt for a new location. It will snap but not give you a ‘live’ preview, but it should orient your item on the surface correctly. In the video around 2:15 it shows how it should work.
It is very cool.
Great job! Is it possible to adjust the zoom step? I often need a 0.05 step. Can I do this on my own?
I don’t think that version had the “scale” factor customization implemented. There are basically two modes, if you press SHIFT+W / SHIFT+S, the scale is more subtle, but you cannot set the custom scale in the previously published version of the script.
I’m understood, thank you.
@Jarek is there a way to load it into V6?
it should work in V6, did you try installing it?
Yes I did and when The option popped up I chose Rhino 6 but when it opened I was in V5.
Try drag-and-drop the rhp file into Rhino 6 vport, or go via Options-Plugins-Install in V6. Does that work?
Thanks. I had to go through a few steps including the unblock instructions, but it’s in now!