Toponaming: Add a plane matching based heuristic to TNP mitigation (#16803)
* Add a plane matching based heuristic to TNP mitigation * Improve comments, add test
This commit is contained in:
@@ -360,9 +360,21 @@ App::ElementNamePair Feature::getExportElementName(TopoShape shape,
|
||||
auto names =
|
||||
shape.decodeElementComboName(idxName, mapped.name, idxName.getType(), &postfix);
|
||||
std::vector<int> ancestors;
|
||||
// TODO: if names.empty() then the existing heuristic has failed to find anything
|
||||
// and we're going to flag this element as missing. This is the place to add
|
||||
// heuristics as we develop them.
|
||||
if ( names.empty() ) {
|
||||
// Naming based heuristic has failed to find the element. Let's see if we can
|
||||
// find it by matching either planes for faces or lines for edges.
|
||||
auto searchShape = this->Shape.getShape();
|
||||
// If we're still out at a Shell, Solid, CompSolid, or Compound drill in
|
||||
while (searchShape.getShape().ShapeType() < TopAbs_FACE ) {
|
||||
auto shapes = searchShape.getSubTopoShapes();
|
||||
if ( shapes.empty() ) // No more subshapes, so don't continue
|
||||
break;
|
||||
searchShape = shapes.front(); // After the break, so we stopped at innermost container
|
||||
}
|
||||
auto newMapped = TopoShape::chooseMatchingSubShapeByPlaneOrLine(shape, searchShape);
|
||||
if ( ! newMapped.name.empty() )
|
||||
mapped = newMapped;
|
||||
}
|
||||
for (auto& name : names) {
|
||||
auto index = shape.getIndexedName(name);
|
||||
if (!index) {
|
||||
|
||||
Reference in New Issue
Block a user