‘Direction’ in native Rhino is always two points - ‘from’ and ‘to’ which internally creates a vector…
If you have a specific direction, you can macro the two points. Otherwise, with Python, what will be lacking is a dynamic preview (without creating a display conduit) but maybe you don’t need that.
This is fine if you are always going to be extruding the same distance, but say you want to set a direction and type in a different distance every time.
We have ! _ExtrudeCrv _Pause _Direction 0,0,0 0,0,1
which sets the direction.
Unfortunately the way V6 is built (different than V5) is it still pays attention to the mouse cursor. So if the mouse cursor is ‘below’ the curve, typing 10 in this case will extrude -10 (despite the fact that the vector is pointing ‘up’).
So, for 100% positive control over direction with a user-input extrusion length, yes, a script is the way to go.
Pascal, yes putting the ‘r’ in is what I was looking for. That solved it but…
I think a script might be a good idea for me anyway. More multipurpose. And as @Helvetosaur mentioned can keep hands on keyboard after curve selection with a script.
Would be cool if you could preselect surface edges. Like ctrl_click an edge or something and skip the user prompt for an edge selection.
Yeah, definitely. Once you figure out all the cool things you can do with sub-object selection of faces, edges and the like - already present in V5 and expanded in V6+ - it’s definitely like “wow!”
Does this look like I have the basic strategy correct?
obj = rs.GetObject("Select a curve", rs.filter.curve, preselect=True)
if obj:
# directionStr = rs.GetString up / down / forward / aft / inboard / outboard etc
#length = rs.GetReal
#if directionStr is up
#dirX == 0
#dirY == 0
#dirZ == length
#if directionStr is down
#dirX == 0
#dirY == 0
#dirZ == length * -1
#if directionStr is whatever
#maybe sub ifs for inboard and outboard, like if location of obj is in X+ positive then do this
#dirX == 0
#dirY == length
#dirZ == 0
#else do this
#dirX == 0
#dirY == length * -1
#dirZ == 0
#rs.ExtrudeCurveStraight( curve, (0,0,0), (dirX, dirY, dirZ) )
I’m wondering though - in my experience having to choose command line options like up, down, inboard, outboard is annoying - my tendency is to create separate commands for each commonly used direction via aliases…
So you hit exu for ExtrudeUp and then just type a length and enter… Saves command option clicking or typing and (relatively) easy to remember.
Yes, agreed. But I need the script in place first, correct? If I want to avoid the cursor position issue.
In a case where you don’t know the length and want to eyeball or snap to other geometry, would just have a different alias like sexu or whatever that just does _ExtrudeCrv like earlier discussed in this thread.
Yes - in fact you would use the same basic script, but change the variables for each case - then save the scripts under different names and make aliases for each one.
Also, just for the sake of completeness, using RhinoCommon you can add the options to the GetObject() so that all the different ways can be macroed from one script.
Yeah, I just find that that’s often more involved than just saving the script (which is only a few lines) with a different name for each option. 6 of one, half dozen of the other…