Ejemplo n.º 1
0
 def __init__(self):
     import PathScripts.PathSelection as PST
     PST.surfaceselect()
Ejemplo n.º 2
0
 def __init__(self):
     import PathScripts.PathSelection as PST
     PST.profileselect()
Ejemplo n.º 3
0
 def preCleanup(self):
     for page in self.featurePages:
         page.onDirtyChanged(None)
     PathSelection.clear()
     FreeCADGui.Selection.removeObserver(self)
     self.obj.ViewObject.Proxy.clearTaskPanel()
Ejemplo n.º 4
0
 def __init__(self):
     import PathScripts.PathSelection as PST
     PST.profileselect()
Ejemplo n.º 5
0
 def __init__(self):
     import PathScripts.PathSelection as PST
     PST.pocketselect()
Ejemplo n.º 6
0
 def __init__(self):
     import PathScripts.PathSelection as PST
     PST.engraveselect()
Ejemplo n.º 7
0
 def __del__(self):
     PathSelection.clear()
Ejemplo n.º 8
0
 def preCleanup(self):
     for page in self.featurePages:
         page.onDirtyChanged(None)
     PathSelection.clear()
     FreeCADGui.Selection.removeObserver(self)
     self.obj.ViewObject.Proxy.clearTaskPanel()
Ejemplo n.º 9
0
 def __init__(self):
     import PathScripts.PathSelection as PST
     PST.contourselect()
Ejemplo n.º 10
0
 def __init__(self):
     import PathScripts.PathSelection as PST
     PST.drillselect()
Ejemplo n.º 11
0
 def __del__(self):
     PathSelection.clear()
Ejemplo n.º 12
0
    def Activated(self):
        import Path
        from PathScripts import PathUtils, PathProfile, PathProject
        prjexists = False
        selection = PathSelection.multiSelect()

        if not selection:
            return

        # if everything is ok, execute and register the transaction in the undo/redo stack
        FreeCAD.ActiveDocument.openTransaction(
            translate("PathProfile", "Create Profile"))
        FreeCADGui.addModule("PathScripts.PathProfile")

        obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython",
                                               "Profile")
        PathProfile.ObjectProfile(obj)
        PathProfile.ViewProviderProfile(obj.ViewObject)

        obj.Base = (FreeCAD.ActiveDocument.getObject(selection['objname']))

        if selection['facenames']:
            #FreeCAD.Console.PrintMessage('There are edges selected\n')
            obj.Face1 = (FreeCAD.ActiveDocument.getObject(
                selection['objname']), selection['facenames'][0])
            if len(selection['facenames']) > 1:
                obj.Face2 = (FreeCAD.ActiveDocument.getObject(
                    selection['objname']), selection['facenames'][-1])

        if selection['edgenames']:
            #FreeCAD.Console.PrintMessage('There are edges selected\n')

            obj.Edge1 = (FreeCAD.ActiveDocument.getObject(
                selection['objname']), (selection['edgenames'][0]))
            if len(selection['edgenames']) > 1:
                obj.Edge2 = (FreeCAD.ActiveDocument.getObject(
                    selection['objname']), (selection['edgenames'][-1]))

        if selection['pointlist']:
            FreeCADGui.doCommand('from FreeCAD import Vector')
            stptX, stptY, stptZ = selection['pointlist'][0].X, selection[
                'pointlist'][0].Y, selection['pointlist'][0].Z
            obj.StartPoint = Vector((stptX), (stptY), (stptZ))
            if len(
                    selection['pointlist']
            ) > 1:  # we have more than one point so we have an end point
                endptX, endptY, endptZ = selection['pointlist'][
                    -1].X, selection['pointlist'][-1].Y, selection[
                        'pointlist'][-1].Z
                obj.EndPoint = Vector(endptX, endptY, endptZ)
        if selection['pathwire'].isClosed():
            obj.PathClosed = True
            if selection['clockwise']:
                obj.Side = "Left"
                obj.Direction = "CW"
            elif selection['clockwise'] == False:
                obj.Side = "Right"
                obj.Direction = "CCW"
        else:
            obj.Side = "On"
            obj.Direction = "CCW"
            obj.PathClosed = False

        ZMax = obj.Base[0].Shape.BoundBox.ZMax
        ZMin = obj.Base[0].Shape.BoundBox.ZMin
        obj.StepDown.Value = 1.0
        obj.StartDepth.Value = ZMax - obj.StepDown.Value
        obj.FinalDepth.Value = ZMin - 1.0
        obj.ClearanceHeight.Value = ZMax + 5.0
        obj.SegLen.Value = 0.5
        obj.Active = True
        obj.ViewObject.ShowFirstRapid = False

        project = PathUtils.addToProject(obj)

        tl = PathUtils.changeTool(obj, project)
        if tl:
            obj.ToolNumber = tl

        FreeCAD.ActiveDocument.commitTransaction()
        FreeCAD.ActiveDocument.recompute()
Ejemplo n.º 13
0
 def __init__(self):
     import PathScripts.PathSelection as PST
     PST.engraveselect()
Ejemplo n.º 14
0
 def __init__(self):
     import PathScripts.PathSelection as PST
     PST.drillselect()
Ejemplo n.º 15
0
 def __init__(self):
     import PathScripts.PathSelection as PST
     PST.pocketselect()
Ejemplo n.º 16
0
 def __del__(self):
     import PathScripts.PathSelection as PST
     PST.clear()
Ejemplo n.º 17
0
 def __init__(self):
     import PathScripts.PathSelection as PST
     PST.contourselect()
Ejemplo n.º 18
0
 def getSelectionFactory(self):
     '''getSelectionFactory() ... return a factory function that can be used to create the selection observer.'''
     return PathSelection.select(self.OpName)
Ejemplo n.º 19
0
 def getSelectionFactory(self):
     '''getSelectionFactory() ... return a factory function that can be used to create the selection observer.'''
     return PathSelection.select(self.OpName)
Ejemplo n.º 20
0
 def __del__(self):
     import PathScripts.PathSelection as PST
     PST.clear()
Ejemplo n.º 21
0
    def Activated(self):
        import Path
        from PathScripts import PathUtils,PathProfile,PathProject
        prjexists = False
        selection = PathSelection.multiSelect()

        if not selection:
            return

        # if everything is ok, execute and register the transaction in the undo/redo stack
        FreeCAD.ActiveDocument.openTransaction(translate("Path_Profile","Create Profile"))
        FreeCADGui.addModule("PathScripts.PathProfile")

        obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","Profile")
        PathProfile.ObjectProfile(obj)
        PathProfile.ViewProviderProfile(obj.ViewObject)

        obj.Base = (FreeCAD.ActiveDocument.getObject(selection['objname']))

        if selection['facenames']:
            #FreeCAD.Console.PrintMessage('There are edges selected\n')
            obj.Face1 = (FreeCAD.ActiveDocument.getObject(selection['objname']),selection['facenames'][0])
            if len(selection['facenames'])>1:
                obj.Face2 = (FreeCAD.ActiveDocument.getObject(selection['objname']),selection['facenames'][-1])

        if selection['edgenames']:
            #FreeCAD.Console.PrintMessage('There are edges selected\n')
            
            obj.Edge1 =(FreeCAD.ActiveDocument.getObject(selection['objname']),(selection['edgenames'][0]))
            if len(selection['edgenames'])>1:
                obj.Edge2 =(FreeCAD.ActiveDocument.getObject(selection['objname']),(selection['edgenames'][-1]))

        if selection['pointlist']:
            FreeCADGui.doCommand('from FreeCAD import Vector')
            stptX, stptY, stptZ = selection['pointlist'][0].X, selection['pointlist'][0].Y, selection['pointlist'][0].Z
            obj.StartPoint = Vector((stptX),(stptY),(stptZ))
            if len(selection['pointlist'])>1: # we have more than one point so we have an end point
                endptX, endptY, endptZ = selection['pointlist'][-1].X, selection['pointlist'][-1].Y, selection['pointlist'][-1].Z
                obj.EndPoint = Vector(endptX,endptY,endptZ)
        if selection['pathwire'].isClosed():
            obj.PathClosed = True
            if selection['clockwise']:
                obj.Side = "Left"
                obj.Direction = "CW"
            elif selection['clockwise'] == False: 
                obj.Side = "Right"
                obj.Direction = "CCW"
        else:
            obj.Side = "On"
            obj.Direction = "CCW"
            obj.PathClosed = False

        ZMax = obj.Base[0].Shape.BoundBox.ZMax
        ZMin = obj.Base[0].Shape.BoundBox.ZMin
        obj.StepDown.Value = 1.0
        obj.StartDepth.Value = ZMax- obj.StepDown.Value
        obj.FinalDepth.Value = ZMin-1.0
        obj.ClearanceHeight.Value =  ZMax + 5.0
        obj.SegLen.Value = 0.5
        obj.Active = True
        obj.ViewObject.ShowFirstRapid = False

        project = PathUtils.addToProject(obj)

        tl = PathUtils.changeTool(obj,project)
        if tl:
            obj.ToolNumber = tl

        FreeCAD.ActiveDocument.commitTransaction()
        FreeCAD.ActiveDocument.recompute()