Part: fix test failure and add setBounds for backward compatibility

This commit is contained in:
wmayer
2022-08-23 14:06:47 +02:00
parent df8e661ddf
commit a783d5bbfc
2 changed files with 6 additions and 2 deletions

View File

@@ -1706,8 +1706,12 @@ PyObject* BSplineSurfacePy::scaleKnotsToBounds(PyObject *args)
}
}
PyObject *BSplineSurfacePy::getCustomAttributes(const char* /*attr*/) const
PyObject *BSplineSurfacePy::getCustomAttributes(const char* attr) const
{
// for backward compatibility
if (strcmp(attr, "setBounds") == 0) {
return PyObject_GetAttrString(const_cast<BSplineSurfacePy*>(this), "scaleKnotsToBounds");
}
return nullptr;
}

View File

@@ -188,7 +188,7 @@ class PartTestBSplineSurface(unittest.TestCase):
bs = to.toBSpline()
self.assertAlmostEqual(bs.bounds()[1], 2 * math.pi)
self.assertAlmostEqual(bs.bounds()[3], 2 * math.pi)
bs.setBounds(0.0, 1.0, 0.0, 1.0)
bs.scaleKnotsToBounds(0.0, 1.0, 0.0, 1.0)
self.assertAlmostEqual(bs.bounds()[1], 1.0)
self.assertAlmostEqual(bs.bounds()[3], 1.0)