示例#1
0
 def test00(self):
     '''Check that isValidBaseObject detects solids.'''
     box = self.doc.addObject('Part::Box', 'Box')
     cylinder = self.doc.addObject('Part::Cylinder', 'Cylinder')
     self.doc.recompute()
     self.assertTrue(PathUtil.isValidBaseObject(box))
     self.assertTrue(PathUtil.isValidBaseObject(cylinder))
示例#2
0
 def test00(self):
     """Check that isValidBaseObject detects solids."""
     box = self.doc.addObject("Part::Box", "Box")
     cylinder = self.doc.addObject("Part::Cylinder", "Cylinder")
     self.doc.recompute()
     self.assertTrue(PathUtil.isValidBaseObject(box))
     self.assertTrue(PathUtil.isValidBaseObject(cylinder))
示例#3
0
 def test01(self):
     """Check that isValidBaseObject detects PDs."""
     body = self.doc.addObject("PartDesign::Body", "Body")
     box = self.doc.addObject("PartDesign::AdditiveBox", "Box")
     body.addObject(box)
     self.doc.recompute()
     self.assertTrue(PathUtil.isValidBaseObject(body))
示例#4
0
 def test03(self):
     '''Check that isValidBaseObject ignores sketches.'''
     body = self.doc.addObject('PartDesign::Body', 'Body')
     sketch = self.doc.addObject('Sketcher::SketchObject', 'Sketch')
     body.addObject(sketch)
     TestSketcherApp.CreateSlotPlateSet(sketch)
     self.doc.recompute()
     pad = self.doc.addObject('PartDesign::Pad', 'Pad')
     body.addObject(pad)
     pad.Profile = sketch
     self.doc.recompute()
     # the body and the pad are solids
     self.assertTrue(PathUtil.isValidBaseObject(pad))
     self.assertTrue(PathUtil.isValidBaseObject(body))
     # however, the sketch is no
     self.assertFalse(PathUtil.isValidBaseObject(sketch))
示例#5
0
 def test01(self):
     '''Check that isValidBaseObject detects PDs.'''
     body = self.doc.addObject('PartDesign::Body', 'Body')
     box  = self.doc.addObject('PartDesign::AdditiveBox', 'Box')
     body.addObject(box)
     self.doc.recompute()
     self.assertTrue(PathUtil.isValidBaseObject(body))
示例#6
0
    def test03(self):
        """Check that isValidBaseObject ignores sketches."""
        body = self.doc.addObject("PartDesign::Body", "Body")
        sketch = self.doc.addObject("Sketcher::SketchObject", "Sketch")
        body.addObject(sketch)
        TestSketcherApp.CreateSlotPlateSet(sketch)
        self.doc.recompute()
        pad = self.doc.addObject("PartDesign::Pad", "Pad")
        body.addObject(pad)
        pad.Profile = sketch
        self.doc.recompute()

        # the body is a solid
        self.assertTrue(PathUtil.isValidBaseObject(body))

        # the pad inside the body cannot be used due to the linking constraints
        self.assertFalse(PathUtil.isValidBaseObject(pad))

        # the sketch is no good neither
        self.assertFalse(PathUtil.isValidBaseObject(sketch))
示例#7
0
    def test03(self):
        '''Check that isValidBaseObject ignores sketches.'''
        body = self.doc.addObject('PartDesign::Body', 'Body')
        sketch = self.doc.addObject('Sketcher::SketchObject', 'Sketch')
        body.addObject(sketch)
        TestSketcherApp.CreateSlotPlateSet(sketch)
        self.doc.recompute()
        pad = self.doc.addObject('PartDesign::Pad', 'Pad')
        body.addObject(pad)
        pad.Profile = sketch
        self.doc.recompute()

        # the body is a solid
        self.assertTrue(PathUtil.isValidBaseObject(body))

        # the pad inside the body cannot be used due to the linking constraints
        self.assertFalse(PathUtil.isValidBaseObject(pad))

        # the sketch is no good neither
        self.assertFalse(PathUtil.isValidBaseObject(sketch))
示例#8
0
    def test04(self):
        '''Check that Part is handled correctly.'''
        part = self.doc.addObject('App::Part', 'Part')

        # an empty part is not a valid base object
        self.assertFalse(PathUtil.isValidBaseObject(part))

        # a none empty part where none of the objects has a shape is no good neither
        fp = self.doc.addObject('App::FeaturePython', 'Feature')
        part.addObject(fp)
        self.assertFalse(PathUtil.isValidBaseObject(part))

        # create an valid base object
        box = self.doc.addObject("Part::Box", "Box")
        self.assertTrue(PathUtil.isValidBaseObject(box))

        # a part with at least one valid object is valid
        part.addObject(box)
        self.assertTrue(PathUtil.isValidBaseObject(part))

        # however, the object itself is no longer valid
        self.assertFalse(PathUtil.isValidBaseObject(box))
示例#9
0
    def test04(self):
        '''Check that Part is handled correctly.'''
        part = self.doc.addObject('App::Part', 'Part')

        # an empty part is not a valid base object
        self.assertFalse(PathUtil.isValidBaseObject(part))

        # a none empty part where none of the objects has a shape is no good neither
        fp = self.doc.addObject('App::FeaturePython', 'Feature')
        part.addObject(fp)
        self.assertFalse(PathUtil.isValidBaseObject(part))

        # create an valid base object
        box = self.doc.addObject("Part::Box","Box")
        self.assertTrue(PathUtil.isValidBaseObject(box))

        # a part with at least one valid object is valid
        part.addObject(box)
        self.assertTrue(PathUtil.isValidBaseObject(part))

        # however, the object itself is no longer valid
        self.assertFalse(PathUtil.isValidBaseObject(box))
示例#10
0
    def test04(self):
        """Check that Part is handled correctly."""
        part = self.doc.addObject("App::Part", "Part")

        # an empty part is not a valid base object
        self.assertFalse(PathUtil.isValidBaseObject(part))

        # a non-empty part where none of the objects have a shape, is no good either
        fp = self.doc.addObject("App::FeaturePython", "Feature")
        part.addObject(fp)
        self.assertFalse(PathUtil.isValidBaseObject(part))

        # create a valid base object
        box = self.doc.addObject("Part::Box", "Box")
        self.doc.recompute()
        self.assertTrue(PathUtil.isValidBaseObject(box))

        # a part with at least one valid object is valid
        part.addObject(box)
        self.assertTrue(PathUtil.isValidBaseObject(part))

        # however, the object itself is no longer valid
        self.assertFalse(PathUtil.isValidBaseObject(box))
示例#11
0
 def test02(self):
     '''Check that isValidBaseObject detects compounds.'''
     box = self.doc.addObject('Part::Box', 'Box')
     box.Length = 10
     box.Width = 10
     box.Height = 1
     box.Placement = FreeCAD.Placement(FreeCAD.Vector(-5,-5,0), FreeCAD.Rotation(FreeCAD.Vector(0,0,1), 0))
     cyl = self.doc.addObject('Part::Cylinder', 'Cylinder')
     cyl.Radius = 1
     cyl.Height = 10
     box.Placement = FreeCAD.Placement(FreeCAD.Vector(0,0,-5), FreeCAD.Rotation(FreeCAD.Vector(0,0,1), 0))
     cut = self.doc.addObject('Part::Cut', 'Cut')
     cut.Base = box
     cut.Tool = cyl
     self.doc.recompute()
     self.assertTrue(PathUtil.isValidBaseObject(cut))
示例#12
0
 def isBaseCandidate(cls, obj):
     """Answer true if the given object can be used as a Base for a job."""
     return PathUtil.isValidBaseObject(obj)
示例#13
0
 def isBaseCandidate(cls, obj):
     '''Answer true if the given object can be used as a Base for a job.'''
     return PathUtil.isValidBaseObject(obj) or isArchPanelSheet(obj)
示例#14
0
 def isBaseCandidate(cls, obj):
     '''Answer true if the given object can be used as a Base for a job.'''
     return PathUtil.isValidBaseObject(obj) or isArchPanelSheet(obj)
示例#15
0
 def isBaseCandidate(cls, obj):
     '''Answer true if the given object can be used as a Base for a job.'''
     return PathUtil.isValidBaseObject(obj) or (hasattr(
         obj, 'Proxy') and isinstance(obj.Proxy, ArchPanel.PanelSheet))
示例#16
0
文件: PathJob.py 项目: itain/FreeCAD
 def isBaseCandidate(cls, obj):
     '''Answer true if the given object can be used as a Base for a job.'''
     return PathUtil.isValidBaseObject(obj) or (hasattr(obj, 'Proxy') and isinstance(obj.Proxy, ArchPanel.PanelSheet))