|
|
|
|
@@ -931,7 +931,10 @@ class TestTopologicalNamingProblem(unittest.TestCase):
|
|
|
|
|
|
|
|
|
|
area1 = self.Pad.Shape.Area
|
|
|
|
|
# Act
|
|
|
|
|
self.Doc.getObject('Sketch').fillet(2,3,App.Vector(6.673934,25.000000,0),App.Vector(0.000000,21.980343,0),4.740471,True,True,False)
|
|
|
|
|
self.Doc.getObject('Sketch').fillet(2,3,
|
|
|
|
|
App.Vector(6.673934,25.000000,0),
|
|
|
|
|
App.Vector(0.000000,21.980343,0),
|
|
|
|
|
4.740471,True,True,False)
|
|
|
|
|
self.Doc.recompute()
|
|
|
|
|
area2 = self.Pad.Shape.Area
|
|
|
|
|
|
|
|
|
|
@@ -948,21 +951,29 @@ class TestTopologicalNamingProblem(unittest.TestCase):
|
|
|
|
|
|
|
|
|
|
def testShapeBinder(self):
|
|
|
|
|
doc = self.Doc
|
|
|
|
|
doc.addObject('PartDesign::Body','TNP_Test_Body_SubShape')
|
|
|
|
|
self.Body = doc.addObject('PartDesign::Body', 'TNP_Test_Body_SubShape')
|
|
|
|
|
doc.getObject('TNP_Test_Body_SubShape').Label = 'TNP_Test_Body_SubShape'
|
|
|
|
|
|
|
|
|
|
doc.recompute()
|
|
|
|
|
doc.getObject('TNP_Test_Body_SubShape').newObject('Sketcher::SketchObject','Sketch')
|
|
|
|
|
doc.Sketch.AttachmentSupport = (doc.getObject('XY_Plane'),[''])
|
|
|
|
|
doc.getObject('TNP_Test_Body_SubShape').newObject('Sketcher::SketchObject', 'Sketch')
|
|
|
|
|
doc.Sketch.AttachmentSupport = (doc.getObject('XY_Plane'), [''])
|
|
|
|
|
doc.Sketch.MapMode = 'FlatFace'
|
|
|
|
|
doc.recompute()
|
|
|
|
|
|
|
|
|
|
geoList = []
|
|
|
|
|
geoList.append(Part.LineSegment(App.Vector(0.000000, 0.000000, 0.000000),App.Vector(35.000000, 0.000000, 0.000000)))
|
|
|
|
|
geoList.append(Part.LineSegment(App.Vector(35.000000, 0.000000, 0.000000),App.Vector(35.000000, 25.000000, 0.000000)))
|
|
|
|
|
geoList.append(Part.LineSegment(App.Vector(35.000000, 25.000000, 0.000000),App.Vector(0.000000, 25.000000, 0.000000)))
|
|
|
|
|
geoList.append(Part.LineSegment(App.Vector(0.000000, 25.000000, 0.000000),App.Vector(0.000000, 0.000000, 0.000000)))
|
|
|
|
|
doc.Sketch.addGeometry(geoList,False)
|
|
|
|
|
geoList.append(
|
|
|
|
|
Part.LineSegment(App.Vector(0.000000, 0.000000, 0.000000),
|
|
|
|
|
App.Vector(35.000000, 0.000000, 0.000000)))
|
|
|
|
|
geoList.append(
|
|
|
|
|
Part.LineSegment(App.Vector(35.000000, 0.000000, 0.000000),
|
|
|
|
|
App.Vector(35.000000, 25.000000, 0.000000)))
|
|
|
|
|
geoList.append(
|
|
|
|
|
Part.LineSegment(App.Vector(35.000000, 25.000000, 0.000000),
|
|
|
|
|
App.Vector(0.000000, 25.000000, 0.000000)))
|
|
|
|
|
geoList.append(
|
|
|
|
|
Part.LineSegment(App.Vector(0.000000, 25.000000, 0.000000),
|
|
|
|
|
App.Vector(0.000000, 0.000000, 0.000000)))
|
|
|
|
|
doc.Sketch.addGeometry(geoList, False)
|
|
|
|
|
del geoList
|
|
|
|
|
|
|
|
|
|
constraintList = []
|
|
|
|
|
@@ -977,18 +988,17 @@ class TestTopologicalNamingProblem(unittest.TestCase):
|
|
|
|
|
doc.Sketch.addConstraint(constraintList)
|
|
|
|
|
del constraintList
|
|
|
|
|
|
|
|
|
|
doc.Sketch.addConstraint(Sketcher.Constraint('Distance',1,1,3,2,35.000000))
|
|
|
|
|
doc.Sketch.addConstraint(Sketcher.Constraint('Distance',0,1,2,2,25.000000))
|
|
|
|
|
doc.Sketch.addConstraint(Sketcher.Constraint('Distance', 1, 1, 3, 2, 35.000000))
|
|
|
|
|
doc.Sketch.addConstraint(Sketcher.Constraint('Distance', 0, 1, 2, 2, 25.000000))
|
|
|
|
|
doc.Sketch.addConstraint(Sketcher.Constraint('Coincident', 0, 1, -1, 1))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
doc.recompute()
|
|
|
|
|
|
|
|
|
|
doc.getObject('TNP_Test_Body_SubShape').newObject('PartDesign::Pad','Pad')
|
|
|
|
|
doc.getObject('TNP_Test_Body_SubShape').newObject('PartDesign::Pad', 'Pad')
|
|
|
|
|
doc.Pad.Profile = doc.Sketch
|
|
|
|
|
doc.Pad.Length = 10
|
|
|
|
|
doc.recompute()
|
|
|
|
|
doc.Pad.ReferenceAxis = (doc.Sketch,['N_Axis'])
|
|
|
|
|
doc.Pad.ReferenceAxis = (doc.Sketch, ['N_Axis'])
|
|
|
|
|
doc.Sketch.Visibility = False
|
|
|
|
|
doc.recompute()
|
|
|
|
|
doc.Pad.Length = 10.000000
|
|
|
|
|
@@ -1005,28 +1015,30 @@ class TestTopologicalNamingProblem(unittest.TestCase):
|
|
|
|
|
doc.recompute()
|
|
|
|
|
doc.Sketch.Visibility = False
|
|
|
|
|
|
|
|
|
|
doc.addObject('PartDesign::Body','TNP_Test_Body_Second')
|
|
|
|
|
doc.addObject('PartDesign::Body', 'TNP_Test_Body_Second')
|
|
|
|
|
doc.getObject('TNP_Test_Body_Second').Label = 'TNP_Test_Body_Second'
|
|
|
|
|
doc.recompute()
|
|
|
|
|
obj = doc.getObject('TNP_Test_Body_Second').newObject('PartDesign::ShapeBinder','ShapeBinder')
|
|
|
|
|
obj = doc.getObject('TNP_Test_Body_Second').newObject('PartDesign::ShapeBinder', 'ShapeBinder')
|
|
|
|
|
obj.Support = (doc.getObject("TNP_Test_Body_SubShape"), [u'Face6'])
|
|
|
|
|
doc.recompute()
|
|
|
|
|
doc.getObject('TNP_Test_Body_Second').newObject('Sketcher::SketchObject','Sketch001')
|
|
|
|
|
doc.getObject('Sketch001').AttachmentSupport = (doc.getObject('ShapeBinder'),[''])
|
|
|
|
|
doc.getObject('TNP_Test_Body_Second').newObject('Sketcher::SketchObject', 'Sketch001')
|
|
|
|
|
doc.getObject('Sketch001').AttachmentSupport = (doc.getObject('ShapeBinder'), [''])
|
|
|
|
|
doc.getObject('Sketch001').MapMode = 'FlatFace'
|
|
|
|
|
doc.recompute()
|
|
|
|
|
|
|
|
|
|
geoList = []
|
|
|
|
|
geoList.append(Part.Circle(App.Vector(14.725412, 16.666899, 0.000000), App.Vector(0.000000, 0.000000, 1.000000), 2.162720))
|
|
|
|
|
doc.getObject('Sketch001').addGeometry(geoList,False)
|
|
|
|
|
geoList.append(
|
|
|
|
|
Part.Circle(App.Vector(14.725412, 16.666899, 0.000000),
|
|
|
|
|
App.Vector(0.000000, 0.000000, 1.000000), 2.162720))
|
|
|
|
|
doc.getObject('Sketch001').addGeometry(geoList, False)
|
|
|
|
|
del geoList
|
|
|
|
|
|
|
|
|
|
doc.recompute()
|
|
|
|
|
doc.getObject('TNP_Test_Body_Second').newObject('PartDesign::Pad','Pad001')
|
|
|
|
|
doc.getObject('TNP_Test_Body_Second').newObject('PartDesign::Pad', 'Pad001')
|
|
|
|
|
doc.getObject('Pad001').Profile = doc.getObject('Sketch001')
|
|
|
|
|
doc.getObject('Pad001').Length = 10
|
|
|
|
|
doc.recompute()
|
|
|
|
|
doc.getObject('Pad001').ReferenceAxis = (doc.getObject('Sketch001'),['N_Axis'])
|
|
|
|
|
doc.getObject('Pad001').ReferenceAxis = (doc.getObject('Sketch001'), ['N_Axis'])
|
|
|
|
|
doc.getObject('Sketch001').Visibility = False
|
|
|
|
|
doc.recompute()
|
|
|
|
|
doc.getObject('Pad001').Length = 10.000000
|
|
|
|
|
@@ -1045,11 +1057,19 @@ class TestTopologicalNamingProblem(unittest.TestCase):
|
|
|
|
|
doc.getObject('Sketch001').Visibility = False
|
|
|
|
|
|
|
|
|
|
geoList = []
|
|
|
|
|
geoList.append(Part.LineSegment(App.Vector(28.380075, 21.486303, 0.000000),App.Vector(28.380075, 15.462212, 0.000000)))
|
|
|
|
|
geoList.append(Part.LineSegment(App.Vector(28.380075, 15.462212, 0.000000),App.Vector(32.797741, 15.462212, 0.000000)))
|
|
|
|
|
geoList.append(Part.LineSegment(App.Vector(32.797741, 15.462212, 0.000000),App.Vector(32.797741, 21.486303, 0.000000)))
|
|
|
|
|
geoList.append(Part.LineSegment(App.Vector(32.797741, 21.486303, 0.000000),App.Vector(28.380075, 21.486303, 0.000000)))
|
|
|
|
|
doc.Sketch.addGeometry(geoList,False)
|
|
|
|
|
geoList.append(
|
|
|
|
|
Part.LineSegment(App.Vector(28.380075, 21.486303, 0.000000),
|
|
|
|
|
App.Vector(28.380075, 15.462212, 0.000000)))
|
|
|
|
|
geoList.append(
|
|
|
|
|
Part.LineSegment(App.Vector(28.380075, 15.462212, 0.000000),
|
|
|
|
|
App.Vector(32.797741, 15.462212, 0.000000)))
|
|
|
|
|
geoList.append(
|
|
|
|
|
Part.LineSegment(App.Vector(32.797741, 15.462212, 0.000000),
|
|
|
|
|
App.Vector(32.797741, 21.486303, 0.000000)))
|
|
|
|
|
geoList.append(
|
|
|
|
|
Part.LineSegment(App.Vector(32.797741, 21.486303, 0.000000),
|
|
|
|
|
App.Vector(28.380075, 21.486303, 0.000000)))
|
|
|
|
|
doc.Sketch.addGeometry(geoList, False)
|
|
|
|
|
del geoList
|
|
|
|
|
|
|
|
|
|
constraintList = []
|
|
|
|
|
@@ -1068,29 +1088,37 @@ class TestTopologicalNamingProblem(unittest.TestCase):
|
|
|
|
|
# Assert
|
|
|
|
|
if self.Body.Shape.ElementMapVersion == "": # Should be '4' as of Mar 2023.
|
|
|
|
|
return
|
|
|
|
|
self.assertEqual(self.Body.Shape.BoundBox.XMin,0)
|
|
|
|
|
self.assertEqual(self.Body.Shape.BoundBox.YMin,0)
|
|
|
|
|
self.assertEqual(self.Body.Shape.BoundBox.ZMin,0)
|
|
|
|
|
self.assertEqual(self.Body.Shape.BoundBox.XMax,31.37)
|
|
|
|
|
self.assertEqual(self.Body.Shape.BoundBox.YMax,25.2)
|
|
|
|
|
self.assertEqual(self.Body.Shape.BoundBox.ZMax,20)
|
|
|
|
|
self.assertEqual(self.Body.Shape.BoundBox.XMin, 0)
|
|
|
|
|
self.assertEqual(self.Body.Shape.BoundBox.YMin, 0)
|
|
|
|
|
self.assertEqual(self.Body.Shape.BoundBox.ZMin, 0)
|
|
|
|
|
self.assertEqual(self.Body.Shape.BoundBox.XMax, 31.37)
|
|
|
|
|
self.assertEqual(self.Body.Shape.BoundBox.YMax, 25.2)
|
|
|
|
|
self.assertEqual(self.Body.Shape.BoundBox.ZMax, 20)
|
|
|
|
|
|
|
|
|
|
def testSubShapeBinder(self):
|
|
|
|
|
doc = self.Doc
|
|
|
|
|
doc.addObject('PartDesign::Body','Body')
|
|
|
|
|
self.Body = doc.addObject('PartDesign::Body', 'Body')
|
|
|
|
|
doc.Body.Label = 'Body'
|
|
|
|
|
doc.recompute()
|
|
|
|
|
doc.Body.newObject('Sketcher::SketchObject','Sketch')
|
|
|
|
|
doc.Sketch.AttachmentSupport = (doc.getObject('XY_Plane'),[''])
|
|
|
|
|
doc.Body.newObject('Sketcher::SketchObject', 'Sketch')
|
|
|
|
|
doc.Sketch.AttachmentSupport = (doc.getObject('XY_Plane'), [''])
|
|
|
|
|
doc.Sketch.MapMode = 'FlatFace'
|
|
|
|
|
doc.recompute()
|
|
|
|
|
|
|
|
|
|
geoList = []
|
|
|
|
|
geoList.append(Part.LineSegment(App.Vector(0.000000, 0.000000, 0.000000),App.Vector(35.000000, 0.000000, 0.000000)))
|
|
|
|
|
geoList.append(Part.LineSegment(App.Vector(35.000000, 0.000000, 0.000000),App.Vector(35.000000, 25.000000, 0.000000)))
|
|
|
|
|
geoList.append(Part.LineSegment(App.Vector(35.000000, 25.000000, 0.000000),App.Vector(0.000000, 25.000000, 0.000000)))
|
|
|
|
|
geoList.append(Part.LineSegment(App.Vector(0.000000, 25.000000, 0.000000),App.Vector(0.000000, 0.000000, 0.000000)))
|
|
|
|
|
doc.Sketch.addGeometry(geoList,False)
|
|
|
|
|
geoList.append(
|
|
|
|
|
Part.LineSegment(App.Vector(0.000000, 0.000000, 0.000000),
|
|
|
|
|
App.Vector(35.000000, 0.000000, 0.000000)))
|
|
|
|
|
geoList.append(
|
|
|
|
|
Part.LineSegment(App.Vector(35.000000, 0.000000, 0.000000),
|
|
|
|
|
App.Vector(35.000000, 25.000000, 0.000000)))
|
|
|
|
|
geoList.append(
|
|
|
|
|
Part.LineSegment(App.Vector(35.000000, 25.000000, 0.000000),
|
|
|
|
|
App.Vector(0.000000, 25.000000, 0.000000)))
|
|
|
|
|
geoList.append(
|
|
|
|
|
Part.LineSegment(App.Vector(0.000000, 25.000000, 0.000000),
|
|
|
|
|
App.Vector(0.000000, 0.000000, 0.000000)))
|
|
|
|
|
doc.Sketch.addGeometry(geoList, False)
|
|
|
|
|
del geoList
|
|
|
|
|
|
|
|
|
|
constraintList = []
|
|
|
|
|
@@ -1105,17 +1133,16 @@ class TestTopologicalNamingProblem(unittest.TestCase):
|
|
|
|
|
doc.Sketch.addConstraint(constraintList)
|
|
|
|
|
del constraintList
|
|
|
|
|
|
|
|
|
|
doc.Sketch.addConstraint(Sketcher.Constraint('Distance',1,1,3,2,35.000000))
|
|
|
|
|
doc.Sketch.addConstraint(Sketcher.Constraint('Distance',0,1,2,2,25.000000))
|
|
|
|
|
doc.Sketch.addConstraint(Sketcher.Constraint('Distance', 1, 1, 3, 2, 35.000000))
|
|
|
|
|
doc.Sketch.addConstraint(Sketcher.Constraint('Distance', 0, 1, 2, 2, 25.000000))
|
|
|
|
|
doc.Sketch.addConstraint(Sketcher.Constraint('Coincident', 0, 1, -1, 1))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
doc.recompute()
|
|
|
|
|
self.Body.newObject('PartDesign::Pad','Pad')
|
|
|
|
|
doc.Body.newObject('PartDesign::Pad', 'Pad')
|
|
|
|
|
doc.Pad.Profile = doc.Sketch
|
|
|
|
|
doc.Pad.Length = 10
|
|
|
|
|
doc.recompute()
|
|
|
|
|
doc.Pad.ReferenceAxis = (doc.Sketch,['N_Axis'])
|
|
|
|
|
doc.Pad.ReferenceAxis = (doc.Sketch, ['N_Axis'])
|
|
|
|
|
doc.Sketch.Visibility = False
|
|
|
|
|
doc.Pad.Length = 10.000000
|
|
|
|
|
doc.Pad.TaperAngle = 0.000000
|
|
|
|
|
@@ -1130,28 +1157,30 @@ class TestTopologicalNamingProblem(unittest.TestCase):
|
|
|
|
|
doc.Pad.Offset = 0
|
|
|
|
|
doc.recompute()
|
|
|
|
|
doc.Sketch.Visibility = False
|
|
|
|
|
doc.addObject('PartDesign::Body','Body001')
|
|
|
|
|
doc.addObject('PartDesign::Body', 'Body001')
|
|
|
|
|
doc.getObject('Body001').Label = 'Body'
|
|
|
|
|
doc.recompute()
|
|
|
|
|
binder = doc.getObject('Body001').newObject('PartDesign::SubShapeBinder','Binder')
|
|
|
|
|
binder = doc.getObject('Body001').newObject('PartDesign::SubShapeBinder', 'Binder')
|
|
|
|
|
binder.Support = self.Body
|
|
|
|
|
doc.getObject('Body001').newObject('Sketcher::SketchObject','Sketch001')
|
|
|
|
|
doc.getObject('Sketch001').AttachmentSupport = (doc.getObject('Binder'),['Face6',])
|
|
|
|
|
doc.getObject('Body001').newObject('Sketcher::SketchObject', 'Sketch001')
|
|
|
|
|
doc.getObject('Sketch001').AttachmentSupport = (doc.getObject('Binder'), ['Face6', ])
|
|
|
|
|
doc.getObject('Sketch001').MapMode = 'FlatFace'
|
|
|
|
|
doc.recompute()
|
|
|
|
|
|
|
|
|
|
geoList = []
|
|
|
|
|
geoList.append(Part.Circle(App.Vector(16.566162, 13.537925, 0.000000), App.Vector(0.000000, 0.000000, 1.000000), 2.197371))
|
|
|
|
|
doc.getObject('Sketch001').addGeometry(geoList,False)
|
|
|
|
|
geoList.append(
|
|
|
|
|
Part.Circle(App.Vector(16.566162, 13.537925, 0.000000),
|
|
|
|
|
App.Vector(0.000000, 0.000000, 1.000000), 2.197371))
|
|
|
|
|
doc.getObject('Sketch001').addGeometry(geoList, False)
|
|
|
|
|
del geoList
|
|
|
|
|
|
|
|
|
|
doc.recompute()
|
|
|
|
|
### Begin command PartDesign_Pad
|
|
|
|
|
doc.getObject('Body001').newObject('PartDesign::Pad','Pad001')
|
|
|
|
|
doc.getObject('Body001').newObject('PartDesign::Pad', 'Pad001')
|
|
|
|
|
doc.Pad001.Profile = doc.getObject('Sketch001')
|
|
|
|
|
doc.Pad001.Length = 10
|
|
|
|
|
doc.recompute()
|
|
|
|
|
doc.Pad001.ReferenceAxis = (doc.getObject('Sketch001'),['N_Axis'])
|
|
|
|
|
doc.Pad001.ReferenceAxis = (doc.getObject('Sketch001'), ['N_Axis'])
|
|
|
|
|
doc.getObject('Sketch001').Visibility = False
|
|
|
|
|
doc.recompute()
|
|
|
|
|
doc.Pad001.Length = 10.000000
|
|
|
|
|
@@ -1170,11 +1199,19 @@ class TestTopologicalNamingProblem(unittest.TestCase):
|
|
|
|
|
doc.getObject('Sketch001').Visibility = False
|
|
|
|
|
|
|
|
|
|
geoList = []
|
|
|
|
|
geoList.append(Part.LineSegment(App.Vector(30.009926, 21.026653, 0.000000),App.Vector(30.009926, 16.425089, 0.000000)))
|
|
|
|
|
geoList.append(Part.LineSegment(App.Vector(30.009926, 16.425089, 0.000000),App.Vector(31.994911, 16.425089, 0.000000)))
|
|
|
|
|
geoList.append(Part.LineSegment(App.Vector(31.994911, 16.425089, 0.000000),App.Vector(31.994911, 21.026653, 0.000000)))
|
|
|
|
|
geoList.append(Part.LineSegment(App.Vector(31.994911, 21.026653, 0.000000),App.Vector(30.009926, 21.026653, 0.000000)))
|
|
|
|
|
doc.Sketch.addGeometry(geoList,False)
|
|
|
|
|
geoList.append(
|
|
|
|
|
Part.LineSegment(App.Vector(30.009926, 21.026653, 0.000000),
|
|
|
|
|
App.Vector(30.009926, 16.425089, 0.000000)))
|
|
|
|
|
geoList.append(
|
|
|
|
|
Part.LineSegment(App.Vector(30.009926, 16.425089, 0.000000),
|
|
|
|
|
App.Vector(31.994911, 16.425089, 0.000000)))
|
|
|
|
|
geoList.append(
|
|
|
|
|
Part.LineSegment(App.Vector(31.994911, 16.425089, 0.000000),
|
|
|
|
|
App.Vector(31.994911, 21.026653, 0.000000)))
|
|
|
|
|
geoList.append(
|
|
|
|
|
Part.LineSegment(App.Vector(31.994911, 21.026653, 0.000000),
|
|
|
|
|
App.Vector(30.009926, 21.026653, 0.000000)))
|
|
|
|
|
doc.Sketch.addGeometry(geoList, False)
|
|
|
|
|
del geoList
|
|
|
|
|
|
|
|
|
|
constraintList = []
|
|
|
|
|
@@ -1193,12 +1230,12 @@ class TestTopologicalNamingProblem(unittest.TestCase):
|
|
|
|
|
# Assert
|
|
|
|
|
if self.Body.Shape.ElementMapVersion == "": # Should be '4' as of Mar 2023.
|
|
|
|
|
return
|
|
|
|
|
self.assertEqual(self.Body.Shape.BoundBox.XMin,0)
|
|
|
|
|
self.assertEqual(self.Body.Shape.BoundBox.YMin,0)
|
|
|
|
|
self.assertEqual(self.Body.Shape.BoundBox.ZMin,0)
|
|
|
|
|
self.assertEqual(self.Body.Shape.BoundBox.XMax,31.37)
|
|
|
|
|
self.assertEqual(self.Body.Shape.BoundBox.YMax,25.2)
|
|
|
|
|
self.assertEqual(self.Body.Shape.BoundBox.ZMax,20)
|
|
|
|
|
self.assertEqual(self.Body.Shape.BoundBox.XMin, 0)
|
|
|
|
|
self.assertEqual(self.Body.Shape.BoundBox.YMin, 0)
|
|
|
|
|
self.assertEqual(self.Body.Shape.BoundBox.ZMin, 0)
|
|
|
|
|
self.assertEqual(self.Body.Shape.BoundBox.XMax, 31.37)
|
|
|
|
|
self.assertEqual(self.Body.Shape.BoundBox.YMax, 25.2)
|
|
|
|
|
self.assertEqual(self.Body.Shape.BoundBox.ZMax, 20)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def create_t_sketch(self):
|
|
|
|
|
|