예제 #1
0
def Create(name='TC: Default Tool',
           tool=None,
           toolNumber=1,
           assignViewProvider=True,
           assignTool=True):
    legacyTool = PathPreferences.toolsUseLegacyTools(
    ) if tool is None else isinstance(tool, Path.Tool)

    PathLog.track(tool, toolNumber, legacyTool)

    obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
    obj.Label = name
    obj.Proxy = ToolController(obj, legacyTool, assignTool)

    if FreeCAD.GuiUp and assignViewProvider:
        ViewProvider(obj.ViewObject)

    if assignTool:
        if not tool:
            if legacyTool:
                tool = Path.Tool()
                tool.Diameter = 5.0
                tool.Name = "Default Tool"
                tool.CuttingEdgeHeight = 15.0
                tool.ToolType = "EndMill"
                tool.Material = "HighSpeedSteel"
            else:
                tool = PathToolBit.Factory.Create()
                if tool.ViewObject:
                    tool.ViewObject.Visibility = False
        obj.Tool = tool
    obj.ToolNumber = toolNumber
    return obj
예제 #2
0
def FromTemplate(template, assignViewProvider=True):
    PathLog.track()

    name = template.get(ToolControllerTemplate.Name,
                        ToolControllerTemplate.Label)
    obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
    tc = ToolController(obj)
    if FreeCAD.GuiUp and assignViewProvider:
        ViewProvider(obj.ViewObject)

    tc.setFromTemplate(obj, template)

    return obj
예제 #3
0
def Create(name='Default Tool',
           tool=None,
           toolNumber=1,
           assignViewProvider=True):
    PathLog.track(tool, toolNumber)

    obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
    obj.Label = name

    ToolController(obj)
    if FreeCAD.GuiUp and assignViewProvider:
        ViewProvider(obj.ViewObject)

    if tool is None:
        tool = Path.Tool()
        tool.Diameter = 5.0
        tool.Name = "Default Tool"
        tool.CuttingEdgeHeight = 15.0
        tool.ToolType = "EndMill"
        tool.Material = "HighSpeedSteel"
    obj.Tool = tool
    obj.ToolNumber = toolNumber
    return obj