diff --git a/src/Mod/Part/App/PartFeature.cpp b/src/Mod/Part/App/PartFeature.cpp index ab22149a38..d42be05ca7 100644 --- a/src/Mod/Part/App/PartFeature.cpp +++ b/src/Mod/Part/App/PartFeature.cpp @@ -1450,9 +1450,13 @@ void Feature::onChanged(const App::Property* prop) if (!this->Shape.getValue().IsNull()) { try { p.fromMatrix(this->Shape.getShape().getTransform()); +#ifdef FC_USE_TNP_FIX + this->Placement.setValueIfChanged(p); +#else if (p != this->Placement.getValue()) { this->Placement.setValue(p); } +#endif } catch (const Base::ValueError&) { } diff --git a/src/Mod/Part/App/PropertyTopoShape.cpp b/src/Mod/Part/App/PropertyTopoShape.cpp index 75d8e48f73..1283a6007c 100644 --- a/src/Mod/Part/App/PropertyTopoShape.cpp +++ b/src/Mod/Part/App/PropertyTopoShape.cpp @@ -79,6 +79,9 @@ void PropertyPartShape::setValue(const TopoShape& sh) _Shape.Hasher = obj->getDocument()->getStringHasher(); _Shape.hashChildMaps(); } + if ( ! _Shape.isNull() && ! _Shape.isValid() ) { + _Shape.fix(); + } } hasSetValue(); _Ver.clear(); diff --git a/src/Mod/Part/App/TopoShape.cpp b/src/Mod/Part/App/TopoShape.cpp index cf6acf1ba1..9db1b05622 100644 --- a/src/Mod/Part/App/TopoShape.cpp +++ b/src/Mod/Part/App/TopoShape.cpp @@ -645,6 +645,7 @@ Base::Matrix4D TopoShape::getTransform() const { Base::Matrix4D mtrx; gp_Trsf Trf = _Shape.Location().Transformation(); + Trf.SetScaleFactor(1.0); convertToMatrix(Trf, mtrx); return mtrx; } @@ -3034,9 +3035,10 @@ TopoDS_Shape TopoShape::transformGShape(const Base::Matrix4D& rclTrf, bool copy) mat.SetValue(1,4,rclTrf[0][3]); mat.SetValue(2,4,rclTrf[1][3]); mat.SetValue(3,4,rclTrf[2][3]); - + // this copy step seems to eliminate Part.OCCError: gp_GTrsf::Trsf() - non-orthogonal GTrsf + BRepBuilderAPI_Copy copier(this->_Shape); // geometric transformation - BRepBuilderAPI_GTransform mkTrf(this->_Shape, mat, copy); + BRepBuilderAPI_GTransform mkTrf(copier.Shape(), mat, copy); return mkTrf.Shape(); } diff --git a/src/Mod/PartDesign/PartDesignTests/TestTopologicalNamingProblem.py b/src/Mod/PartDesign/PartDesignTests/TestTopologicalNamingProblem.py index ceaa68163e..5d3db9f3ef 100644 --- a/src/Mod/PartDesign/PartDesignTests/TestTopologicalNamingProblem.py +++ b/src/Mod/PartDesign/PartDesignTests/TestTopologicalNamingProblem.py @@ -580,7 +580,7 @@ class TestTopologicalNamingProblem(unittest.TestCase): self.Doc.recompute() # Assert self.assertEqual(len(body.Shape.childShapes()), 1) - self.assertEqual(body.Shape.childShapes()[0].ElementMapSize, 26) + self.assertEqual(body.Shape.childShapes()[0].ElementMapSize, 30) def testPartDesignElementMapPocket(self): pass # TODO diff --git a/tests/src/Mod/Part/App/TopoShapeExpansion.cpp b/tests/src/Mod/Part/App/TopoShapeExpansion.cpp index 20c9d652f9..3230a490f2 100644 --- a/tests/src/Mod/Part/App/TopoShapeExpansion.cpp +++ b/tests/src/Mod/Part/App/TopoShapeExpansion.cpp @@ -1815,7 +1815,7 @@ TEST_F(TopoShapeExpansionTest, makeElementThickSolid) // Note: Cannot do an elementsMatch here because the oldest OCCT treats ThickSolid a little // differently. So, just mae sure the size is right, and something has a THK in it. - for (auto element : elements) { + for (auto& element : elements) { if (element.second.find("THK") > 0) { EXPECT_TRUE(1); break;