kgallion
(Kgallion)
May 24, 2021, 11:41pm
1
I’m looking for a way to merge all coplanar mesh faces in Rhino common from C#. This functionality is available in Rhino7 UI in the _MergeAllCoplanarFaces command.
I see Brep.MergeAllCoplanarFaces(), but do not see the equivalent for a Mesh.
Thanks!
rajaa
(Rajaa Issa)
May 25, 2021, 3:04pm
2
Hi. There is an SDK function that takes geometry as input including meshes that should hel. Look for RhinoMergeCoplanarFaces
kgallion
(Kgallion)
May 25, 2021, 6:46pm
3
Hi, and thanks for the feedback!
I’m using the .NET plugin SDK NuGet Gallery | RhinoCommon 7.6.21127.19001 . I don’t see it there.
rajaa
(Rajaa Issa)
May 25, 2021, 7:43pm
4
It does not look like it is ported to RhinoCommon.
I added a request to do that here…
1 Like
Hi @rajaa Was this command finally added to RhinoCommon and is there another way to do it with Python vb or macro?
brian
(Brian Gillespie)
August 11, 2021, 5:53pm
6
Thanks for add this To sdk
this component is MergeAllCoplanarFaces for Brep Mesh SubD
private void RunScript(GeometryBase geometry, bool MeshToSubd, ref object Geometry, ref object Result)
{
if (null != geometry)
{ string R = geometry.GetType().ToString();
if(R == "Rhino.Geometry.Brep")
{ var x = Brep.TryConvertBrep(geometry);
Geometry = x.MergeCoplanarFaces(RhinoDocument.ModelAbsoluteTolerance);
Result = Geometry;
Geometry = x;
}
else if(R == "Rhino.Geometry.Mesh" && MeshToSubd == false)
{ var x = geometry as Mesh;
Geometry = x.MergeAllCoplanarFaces(RhinoDocument.ModelAbsoluteTolerance, RhinoDocument.ModelAngleToleranceRadians);
Result = Geometry;
Geometry = x;}
else if(R == "Rhino.Geometry.Mesh" && MeshToSubd)
{ var x = geometry as Mesh;
var y = SubD.CreateFromMesh(x);
Geometry = y.MergeAllCoplanarFaces(RhinoDocument.ModelAbsoluteTolerance, RhinoDocument.ModelAngleToleranceRadians);
Result = Geometry;
Geometry = y;}
else if((R == "Rhino.Geometry.SubD"))
{ var x = geometry as SubD;
Geometry = x.MergeAllCoplanarFaces(RhinoDocument.ModelAbsoluteTolerance, RhinoDocument.ModelAngleToleranceRadians);
Result = Geometry;
Geometry = x;}
else
{Geometry = geometry;}}
}
MergeAllCoplanarFaces+A.gh (27.5 KB)
1 Like