]> OCCT Git - occt.git/commitdiff
0033101: Data Exchange - STEP reader makes unexpected enormous scaling of some parts
authorgka <gka@opencascade.com>
Wed, 17 Aug 2022 13:58:24 +0000 (16:58 +0300)
committersmoskvin <smoskvin@opencascade.com>
Tue, 23 Aug 2022 15:34:10 +0000 (18:34 +0300)
Modification to apply units scale factor for faces based on the triangulation

src/StepToTopoDS/StepToTopoDS_TranslateFace.cxx

index 998c8e1687c351d286518b3438bf5bb0c4412b44..209eb69338f4201e1173ec40078df31256015b0d 100644 (file)
@@ -46,6 +46,7 @@
 #include <ShapeAlgo.hxx>
 #include <ShapeAlgo_AlgoContainer.hxx>
 #include <StdFail_NotDone.hxx>
+#include <StepData_GlobalFactors.hxx>
 #include <StepGeom_BSplineSurface.hxx>
 #include <StepGeom_BSplineSurfaceForm.hxx>
 #include <StepGeom_OffsetSurface.hxx>
@@ -488,9 +489,11 @@ StepToTopoDS_TranslateFace::createMesh(const Handle(StepVisual_TriangulatedFace)
   const Standard_Boolean aHasNormals = (theTF->NbNormals() > 0);
   Handle(Poly_Triangulation) aMesh = new Poly_Triangulation(theTF->NbPnindex(), theTF->NbTriangles(), aHasUVNodes, aHasNormals);
 
+  const Standard_Real aLF = StepData_GlobalFactors::Intance().LengthFactor();
   for (Standard_Integer j = 1; j <= theTF->NbPnindex(); ++j)
   {
-    aMesh->SetNode(j, aNodes->Value(theTF->PnindexValue(j)));
+    const gp_XYZ& aPoint = aNodes->Value(theTF->PnindexValue(j));
+    aMesh->SetNode(j, aPoint * aLF);
   }
 
   for (Standard_Integer k = 1; k <= theTF->NbTriangles(); ++k)
@@ -573,9 +576,11 @@ StepToTopoDS_TranslateFace::createMesh(const Handle(StepVisual_ComplexTriangulat
   Handle(Poly_Triangulation) aMesh = new Poly_Triangulation(theTF->NbPnindex(), 
     aNbTriaStrips + aNbTriaFans, aHasUVNodes, aHasNormals);
 
+  const Standard_Real aLF = StepData_GlobalFactors::Intance().LengthFactor();
   for (Standard_Integer j = 1; j <= theTF->NbPnindex(); ++j)
   {
-    aMesh->SetNode(j, aNodes->Value(theTF->PnindexValue(j)));
+    const gp_XYZ& aPoint = aNodes->Value(theTF->PnindexValue(j));
+    aMesh->SetNode(j, aLF * aPoint);
   }
 
   Standard_Integer k = 1;