ON_Brep::JoinEdges gives invalid polysurface


(NathanM) #1

Hi,

I need to use this method to join several Brep faces that have coincident edges, but it keeps giving invalid outputs.

Here I attach a sample that reproduces the problem: I’ve simplified it to a Brep that has 2 independent faces ABCD and EFGH which turn out to have coincident edges BC and EH.

//   D---------e2-----C          H---------e6-----G              D---------e2-----C---------e6-----G
//   |                |          |                |              |                |                |
//   |                |          |                |              |                |                |
//   |                |          |                |              |                |                |
//   e3    Face 0     e1         e7    Face 1     e5    ---->    e3    Face 0     e1    Face 1     e5
//   |                |          |                |              |                |                |
//   |                |          |                |              |                |                |
//   |                |          |                |              |                |                |
//   A-------e0------>B          E-------e4------>F              A-------e0------>B-------e4------>F

I thus join them in the code before adding to the document:

// Join coincident edges BC and EH
ON_BrepEdge* edgeBC = brep->Edge(BC);
ON_BrepEdge* edgeEH = brep->Edge(EH);
bool rc = brep->JoinEdges(*edgeBC, *edgeEH, DBL_EPSILON);
brep->Compact();

The result is not valid, though the members of the Brep are valid (or those that I checked, m_V, m_E, m_F, m_T, m_L, m_C3, m_C2, etc.).

What’s the issue here? Is there another way to do this in C++? A priori I need this method as in my code I always first have independent faces with common edges that I then have to somehow join.

Here the code & thx
Nathan

cmdJoiningEdges.cpp (13.6 KB)


(Dale Fugier) #2

Hi @NathanM1994,

If you want to join Breps, use RhinoJoinBreps.

– Dale


(NathanM) #3

Thank you @dale
I figured out RhinoJoinBrepNakedEdges does the trick too.

Nathan