Minor test tweaks, and small fixes to pass tests

This commit is contained in:
bgbsww
2024-05-17 10:46:15 -04:00
committed by Chris Hennes
parent 40befa8708
commit e50ef22e7b
5 changed files with 13 additions and 4 deletions

View File

@@ -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&) {
}

View File

@@ -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();

View File

@@ -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();
}

View File

@@ -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

View File

@@ -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;