1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00

0031466: Data Exchange - Cannot import layers from STeP file (7.4.0 regression)

Return possibility to find layers fir subshapes.
This commit is contained in:
ika 2020-09-10 21:56:08 +03:00 committed by abv
parent 7e785937b3
commit b95caec47d
2 changed files with 37 additions and 9 deletions

View File

@ -449,7 +449,6 @@ Standard_Boolean XCAFDoc_LayerTool::SetLayer(const TopoDS_Shape& Sh,
const Standard_Boolean shapeInOneLayer) const Standard_Boolean shapeInOneLayer)
{ {
TDF_Label aLab; TDF_Label aLab;
// if (! myShapeTool->FindShape(Sh, aLab) ) return Standard_False;
// PTV 22.01.2003 set layer for shape with location if it is necessary // PTV 22.01.2003 set layer for shape with location if it is necessary
if (! myShapeTool->Search( Sh, aLab ) ) return Standard_False; if (! myShapeTool->Search( Sh, aLab ) ) return Standard_False;
SetLayer(aLab, LayerL, shapeInOneLayer); SetLayer(aLab, LayerL, shapeInOneLayer);
@ -479,7 +478,8 @@ Standard_Boolean XCAFDoc_LayerTool::SetLayer(const TopoDS_Shape& Sh,
Standard_Boolean XCAFDoc_LayerTool::UnSetLayers(const TopoDS_Shape& Sh) Standard_Boolean XCAFDoc_LayerTool::UnSetLayers(const TopoDS_Shape& Sh)
{ {
TDF_Label aLab; TDF_Label aLab;
if (! myShapeTool->FindShape(Sh, aLab) ) return Standard_False; if (!myShapeTool->Search(Sh, aLab) )
return Standard_False;
UnSetLayers(aLab); UnSetLayers(aLab);
return Standard_True; return Standard_True;
} }
@ -494,7 +494,8 @@ Standard_Boolean XCAFDoc_LayerTool::UnSetOneLayer(const TopoDS_Shape& Sh,
const TCollection_ExtendedString& aLayer) const TCollection_ExtendedString& aLayer)
{ {
TDF_Label aLab; TDF_Label aLab;
if (! myShapeTool->FindShape(Sh, aLab) ) return Standard_False; if (!myShapeTool->Search(Sh, aLab) )
return Standard_False;
return UnSetOneLayer(aLab, aLayer); return UnSetOneLayer(aLab, aLayer);
} }
@ -507,7 +508,8 @@ Standard_Boolean XCAFDoc_LayerTool::UnSetOneLayer(const TopoDS_Shape& Sh,
const TDF_Label& aLayerL) const TDF_Label& aLayerL)
{ {
TDF_Label aLab; TDF_Label aLab;
if (! myShapeTool->FindShape(Sh, aLab) ) return Standard_False; if (!myShapeTool->Search(Sh, aLab) )
return Standard_False;
return UnSetOneLayer(aLab, aLayerL); return UnSetOneLayer(aLab, aLayerL);
} }
@ -520,7 +522,8 @@ Standard_Boolean XCAFDoc_LayerTool::IsSet(const TopoDS_Shape& Sh,
const TCollection_ExtendedString& aLayer) const TCollection_ExtendedString& aLayer)
{ {
TDF_Label aLab; TDF_Label aLab;
if (! myShapeTool->FindShape(Sh, aLab) ) return Standard_False; if (! myShapeTool->Search(Sh, aLab) )
return Standard_False;
return IsSet(aLab, aLayer); return IsSet(aLab, aLayer);
} }
@ -534,7 +537,8 @@ Standard_Boolean XCAFDoc_LayerTool::IsSet(const TopoDS_Shape& Sh,
const TDF_Label& aLayerL) const TDF_Label& aLayerL)
{ {
TDF_Label aLab; TDF_Label aLab;
if (! myShapeTool->FindShape(Sh, aLab) ) return Standard_False; if (!myShapeTool->Search(Sh, aLab) )
return Standard_False;
return IsSet(aLab, aLayerL); return IsSet(aLab, aLayerL);
} }
@ -547,7 +551,8 @@ Standard_Boolean XCAFDoc_LayerTool::GetLayers(const TopoDS_Shape& Sh,
Handle(TColStd_HSequenceOfExtendedString)& aLayerS) Handle(TColStd_HSequenceOfExtendedString)& aLayerS)
{ {
TDF_Label aLab; TDF_Label aLab;
if (! myShapeTool->FindShape(Sh, aLab) ) return Standard_False; if (!myShapeTool->Search(Sh, aLab))
return Standard_False;
return GetLayers(aLab, aLayerS); return GetLayers(aLab, aLayerS);
} }
@ -560,7 +565,8 @@ Standard_Boolean XCAFDoc_LayerTool::GetLayers(const TopoDS_Shape& Sh,
TDF_LabelSequence& aLayerLS) TDF_LabelSequence& aLayerLS)
{ {
TDF_Label aLab; TDF_Label aLab;
if (! myShapeTool->FindShape(Sh, aLab) ) return Standard_False; if (!myShapeTool->Search(Sh, aLab))
return Standard_False;
return GetLayers(aLab, aLayerLS); return GetLayers(aLab, aLayerLS);
} }
@ -574,7 +580,7 @@ Handle(TColStd_HSequenceOfExtendedString) XCAFDoc_LayerTool::GetLayers(const Top
{ {
Handle(TColStd_HSequenceOfExtendedString) aLayerS = new TColStd_HSequenceOfExtendedString; Handle(TColStd_HSequenceOfExtendedString) aLayerS = new TColStd_HSequenceOfExtendedString;
TDF_Label aLab; TDF_Label aLab;
if ( myShapeTool->FindShape(Sh, aLab) ) if (myShapeTool->Search(Sh, aLab))
aLayerS = GetLayers(aLab); aLayerS = GetLayers(aLab);
return aLayerS; return aLayerS;
} }

22
tests/bugs/xde/bug31466 Normal file
View File

@ -0,0 +1,22 @@
puts "================================================================================="
puts " 0031466: Data Exchange - Cannot import layers from STeP file (7.4.0 regression)"
puts "================================================================================="
puts ""
pload DCAF
XNewDoc D
box b 1 1 1
explode b f
XAddShape D b
XAddSubShape D b_1 0:1:1:1
XAddLayer D myLayer
XSetLayer D 0:1:1:1:1 myLayer
# check layer
set layer [XGetLayers D b_1]
if {$layer != "\"myLayer\" "} {
puts "Error: wrong result layer searching."
}
Close D