PD: unit test to check offset of sub-shape binder (PR #7445)

This commit is contained in:
wmayer
2022-11-05 16:58:51 +01:00
parent 7c476bb67c
commit 056abcd3d4
2 changed files with 30 additions and 0 deletions

View File

@@ -48,3 +48,32 @@ class TestShapeBinder(unittest.TestCase):
FreeCAD.closeDocument("PartDesignTestShapeBinder")
#print ("omit closing document for debugging")
class TestSubShapeBinder(unittest.TestCase):
def setUp(self):
self.Doc = FreeCAD.newDocument("PartDesignTestSubShapeBinder")
def tearDown(self):
FreeCAD.closeDocument("PartDesignTestSubShapeBinder")
def testOffsetBinder(self):
# See PR 7445
body = self.Doc.addObject('PartDesign::Body','Body')
box = self.Doc.addObject('PartDesign::AdditiveBox','Box')
body.addObject(box)
box.Length=10.00000
box.Width=10.00000
box.Height=10.00000
binder = body.newObject('PartDesign::SubShapeBinder','Binder')
binder.Support=[(box, ("Edge2", "Edge12", "Edge6", "Edge10"))]
self.Doc.recompute()
self.assertAlmostEqual(binder.Shape.Length, 40)
binder.OffsetJoinType="Tangent"
binder.Offset = 5.00000
self.Doc.recompute()
self.assertAlmostEqual(binder.Shape.Length, 80)

View File

@@ -26,6 +26,7 @@
# datum tools
from PartDesignTests.TestDatum import TestDatumPoint, TestDatumLine, TestDatumPlane
from PartDesignTests.TestShapeBinder import TestShapeBinder
from PartDesignTests.TestShapeBinder import TestSubShapeBinder
# additive/subtractive features & primitives
from PartDesignTests.TestPad import TestPad