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.
Few notes:
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.
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 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.
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.
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.