I am unwelding specific mesh edges with Python in a GH component to achieve creased SubD edges. SubD conversion is done with GH’s Subd from Mesh component. The mesh has Ngons with 5 and 6 vertices. UnweldEdge() destroys the Ngons. I am trying to store the Ngons and add them again after UnweldEdge(). This results in an invalid mesh and SubD from Mesh reverts to triangulating the Ngon faces. Mesh edges look ok though. With the original mesh, Subd from Mesh respects the Ngon faces (DEBUG output). How can I keep the Ngon intact while unwelding the edges?
Any other way to crease edges programmatically? As far as I understood from @dalelear the relevant methods for this are not yet exposed in rhcommon:
Edit: I extracted the relevant part of the geometry. It is internalized in the below GH file.
def ngon_tag(mesh, indices):
ngs = 
for ng in mesh.Ngons:
if ng.BoundaryVertexCount > 4:
# After UnweldEdge Ngons are gone
res = mesh.UnweldEdge(indices, True)
# AddNgons recreates Ngons but results in an invalid mesh and subsequently
# GH SubD from Mesh component triangulates Ngons with more than 4 vertices.
Subd from Mesh with orignal mesh, Ngons respected:
Thanks for adding SetEdgeTags to rhcommon. The C# component below uses it. Creasing decisions are based on points at the control polygon edges middle point (point at middle → edge is creased). 1075_210602_RFD-SubdEdgeTagWSearch_SO.gh (11.5 KB)
Some issues persist that I cannot resolve.
The SubdDEdges component generates an Object reference not set to an instance of an object error. I suspect this is caused by caching: When I copied the C# component in another definition and connected the inputs, SubDEdges worked. (Edit: ) Any upstream change before the C# component brings back the error. Output of the C# component superficially looks good. I tried calling ClearEvaluationCache and UpdateAllTagsAndSectorCoefficients in all possible combinations. Still getting the same error.
After baking the output of the C# component, we get weird shading behavior. Arctic mode is extremely slow and artifacts show on the SubD. This does not happen if we bake the SubD before the C# component. We have seen this before with modeled SubDs, but it was resolved by a recent update.