1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0030727: Data Exchange - Problems in Shape Tool

Add protection from return of not top-level shape by FindShape method.
Add protection against located roots into FindMainShape method.
Add new Draw command for FindMainShape.
Add flag findInstance to Draw command FindShape
This commit is contained in:
ika
2019-05-22 15:22:54 +03:00
committed by bugmaster
parent 47cd8af2d2
commit 7783ba1120
9 changed files with 97 additions and 25 deletions

View File

@@ -303,20 +303,26 @@ Standard_Boolean XCAFDoc_ShapeTool::FindShape (const TopoDS_Shape& S,
if (TNaming_Tool::HasLabel(Label(), S0)) {
int TransDef = 0;
L = TNaming_Tool::Label(Label(), S0, TransDef);
return Standard_True;
}
/*
TDF_ChildIDIterator it(myLabel,TNaming_NamedShape::GetID());
else
return Standard_False;
if (IsTopLevel(L))
return Standard_True;
// Try to find shape manually
TDF_ChildIDIterator it(Label(), TNaming_NamedShape::GetID());
for (; it.More(); it.Next()) {
TDF_Label aLabel = it.Value()->Label();
Handle(TNaming_NamedShape) NS;
if ( aLabel.FindAttribute(TNaming_NamedShape::GetID(), NS) &&
S0.IsSame ( TNaming_Tool::GetShape(NS) ) ) {
S0.IsSame ( TNaming_Tool::GetShape(NS) ) ) {
L = aLabel;
return Standard_True;
}
}
*/
L = TDF_Label();
return Standard_False;
}
@@ -1154,7 +1160,8 @@ TDF_Label XCAFDoc_ShapeTool::FindMainShape (const TopoDS_Shape &sub) const
TDF_ChildIterator it(Label());
for (; it.More(); it.Next()) {
TDF_Label L = it.Value();
if ( ! IsAssembly ( L ) && IsSubShape ( L, sub ) ) return L;
if ( IsSimpleShape( L ) && IsSubShape ( L, sub ) ) return L;
}
TDF_Label L0;
return L0;