1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-01 17:36:21 +03:00

Data Exchange - Datum Axis extraction issue (#407)

Refactor axis handling with correct positioning and handling exceptions.
This commit is contained in:
Pasukhin Dmitry 2025-03-05 11:45:18 +01:00 committed by GitHub
parent 72960352ed
commit 55f8c6d1bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3286,20 +3286,11 @@ Standard_Boolean STEPCAFControl_Reader::readDatumsAP242(const Handle(Standard_Tr
if (theGDTL.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aTol))
{
Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aTol->GetObject();
Handle(TColStd_HArray1OfReal) aDirArr = anAx->Axis()->DirectionRatios();
Handle(TColStd_HArray1OfReal) aDirRArr = anAx->RefDirection()->DirectionRatios();
Handle(TColStd_HArray1OfReal) aLocArr = anAx->Location()->Coordinates();
gp_Dir aDir;
gp_Dir aDirR;
gp_Pnt aPnt;
if (!aDirArr.IsNull() && aDirArr->Length() > 2 && !aDirRArr.IsNull()
&& aDirRArr->Length() > 2 && !aLocArr.IsNull() && aLocArr->Length() > 2)
const Handle(Geom_Axis2Placement) aGeomAx2 =
StepToGeom::MakeAxis2Placement(anAx, theLocalFactors);
if (!aGeomAx2.IsNull())
{
aDir.SetCoord(aDirArr->Lower(), aDirArr->Lower() + 1, aDirArr->Lower() + 2);
aDirR.SetCoord(aDirRArr->Lower(), aDirRArr->Lower() + 1, aDirRArr->Lower() + 2);
aPnt.SetCoord(aLocArr->Lower(), aLocArr->Lower() + 1, aLocArr->Lower() + 2);
gp_Ax2 anA(aPnt, aDir, aDirR);
anObj->SetAxis(anA);
anObj->SetAxis(aGeomAx2->Ax2());
aTol->SetObject(anObj);
}
}