Hi ,I want to do sth in GH as the _mergeface commend did in RHinos, but I only find the BrepJoin component,and that is not what exactly I want.What do you think/suggest?Thanks.
MergeFace hasn't been exposed in the SDK. It's not a particularly difficult function, but you do need a good understanding of Brep topology to do it right. I'll put a request in for this to be SDKified.
A Brep consists of many arrays of sub-types. Here's a brief description:
m_S contains all the untrimmed Surfaces that make up the brep
m_V contains all the vertices (sharp corner points on all edges)
m_E contains all edge curves
m_L contains all loops (loops are closed sequences of edge curves)
m_T contains all trimming curves
m_C2 contains uv-parameter curves (used by trim curves)
m_C3 contains xyz curves (used by edges)
m_F contains all faces, faces consist of a surface and a bunch of trim curves/loops.
Basically what you have to do in order to make a MergeAllFaces function is compare all adjacent faces. If they are coplanar you must collect all trim curves that are used by one (and only one) of the two faces. Join these trim curves into a new outline (while maintaining gap loops) and create a new planar surface that covers both old faces.
I'm not entirely certain if we actually have access to all required data from DotNET. I'll ask Rajaa to put MergeAllFaces into the RhinoCommon SDK and then it will become available inside Grasshopper 0.7.+ scripting components.
Sorry for my late reply and thanks for the information about Brep throgh I donot have a deep understanding now.
How to test wheather or not adjacent faces are coplaner?I cannot find a way to do that in gh myself .And then how to get all curves used by only one face?the only way I can think out is :1.get all the wireframe curve of all faces ;2.break them;3.compare there curves and cull all duplicate curves ( the kangaroo plugin for GH have a deleate duplicate line component ,so if it would deleate these duplicate curve twice it would do a perfect work. )
I also tried to use the region union component to do this work ,without luck. I cannot figure out why it/I failed. Thanks .
my comments were specifically meant in the context of C#/C++. It would be very difficult indeed, if not impossible to solve this with the current set of Grasshopper components.
Really good request. I was fightting with some planar srf joins and MergeAllFaces command is exactly what I need. It's good to know that it will be in GH 0.7x via scripttting components :)