Why does this Cap fail?

This Loft surface is built from 38 closed planar curves, all of which are parallel to the XY plane. Cap is supposed to work with curves like this - but this one does not. I’ve tried using the top and bottom curves to make patch surfaces, but joining those to the Loft does not work either. I’ve also tried loosening the Rhino tolerance value to 0.06, but that doesn’t help.

Is there some other way to make this a Closed Brep?
nocap.gh (69.6 KB)

Where is your file? :man_facepalming:

Ooops! The GH file is there now. Thanks for letting me know I just forgot to upload it.

I generated the curves from series of points on each horizontal layer. I haven’t thought about an alternative way to create the points - but since the curves are all planar now I’m not sure a different way would be any batter.

I don’t know how you created those curves but it took only a minute to see they are weird. They are all closed but alternate curves are “Periodic” (not sure what that means?). Their end points (seams) are in an odd place. Discontinuity results are peculiar. Brep edges ‘En’ (“naked”) of the loft are not what I expect.

Hmmm…I always thought “Periodic” meant closed. But apparently that’s not the case. The Loft curves won’t Loft unless the Periodic parameter of the Interpolate function is set to True. So I’ve just always done that.

Here’s an image showing the Interpolated curves with Periodic = False:

All the curves have a gap between last/first points, so they obviously wont Loft. But with Periodic set to True the curves do close and Loft works fine.

If I set Loft option Align Curves to True it makes no difference - Cap Still fails. I’ve also tried regenerating the curves, but again that does not help.

For a long time, you have relied on your slicer software to save you from bad geometry. For this, you have to deal with it. :wink:

You can use FitCurve to fix these curves. The loft can be capped and the result is a closed brep.

yescap.gh (70.9 KB)

1 Like

Yes, though remarkably slow for some reason? 8.5 times more control points.


Possibly the fit tolerance is too high? I didn’t look at it :man_running:

Yep. Curious, eh?

1 Like

Rebuilding the curves with a known number of control points might be a better option…

nocap_capped_by_rebuild_00_tp.gh (74.0 KB)

rebuild the polycurves with same amount of CVs as the nurbs curves have.
and use the rebuild option for the loft with - same amount of points.

1 Like

Wow Martin - talk about hitting the nail on the head. That works. Thanks - obviously I will have to read about what FitCurve actually does.

It seems to be quite mysterious - when I add some nice odd number (7) for the Degree value and a nice loose tolerance (0.02) for the Tolerance value it gives back a bunch of Null curves which Loft obviously doesn’t tolerate. So I just used the default values of nothing and got timings of 205 ms for the Fit, 1.5 sec for lofting the 38 new curves, and 1.9 sec for the Cap. I can easily live with these times.

Maybe Loft should have a new option that invokes FitCurve?


Are you ready for this? While typing the previous sentence I took a look at the Loft options. Would you believe there is a Refit option I just never paid attention to before (because I had no idea what it did) And would you believe if it apparently mimics the FitCurve object? And most amazing, with that set the Loft will cap successfully. And in less time too: no 205 ms for FitCurve, Loft = 1.2 sec, and Cap = 898 ms.

GAK! I guess this is how we learn our little lessons. (David must be grinning.)

1 Like


But you don’t need that. I don’t know how you decided on 50 but it works well:

capped_by_rebuild_2024Apr10a.gh (66.5 KB)

P.S. I guess the reason 50 works so well is that it’s based on a pentagon with five bumps per side, 25 bumps per curve.

capped_by_rebuild_2024Apr10b.gh (69.2 KB)

You are correct about the value of 50. The end result looks a bit odd (to me at least) when some of the bumps make near misses to some of the edges. With a multiple of the number of edges (I often use 5 or 7) all the bumps look nice and neat.

I tried 100 and 150, it looked better and better. But having so many control points can be problematic. 350 * 38 = 13,300 control points :bangbang: Something tells me the curves were created badly…

Maybe only the bumpy curves need so many control points? 19 instead of 38 and 250 instead of 350 equals 4,750 control points, plus 19 times 20 (380) equals “only” 5,130 total control points. :thinking:

P.S. I’ve done some careful comparisons and there is no doubt that Fit Curve, suggested by @martinsiegrist, with its tolerance (‘Ft’ input) set to ‘0.1’ does the best job of matching existing curves with the least number of control points. However, there might be better ways to create these curves in the first place?

capped_by_rebuild_2024Apr10c.gh (69.5 KB)

1 Like

I get your point, but I belong to the old school that says “Machines should work; people should think.” So I’d much prefer my CPU to spend more milliseconds crunching numbers than taking the time to tweak my GH file to eliminate those milliseconds. Furthermore, Rhino takes more time to display the baked geometry than GH takes to generate it, so at best tweaking the GH would be addressing less than half the total time to create an image. (Here’s hoping the Mcneel team can make image generation multi-threaded sometime soon.)

Here’s what the current end result looks like:

Using the standard Rhino tolerance settings this exports an error free STL file that has just under 3 million triangles in it’s mesh. This is far more than my printer needs, so before I try to slice it I’ll reduce the mesh to around 260,000 triangles. After doing that the sliced result look like this:

The Moire patterns are a screen resolution thing. This result will print in about 27 hours, so I’ll probably make some changes before I do a real print.

:rofl: That’s “new school”, relying on hardware instead of better algorithms, which is truly old school.

Here’s 150 points/curve and a switch from Interpolated to Polyline. I like this one a bit better. Thanks for the tip.

PS: Old people do old school things.

Oh look, this fully parametric model doesn’t require Fit Curve or Rebuild Curve for Loft and Cap Holes to work properly. And it’s fast!

vase_2024Apr11a.gh (26.8 KB)

Sure, there may be changes and improvements but it’s no surprise to me that forcing a machine to work harder is no substitute for better algorithms and geometry. That is “old school” :bangbang:

P.S. One of the simplest improvements, though subtle, is to rebuild the extended ‘Crv (shape)’ as that was extracted rather crudely from the original set of curves.


Even better would be a parametric way to create the base surface by lofting polygons at arbitrary heights and radii:

vase_2024Apr11b.gh (24.9 KB)