How do I pass a vector to extrude command in an alias?

For example if I wanted an alias that’s something like ExtrudeCrvForward or ExtrudeCrvInboard

This part is obvious:

_ExtrudeCrv _pause _direction ???what here

Just putting numbers doesn’t seem to work.

Or is it easier / necessary to use python for this.

There’s a bit of a confusion in Rhino as when they say “vector” they mean “line”

try the other command ExtrudeCrvAlongCrv

And yes, I think Python is better.

‘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.

A macro like this might help-
! _ExtrudeCrv _Pause _Direction r0,0,0 r0,0,1 10

-Pascal

1 Like

You typed faster than me…

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’). :roll_eyes:

So, for 100% positive control over direction with a user-input extrusion length, yes, a script is the way to go.

1 Like

Thanks All.

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.

Ctrl+Shift+click…

1 Like

Woah. Game changer. I wonder how much time not knowing that cost me over the last 10 years. Maaaan.

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) )

Looks workable to me.

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.

Oi so exu couldn’t be like

_BoatDirectionExtrude _Direction=up

?

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.

-Pascal

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…

-Pascal

it is friday…

:beer: :beer: :beer: :beer: :beer: :beer: