Hello. I am trying to make mesh similar to boundary surface component. As you can see the result from boundary surfaces looks likt this:
and from boundary mesh from Wombat/pOd
unnamed.gh (13.6 KB)
Hello. I am trying to make mesh similar to boundary surface component. As you can see the result from boundary surfaces looks likt this:
Hello
I have a component for that in Nautilus. But if you want c# or Python there is method Mesh.createpatch or another method.
I need to use this on shapediver, so, unfortunatelly i can not use nautilus.
Can you please help me with the code? For some reason it gives null as output
import Rhino.Geometry as rg
import ghpythonlib.components as ghc
import System.Collections.Generic as scg
def create_mesh_patch(outer_crv, inner_crvs=None):
if not isinstance(outer_crv, rg.Curve):
print(“Invalid outer curve input”)
return None
polyline_points = []
success, polyline = outer_crv.TryGetPolyline()
if not success:
curve_params = outer_crv.DivideByCount(30, True)
polyline_points = [outer_crv.PointAt(t) for t in curve_params]
polyline = rg.Polyline(polyline_points)
inner_boundary = scg.List[rg.Curve]()
if inner_crvs:
if isinstance(inner_crvs, rg.Curve):
inner_crvs = [inner_crvs]
for crv in inner_crvs:
inner_boundary.Add(crv)
angle_tolerance = 0.1
mesh = rg.Mesh.CreatePatch(
outerBoundary=polyline,
angleToleranceRadians=angle_tolerance,
pullbackSurface=None,
innerBoundaryCurves=inner_boundary,
innerBothSideCurves=None,
innerPoints=None,
trimback=False,
divisions=0
)
return mesh
if name == “main”:
result = create_mesh_patch(a, b)
I asked them to integrate it but they don’t want to for a reason they never told me and as I have nothing to earn with an integration it will not happen.
As I don’t use Python, I can’t say as it seems to be the good use if None is like null in c#.
I do that in C#, my Polyline are sorted, the first one is the exterior.
public static Mesh RegionToMesh(List<Polyline> lst_polylines)
{
if (lst_polylines.Count > 1)
{
List<Curve> lst_holes = new List<Curve>();
for (int i = 1; i < lst_polylines.Count; i++)
{
lst_holes.Add(lst_polylines[i].ToNurbsCurve());
}
Mesh mesh = Mesh.CreatePatch(lst_polylines[0], 0.01, null, lst_holes, null, null, false, 0);
mesh.RebuildNormals();
return mesh;
}
else
{
Mesh mesh = Mesh.CreatePatch(lst_polylines[0], 0.01, null, null, null, null, false, 0);
mesh.RebuildNormals();
return mesh;
}
}