def setupCreateBoxEdit():
     PathLog.track(index, force)
     if force or not self.stockCreateBox:
         self.stockCreateBox = PathJobGui.StockCreateBoxEdit(
             self.obj, self.form, force
         )
     self.stockEdit = self.stockCreateBox
 def setupFromBaseEdit():
     PathLog.track(index, force)
     if force or not self.stockFromBase:
         self.stockFromBase = PathJobGui.StockFromBaseBoundBoxEdit(
             self.obj, self.form, force
         )
     self.stockEdit = self.stockFromBase
Exemple #3
0
 def setupFromExisting():
     PathLog.track(index, force)
     if force or not self.stockFromExisting:
         self.stockFromExisting = PathJobGui.StockFromExistingEdit(
             self.obj, self.form, force)
     if self.stockFromExisting.candidates(self.obj):
         self.stockEdit = self.stockFromExisting
         return True
     return False
Exemple #4
0
    def test003(self, close=True):
        """test003()... Verify 'No job object' exception thrown if Job object available."""
        from PathScripts.post import gcode_pre as gcode_pre

        doc = FreeCAD.newDocument("TestPathPost")

        # Add temporary receiving Job object
        box = FreeCAD.ActiveDocument.addObject("Part::Box", "Box")
        box.Label = "Temporary Box"
        # Add Job object with view provider support when possible
        if FreeCAD.GuiUp:
            import PathScripts.PathJobGui as PathJobGui

            box.ViewObject.Visibility = False
            job = PathJobGui.Create([box], openTaskPanel=False)
        else:
            import PathScripts.PathJob as PathJob

            job = PathJob.Create("Job", [box])

        importFile = FreeCAD.getHomePath(
        ) + "Mod/Path/PathTests/test_centroid_00.ngc"
        gcode_pre.insert(importFile, "test_centroid_00")

        # self.assertTrue(doc.Name == "test_centroid_00")

        opList = doc.Job.Operations.Group
        self.assertTrue(
            len(opList) == 2,
            "Expected 2 Custom operations to be created from source g-code file, test_centroid_00.ngc",
        )
        self.assertTrue(opList[0].Name == "Custom",
                        "Expected first operation to be Custom")
        self.assertTrue(opList[1].Name == "Custom001",
                        "Expected second operation to be Custom001")

        if close:
            FreeCAD.closeDocument(doc.Name)