]> OCCT Git - occt.git/commitdiff
Data Exchange - Datum Axis extraction issue (#407)
authorPasukhin Dmitry <dpasukhi@opencascade.com>
Wed, 5 Mar 2025 10:45:18 +0000 (11:45 +0100)
committerGitHub <noreply@github.com>
Wed, 5 Mar 2025 10:45:18 +0000 (10:45 +0000)
Refactor axis handling with correct positioning and handling exceptions.

src/STEPCAFControl/STEPCAFControl_Reader.cxx

index 5d4966f5cb77b367a4c1fc8303c9b4622cbd883d..58845de2bfd9cb7f85c17ed3ee0e1811ed374aa0 100644 (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);
               }
             }