Grasshopper

algorithmic modeling for Rhino

Hello,

I'm just curious if there is a method available to create a brep surface from more than 4 points? 

The points are structured in a list that is understood and the resulting surfaces may or may not be planar.

The points are all vertices.

The resulting brep surface might have any (reasonable) number of vertices.

I ask because, if possible I would like to produce one brep surface from these points rather than breaking the product surface into multiple smaller breps (for example by breaking a 5 point brep into a 4 point and a 3 point brep that would be the equivalent of the original 5point brep surface).

I'd also like to avoid using the 'fragment patch' method.

thanks in advance.

Views: 1272

Replies to This Discussion

The problem with fitting a surface to a non-planar polyline boundary of more than four corners is that it often can't be done. At least one of the corners will have to be on the surface interior and surfaces tend to be smooth on the interior. The Patch component may get you close, but probably not all the way to where you want.

David,

Thanks. I understand and should have thought this through more before posting.

Here is my problem: I am struggling to create a planar brep from a series of points (more than 4 points).

I can successfully create any closed poly line or closed curve from the points and I have been trying to use either the poly line or curve to create a brep but without luck.  The brep to be created is just a single planar brep. It seemed like a good idea to use Brep.CreatePlanarBrep but it seems that this method won't ever produce just a single brep - it produces an array of them. 

Here is a simple bit of code - suggestions are appreciated.

// Point3d[] pointset is the set of points being used.  This set is defined by reducing a jagged array that down to an array for creating this particular brep via a curve.

// pointset has been tested and is correct.

Curve tempCurve = Curve.CreateInterpolatedCurve(pointset, 1);

// tempcurve has been tested and correctly forms a closed curve between the points.

Brep tempBrep = Brep.CreatePlanarBreps(tempCurve);

// tempBrep fails because it produces an array. I'm after a method that produces a single planar brep or surface from n points.  I've looked in rhinocommon and on this blog but haven't stumbled onto a suitable method.

Is there a c# method that is the equivalent of the 'boundary surfaces' component?

Brep.CreatePlanarBreps().

Almost all methods that create Breps are static methods on the Brep class that start with "Create".

David,

Thanks for confirming this.  I can successfully produce the right result but have stumbled onto an unexpected puzzle.

In the native c# component that sits within grasshopper I can use the following two lines to produce the planar brep and place it into a class level jagged array. 

Brep[] tempBrep = Brep.CreatePlanarBreps(tempCurve);

allBreps[i][j] = tempBrep[0];

Oddly this same code does not work in the Visual Studio environment.

I will dig on my end but wanted to let you know that it would be nice to have a method for creating planar breps that produces a single brep rather than a brep array.

You shouldn't use arrays unless you're writing SDK or very high performance code. If each call to CreatePlanarBreps is just supposed to generate a single result (which it is since you're only providing a single curve), you can put it all in a List<Brep>.

List<Brep> breps = new List<Brep>();

...

Brep[] planarBreps = Brep.CreatePlanarBreps(tempCurve);

if (planarBreps != null)

  breps.AddRange(planarBreps);

David,

Thank you, this is very helpful - and the check for null adddition too.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service