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

0032049: Data Exchange - STEP file import problems

- Added checking for null objects
- Added support to find layers according to visible attr
- Fixed problem with same names of layers:
 Now, layers are grouped by names and visibility parameter
This commit is contained in:
dpasukhi
2021-01-17 16:27:11 +03:00
committed by bugmaster
parent b007889efd
commit 96049f2e3d
9 changed files with 96 additions and 37 deletions

View File

@@ -197,7 +197,7 @@ void STEPCAFControl_GDTProperty::GetDimClassOfTolerance(const Handle(StepShape_L
Standard_Boolean aFound;
theHolle = Standard_False;
//it is not verified information
for(Standard_Integer c = 0; c <= 1; c++)
for(Standard_Integer c = 0; c <= 1 && !aFormV.IsNull(); c++)
{
aFound = Standard_False;
Standard_Boolean aCaseSens = Standard_False;

View File

@@ -1491,6 +1491,18 @@ Standard_Boolean STEPCAFControl_Reader::ReadLayers(const Handle(XSControl_WorkSe
Handle(TCollection_HAsciiString) descr = SVPLA->Description();
Handle(TCollection_HAsciiString) hName = SVPLA->Name();
TCollection_ExtendedString aLayerName(hName->String());
TDF_Label aLayerLabel;
// check invisibility
Standard_Boolean isVisible = Standard_True;;
Interface_EntityIterator subs = WS->Graph().Sharings(SVPLA);
for (subs.Start(); subs.More() && isVisible; subs.Next()) {
if (!subs.Value()->IsKind(STANDARD_TYPE(StepVisual_Invisibility))) continue;
#ifdef OCCT_DEBUG
std::cout << "\tLayer \"" << aLayerName << "\" is invisible" << std::endl;
#endif
isVisible = Standard_False;
}
// find a target shape and its label in the document
for (Standard_Integer j = 1; j <= SVPLA->NbAssignedItems(); j++) {
@@ -1503,20 +1515,13 @@ Standard_Boolean STEPCAFControl_Reader::ReadLayers(const Handle(XSControl_WorkSe
TDF_Label shL;
if (!STool->Search(S, shL, Standard_True, Standard_True, Standard_True)) continue;
LTool->SetLayer(shL, aLayerName);
if (aLayerLabel.IsNull())
aLayerLabel = LTool->AddLayer(aLayerName, isVisible);
LTool->SetLayer(shL, aLayerLabel);
}
// check invisibility
Interface_EntityIterator subs = WS->Graph().Sharings(SVPLA);
for (subs.Start(); subs.More(); subs.Next()) {
if (!subs.Value()->IsKind(STANDARD_TYPE(StepVisual_Invisibility))) continue;
#ifdef OCCT_DEBUG
std::cout << "\tLayer \"" << aLayerName << "\" is invisible" << std::endl;
#endif
//TDF_Label InvLayerLab = LTool->FindLayer(aLayerName);
TDF_Label InvLayerLab = LTool->AddLayer(aLayerName); //skl for OCC3926
TDataStd_UAttribute::Set (InvLayerLab, XCAFDoc::InvisibleGUID());
}
if (!aLayerLabel.IsNull())
LTool->SetVisibility(aLayerLabel, isVisible);
}
return Standard_True;
}
@@ -4181,6 +4186,8 @@ Standard_Boolean STEPCAFControl_Reader::ReadMaterials(const Handle(XSControl_Wor
for (Standard_Integer idu = 1; idu <= DU->NbElements(); idu++) {
Handle(StepBasic_DerivedUnitElement) DUE = DU->ElementsValue(idu);
Handle(StepBasic_NamedUnit) NU = DUE->Unit();
if (NU.IsNull())
continue;
if (NU->IsKind(STANDARD_TYPE(StepBasic_ConversionBasedUnitAndLengthUnit)) ||
NU->IsKind(STANDARD_TYPE(StepBasic_SiUnitAndLengthUnit)))
{