Multi extrude command

my wish is to see a multi extrude command for closed curves that are on diff’t directions.

same also goes for a multi offset surface command

any one else agree?

is there a script out there?

If all the closed curves are planar, that should be easily scriptable - but without a preview. To add a preview that would allow you to pull out one face and the others would come with it would be much more work.

Multi Offset surface is also possibility, but you would of course have to accept the default direction (or the inverse direction) of all the surfaces at once for ease in programin… An interface that allowed you to pick each individual object’s side to offset inside the script would be more work to program.

–Mitch

good idea Mitch but i want to see if it’s possible to extrude curves

yeah, I agree and have discussed it here in the past. I’ll find a link in a bit.

as far as multiple offset surface, that already works with _OffsetSrf… you can have multiple surfaces oriented in different directions… select them all then OffsetSrf… they will all offset according to their individual normal direction.
this (I feel) is how extrudeCrv, extrudeSrf, and moveFace should work


[EDIT] link to similar discussion:

Hmm, didn’t know that, thanks! --Mitch

of interest is MoveFace because it almost works right (or, what i feel is right)…

the preview shows correct but upon committing, the geometry reverts to the same ‘bad’ behavior which is also seen in the results of extrudeCrv and ExtrudeSrf…

  1. a couple of boxes with sub_object selected face in differing directions:

  1. run MoveFace with direction constraint -> Normal… the preview is correct

  1. upon committing… :confused:

I remember something about this from some time ago too, but not clearly.

For simplicity, if we just talk about ExtrudeCrv and planar curves on different planes, would this be something like:

  • Adding a new mode that extrudes each curve perpendicular to its plane rather than all in the same direction.
  • The normal direction sign for a closed planar curve depends on the direction of the curve, or we could complicate things more by being able to flip individual curves in the middle of the command. The sign of the extrude direction of an open curve isn’t defined.
  • The dragging feedback would be for distance only, and display perpendicular to one arbitrary curve in the selected set.
  • Lines would still extrude perpendicular to the current cplane.
  • If any non-planar curves were in the selected set, the individual plane option would be unavailable.
  • ToBoundary wouldn’t be accessible in individual plane mode.

Is that pretty close?

i spoke to vanessa from Rhino Chat

there’s a rhino script somewhere she’s seen that can extrude curves that facing multiple directions.

if there’s someone out there that knows that what im talking about. Please share :smile:

[quote=“lowell, post:8, topic:14652, full:true”]

  • Adding a new mode that extrudes each curve perpendicular to its plane rather than all in the same direction.[/quote]
    right… if the curves are planar then they would extrude perpendicular to their individual plane.

[quote]

  • The normal direction sign for a closed planar curve depends on the direction of the curve, or we could complicate things more by being able to flip individual curves in the middle of the command. The sign of the extrude direction of an open curve isn’t defined.[/quote]

hmm… personally, i’m not thinking that far ahead or of all possible scenarios… i think the way extrudeCrv works on single curves now is ok… so i was just thinking all the same rules would apply when multiple curves are selected.

[quote]

  • The dragging feedback would be for distance only, and display perpendicular to one arbitrary curve in the selected set.[/quote]
    it would be nice if the feedback/preview were to show properly for all curves in the set instead of just one of them… from a user point of view, it’s way better if the preview shows exactly what you’re going to get upon committing… i understand in certain scenarios, this would require all sorts of previews going in all sorts of different directions which may be too demanding on system resources or possibly a coding nightmare (i really don’t know :wink: ) but still, i think it’s much better if what you see is what you get.

[quote]

  • Lines would still extrude perpendicular to the current cplane.[/quote]
    right, lines would still extrude according to the cPlane… as would non-planar curves i imagine.

[quote]

  • If any non-planar curves were in the selected set, the individual plane option would be unavailable.[/quote]
    or just have them extrude perp to cplane… the same way a non-planar curve would extrude if selected individually.

[quote]

  • ToBoundary wouldn’t be accessible in individual plane mode.[/quote]
    yep… understandable.

yes, real close… ultimately, the simplest way for me to imagine it is:

• select a curve and run extrudeCrv… it does this:


• run extrudeCrv on a different curve and it does this:


run extrudeCrv on both of those curves and it does this: (error = “One input was not extruded because it would have made an invalid surface.”)


…when from my point of view, both curves should extrude according to the same rules when they’re selected individually as when they’re selected together.


[EDIT] re: distance preview…
right, so the cursor would have to be attached to one of the curves… i’m not really sure if it should be an arbitrary curve or user defined (“choose point to extrude from”)… it’s a bit confusing to try to consider all possible scenarios… ??
maybe a user could select one curve first then shift-select the rest in which case, the first selected curve will be what the cursor is attached to… otherwise, it’s a random choice where the cursor goes?

but i do think an actual distance preview should occur on all of the curves in their individual directions.

The way it works now, you can drag the extrusion either way and the feedback makes sense since there’s only one extrude axis. If there are multiple axis, it may not be at all clear why a particular curve is extruding the direction it is.
You could easily have 2 rectangles next to each other that were extruding in opposite directions. To avoid that, you’d either have to have some way to flip individual curves or cancel and flip some of them and start again.

Ya, I didn’t say that very well - The extrusion feedback would show for all of the curves, but the line from the basepoint (wherever that is) and the cursor would only really make sense with one extrude direction. And the cursor movement would be constrained to one line based on one of the curves.

It sounds pretty close to working, but the chance for confusion is still kind of high.

to me personally, that would actually be neat even with single selected curves… meaning, the direction of the preview determines which way it will go instead of positive/negative numbers… (as in- so many times my preview is showing one direction then i type in 42" <enter> and the extrusion goes the wrong way so i have to redo it remembering to type -42")

but i guess that’s going off the exact topic as it’s not the same thing as a ‘to point’ with cursor click.

with offsetSrf, if you select multiple surfaces, the user can then go around individually clicking on them to switch direction… maybe something like that could work with extrudeCrv?

keeping confusion to a minimum is definitely key :wink:
i realize the way i outlined so far leaves some holes in certain situations and there’s plenty of room for confusion still in these situations.

personally, most times i’ve wanted such capability, i would’ve been using ‘both sides’ in which a lot of this doesn’t matter but i understand that not everyone would want or need only both sides with such a tool.

This may or may not be what you want…

https://github.com/mcneel/rhinoscript/blob/master/ExtrudePlanarCurves.rvb

Hi,

I talked to DaleF, the dev of that script, but it just extrudes multiple curves normal to Cplane… I’m guessing this is not what you want… you’d like the extrusion to be normal to the curve’s plane right?

  • vanessa

@VaneSteeg try the script I posted above…

Ahh thanks! Saw your post after I submitted mine ;-).

Works like a charm

this is gonna save me so much time

thanks Dale and Vanessa :smile:

hey @dale

i was trying to make something similar in python but couldn’t get the distance right… i ended up adding a unit to the distance (in direction= )
why are you getting the correct distance in your version without doing that?


import rhinoscriptsyntax as rs

crv= rs.GetObjects ('Select planar curves')
dist= rs.GetReal('Distance',5)

for i in range (len(crv)):
    fromPt = rs.CurveNormal(crv[i])
    direction = rs.VectorScale(fromPt, dist+1)
    ext = rs.ExtrudeCurveStraight(crv[i], fromPt, direction)
    rs.CapPlanarHoles(ext)

(i know i need to add some checks/filters in there… i’ll do it after i get this other part figured out :wink: )

thanks


[edit] oh wait… just noticed you used CurvePlane and i did CurveNormal… maybe the problem lies there?
idk, i’ll mess around with it some more tomorrow unless you tell me the answer first :smile:

Jeff, the problem lies in the start point for the extrusion.
rs.ExtrudeCurveStraight requires two points for the extrusion.
you used the extrusion vector as the second point, if you do that, the first point must be 0,0,0
and not a unit vector , like fromPt.

I hope the explanation is clear enough … :smile:

d’oh!
yes, I see it now.
thanks @emilio



so here’s where i’m at with a python multi extrude:

"""ExtrudeMultiplePlanarCurves -- if this code works, it's mostly copied from
Dale.. if it doesn't work, i don't know who it's mostly copied from.. if it 
works but the code looks wacky, that part isn't copied from dale.."""


import rhinoscriptsyntax as rs

def extrudePlanar(crv, opts, distance):


    for i in range (len(crv)):
        curve = crv[i]
        plane = rs.CurvePlane(curve)
        origin = plane[0]
        vec = plane[3]
        
        direction = rs.VectorScale(vec, distance)
        point = rs.PointAdd(origin, direction)

        if opts[1]:
            bsdir = rs.VectorScale(vec, distance/2)
            bspoint = rs.PointAdd(origin, bsdir)
            trans = (origin - bspoint)
            newcrv = rs.CopyObject(curve, trans)
            ext = rs.ExtrudeCurveStraight(newcrv, origin, point)
            rs.DeleteObject(newcrv)
        else:
            ext= rs.ExtrudeCurveStraight(curve, origin, point)
    
        if opts[0]:
            rs.CapPlanarHoles(ext)
        if opts[2]:
            rs.DeleteObject(curve)


def Options():
    crv= rs.GetObjects('Select planar curves to extrude', 4, True, True)
    if not crv: return
    for i in range (len(crv)):
        if not rs.IsCurvePlanar(crv[i]):
            print 'All curves must be planar'
            return
    

    items=('Solid','Off','On'),('BothSides','Off','On'),('DeleteInput','Off','On')
    opts = rs.GetBoolean('Options', items, (False, False, False))
    distance = rs.GetReal ('Distance (if BothSides -> overall distance)',10)

    extrudePlanar(crv, opts, distance)

Options()

two questions-
• was there a better way to get the bothSides option? (instead of the if opts[1] part)

• i want to make the UI more like the ExtrudeCrv command… without the separate getBoolean & getReal parts… should i still keep the rs.GetObjects part then a separate Rhino.Input.Custom.GetOptions bit? or should that all happen from one Get____?

1 Like