From 55f8c6d1bf064ae6c624a44278acd93b8e3dcb7d Mon Sep 17 00:00:00 2001 From: Pasukhin Dmitry <dpasukhi@opencascade.com> Date: Wed, 5 Mar 2025 11:45:18 +0100 Subject: [PATCH] Data Exchange - Datum Axis extraction issue (#407) Refactor axis handling with correct positioning and handling exceptions. --- src/STEPCAFControl/STEPCAFControl_Reader.cxx | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/STEPCAFControl/STEPCAFControl_Reader.cxx b/src/STEPCAFControl/STEPCAFControl_Reader.cxx index 5d4966f5cb..58845de2bf 100644 --- a/src/STEPCAFControl/STEPCAFControl_Reader.cxx +++ b/src/STEPCAFControl/STEPCAFControl_Reader.cxx @@ -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); } }