Sweep 1 - multiple profile curves

Hi everyone,

I’m trying to create a simple script to model a shape from a rail and two (or more) different profile curves. This is why I want to use sweep, to blend between the different profile curves.

In Rhino this command works fine, by marking the “untrimmed miters”.

billede

But when I try to do this in GH, it seems that the the kinks of the polyline is making GH fail on the sweep command.

I’ve tried to “convert” the polyline into a nurb-curve, and this works better in GH, but it gets unprecise.

Is there anyone who can solved this one?
I tried to look around the forum, but all of the sweep problematics, seemed a bit different I think.

Sweep1multiple profile curves.gh (15.8 KB)

Best
Thom

Hey,
Have you tried to loft the curves instead?

I had a look into this and it is a bit of a puzzler. I think you could code this particular application but it wouldn’t be a generic solution. I tried digging through the RhinoCommon documentation but it doesn’t have anything for the ‘untrimmed miters’ option that you need.

Not a great solution but I’d suggest generating profile curves at each kink point in your rail by tweening between your end curves, then lofting through those.

Also FYI one of your Grasshopper profiles doesn’t have its kink point line up with the rail curve, this can easily be fixed:

1 Like

Within Grasshopper via right klick on “M” of rail function, it is possible to change the miter. However, it did not solve the problem when I tried changing it.

In RhinoCommon the sweepOneRail class has a property for miler type, see here:
https://developer.rhino3d.com/api/RhinoCommon/html/P_Rhino_Geometry_SweepOneRail_MiterType.htm
" 0: don’t miter, 1: intersect surfaces and trim sweeps, 2: rotate shapes at kinks and don’t trim"
Option 2 seems to refer to the GUI option “untrimmed milters”.

I tried to use a custom C# function to access that property - but again it did not solve the problem.

  private void RunScript(Curve R, List<Curve> S, ref object B)
  {

    SweepOneRail sweep = new SweepOneRail();
    sweep.MiterType = 2;
    var breps = sweep.PerformSweep(R, S);
    Brep brep = new Brep();
    for(int i = 0; i < breps.Length; i++ )
      brep.Append(breps[i]);
    B = brep;
  }

Indeed a bit puzzling why it is not affecting the result … :thinking:

As suggested by Matthew, the workaround would be to create profiles at the kinks and loft straight between them.

Yeah I did find that miter option, however it didn’t seem to make any difference however it was set! Is that a problem with the code or with the geometry in this instance?

Here is a simpler curve with the same issue:

Rail1.gh (6.1 KB)

Hi, See attached.

1 Like

Hi Guys,

Thank you so much for your effort and for getting back to me this quick,

Its wierd to me, that you can’t make the code from Rhinocommon do the same as rhino itself with the untrimmed miters. This woudl have been a nice way to get GH to do this… But thank you for trying Matthew.
Anyone who thinks this is possible?

I’d suggest generating profile curves at each kink point in your rail by tweening between your end curves, then lofting through those

I’m not sure how to do this. I can get the perp planes for each kink, but I need more than one plane for the two kinks in the middle of the "rail"curve, in order for the loft to be perp to the rail-direction, everytime the curve is turning.

I tried to do the tweening bwtween the two curves, and put the profile curves in the right order(right now in a very clumsy way, using list item. I’m not even sure the order is correct). How can I make sure the profile curves are used in the right order?

Also FYI one of your Grasshopper profiles doesn’t have its kink point line up with the rail curve, this can easily be fixed:

How do you fix this if the profile is assymetric?
billede

This is what I get so far…
LOFTmultiple profile curves-.gh (20.2 KB)

I am not sure what you are asking for? In terms of orientation alignment, try Align Plane.

This is how to check the order.

Hi CArlos

Thank you for this,

Could you perhaps show the name of the components you use. I’m having a hard time finding the same ones :see_no_evil: Either with bifocals or maybe without the “icons” displayed. Sorru for this, but it would make it easier for me… :slight_smile:
Thank you,

And this is what happens to my lofting:

Because I can only get one perpendicular plane for each kink:

And this is what I get from sweep1 in rhino, and I want to get the red oriented planes instead of the orange, which I get right now i GH

According to the order, I would love to be able to check the order of the profile curves (input curves to the orient component). So that I know which profile curve is used at what kink. Does this makes any sense? …

E.g.:
Start point: Profile curve 1
Second kink on rail curve: tween profile curve A
Thirds kink on rail curve: tween profile curve B
End pot on rail curve. profile curve 2
The tween is happening between profile curve 1 and 2.

But I think I just figured out that one:

Can you post your definition? Keen to see what you’ve done here. What curves are you lofting between?

1 Like

Toh - check out the definition attached - should do what you’re after by using the tween between curves method. Also FYI the referenced profile curves you have in your definition don’t match the edge profiles of your ‘PRSF create by sweep1 in Rhino’. So even when I had the method worked out, the created surface didnt match the Rhino one. I’ve rebuilt the profile curves from the rhino surface to get a closer match.

Let me know if you have any specific questions, hopefully the attached definion should clarify everything.

Sweep1multiple profile curves.gh (33.1 KB)

Can you post your definition? Keen to see what you’ve done here. What curves are you lofting between?

Yeah that would be great, cause the result looks good :slight_smile:

And thank you so much Matt, for posting a definition fixing both the “origin” point of my assymetric profile curve, and finding the plane of the curve. It looks great, but I get this message when opening, and the treesloth only works for R4-R5. Can you fix this without using the treesloth, or is it available for R6?

Its a very nice order you’re using :slight_smile: I’ll try to work like that from now on… :slight_smile:

Your def looks like this on mine:

The “edge curves taken from…” is this where I’m missing the treesloth, or what is supposed to be the input?

I’ve revised the definition to avoid using treesloth (which does work for Rhino 6 FYI, its just a series of components to make list and tree handling a little easier. Nothing overly essential, just nice to have). The component I used went between the stream filter and tween components. The edge curves taken from Rhino isn’t working as I forgot to internalize the geometry before saving :upside_down_face:

Sweep1multiple profile curves.gh (32.2 KB)

2 Likes

Hi Matt

Wauw thank you so much! This was way more complex than what I could have done myself.
But now its working very well. Impressive!

But its an important fact, how GH acts very different depending on if its a polyline or a curve.
The sweep in GH works very well if its a curve, but if its a polyline we need your definition.

Thank you once again!
Cheers,
Thom

Could you please send a link? I tried to install this Treesloth | Food4Rhino, but its not working for me. And I did removed the “blocking”

Thanks @Matt_Harwood,

When you change the Z Direction of a vertices on the Rail Curve (Polyline). The scripts fails to work.

Any ideas on how you could fix this?