当前位置: 首页>>代码示例>>Python>>正文


Python PathUtils.addToJob方法代码示例

本文整理汇总了Python中PathUtils.addToJob方法的典型用法代码示例。如果您正苦于以下问题:Python PathUtils.addToJob方法的具体用法?Python PathUtils.addToJob怎么用?Python PathUtils.addToJob使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PathUtils的用法示例。


在下文中一共展示了PathUtils.addToJob方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Create

# 需要导入模块: import PathUtils [as 别名]
# 或者: from PathUtils import addToJob [as 别名]
    def Create(jobname = None):
        import PathScripts
        import PathUtils

        obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", "TC")
        PathScripts.PathLoadTool.LoadTool(obj)
        PathScripts.PathLoadTool._ViewProviderLoadTool(obj.ViewObject)

        PathUtils.addToJob(obj, jobname)
开发者ID:hemanshupa,项目名称:FreeCAD_sf_master,代码行数:11,代码来源:PathLoadTool.py

示例2: copyTools

# 需要导入模块: import PathUtils [as 别名]
# 或者: from PathUtils import addToJob [as 别名]
    def copyTools(self):
        tools = []
        model = self.form.ToolsList.model()
        for i in range(model.rowCount()):
            item = model.item(i, 0)
            if item.checkState():
                item = model.index(i, 1)
                tools.append(item.data())
        if len(tools) == 0:
            return

        targets = self.TLM.getLists()
        currList = "<Main>"

        for target in targets:
            if target == currList:
                targets.remove(target)

        if len(targets) == 0:
            FreeCAD.Console.PrintWarning("no place to go")
            return
        elif len(targets) == 1:
            targetlist = targets[0]
        else:
            form = FreeCADGui.PySideUic.loadUi(":/panels/DlgToolCopy.ui")
            form.cboTarget.addItems(targets)
            r = form.exec_()
            if r is False:
                return None
            else:
                targetlist = form.cboTarget.currentText()

        for toolnum in tools:
            tool = self.TLM.getTool(currList, int(toolnum))
            PathLog.debug('tool: {}, toolnum: {}'.format(tool, toolnum))
            for i in FreeCAD.ActiveDocument.findObjects("Path::Feature"):
                if isinstance(i.Proxy, PathScripts.PathJob.ObjectPathJob) and i.Label == targetlist:

                    label = "T{}: {}".format(toolnum, tool.Name)
                    obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython",label)
                    PathScripts.PathLoadTool.LoadTool(obj)
                    PathScripts.PathLoadTool._ViewProviderLoadTool(obj.ViewObject)
                    PathUtils.addToJob(obj, targetlist)
                    FreeCAD.activeDocument().recompute()
                    newtool = tool.copy()
                    obj.Tooltable.setTool(int(toolnum), newtool)
                    obj.ToolNumber = int(toolnum)
                    #obj.recompute()
        FreeCAD.ActiveDocument.recompute()
开发者ID:crobarcro,项目名称:FreeCAD,代码行数:51,代码来源:PathToolLibraryManager.py

示例3: Create

# 需要导入模块: import PathUtils [as 别名]
# 或者: from PathUtils import addToJob [as 别名]
    def Create(jobname=None, assignViewProvider=True, tool=None, toolNumber=1):
        PathLog.track("tool: {} with toolNumber: {}".format(tool, toolNumber))

        import PathScripts
        import PathUtils

        obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", "Default Tool")
        PathScripts.PathLoadTool.LoadTool(obj)
        if assignViewProvider:
            PathScripts.PathLoadTool._ViewProviderLoadTool(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.Tooltable.setTool(toolNumber, tool)
        obj.ToolNumber = toolNumber
        PathUtils.addToJob(obj, jobname)
开发者ID:crobarcro,项目名称:FreeCAD,代码行数:23,代码来源:PathLoadTool.py

示例4: Activated

# 需要导入模块: import PathUtils [as 别名]
# 或者: from PathUtils import addToJob [as 别名]
    def Activated(self):
        FreeCAD.ActiveDocument.openTransaction(translate("Path_LoadTool", "Create Tool Controller Object"))
        snippet = '''
import Path, PathScripts
from PathScripts import PathUtils, PathLoadTool

obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","TC")
PathScripts.PathLoadTool.LoadTool(obj)
PathScripts.PathLoadTool._ViewProviderLoadTool(obj.ViewObject)

PathUtils.addToJob(obj)
'''
        FreeCADGui.doCommand(snippet)
        FreeCAD.ActiveDocument.commitTransaction()
        FreeCAD.ActiveDocument.recompute()
开发者ID:hemanshupa,项目名称:FreeCAD_sf_master,代码行数:17,代码来源:PathLoadTool.py


注:本文中的PathUtils.addToJob方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。