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


Python PathUtils类代码示例

本文整理汇总了Python中PathUtils的典型用法代码示例。如果您正苦于以下问题:Python PathUtils类的具体用法?Python PathUtils怎么用?Python PathUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Create

    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,代码行数:9,代码来源:PathLoadTool.py

示例2: Create

    def Create():
        # FreeCADGui.addModule("PathScripts.PathLoadTool")
        # import Path
        import PathScripts
        import PathUtils

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

        PathUtils.addToProject(obj)
开发者ID:3DPrinterGuy,项目名称:FreeCAD,代码行数:11,代码来源:PathLoadTool.py

示例3: copyTools

    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,代码行数:49,代码来源:PathToolLibraryManager.py

示例4: onChanged

 def onChanged(self, obj, prop):
     if prop == "ToolNumber" and not 'Restore' in obj.State:
         job = PathUtils.findParentJob(obj)
         if job is not None:
             for g in job.Group:
                 if not(isinstance(g.Proxy, PathScripts.PathLoadTool.LoadTool)):
                     g.touch()
开发者ID:abdullahtahiriyo,项目名称:FreeCAD_sf_master,代码行数:7,代码来源:PathLoadTool.py

示例5: allow

 def allow(self, doc, obj, sub):
     PathLog.debug('obj: {} sub: {}'.format(obj, sub))
     if hasattr(obj, "Shape"):
         obj = obj.Shape
         subobj = obj.getElement(sub)
         return PathUtils.isDrillable(obj, subobj)
     else:
         return False
开发者ID:crobarcro,项目名称:FreeCAD,代码行数:8,代码来源:PathSelection.py

示例6: onChanged

 def onChanged(self, obj, prop):
     mode = 2
     obj.setEditorMode('Placement', mode)
     # if prop == "ToolNumber":
     proj = PathUtils.findProj()
     for g in proj.Group:
         if not(isinstance(g.Proxy, PathScripts.PathLoadTool.LoadTool)):
             g.touch()
开发者ID:3DPrinterGuy,项目名称:FreeCAD,代码行数:8,代码来源:PathLoadTool.py

示例7: onChanged

 def onChanged(self, obj, prop):
     mode = 2
     obj.setEditorMode('Placement', mode)
     # if prop == "ToolNumber":
     job = PathUtils.findParentJob(obj)
     if job is not None:
         for g in job.Group:
             if not(isinstance(g.Proxy, PathScripts.PathLoadTool.LoadTool)):
                 g.touch()
开发者ID:hemanshupa,项目名称:FreeCAD_sf_master,代码行数:9,代码来源:PathLoadTool.py

示例8: changeTool

    def changeTool(self):
        myJob = PathUtils.findParentJob(self.obj)
        newtool = self.form.cboToolSelect.currentText()

        tooltable = myJob.Tooltable
        for number, tool in tooltable.Tools.iteritems():
            if tool.Name == newtool:
                self.obj.ToolNumber = number
        self.setFields()
开发者ID:hemanshupa,项目名称:FreeCAD_sf_master,代码行数:9,代码来源:PathLoadTool.py

示例9: Create

    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,代码行数:21,代码来源:PathLoadTool.py

示例10: Activated

    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.addToProject(obj)
'''
        FreeCADGui.doCommand(snippet)
        FreeCAD.ActiveDocument.commitTransaction()
        FreeCAD.ActiveDocument.recompute()
开发者ID:3DPrinterGuy,项目名称:FreeCAD,代码行数:15,代码来源:PathLoadTool.py

示例11: execute

    def execute(self, obj):

        tool = PathUtils.getTool(obj, obj.ToolNumber)
        if tool is not None:
            obj.Label = obj.Name + ": " + tool.Name
        else:
            obj.Label = obj.Name + ": UNDEFINED TOOL"

        commands = ""
        commands += "(" + obj.Label + ")"+'\n'
        commands += 'M6T'+str(obj.ToolNumber)+'\n'

        if obj.SpindleDir == 'Forward':
            commands += 'M3S' + str(obj.SpindleSpeed) + '\n'

        else:
            commands += 'M4S' + str(obj.SpindleSpeed) + '\n'
开发者ID:hemanshupa,项目名称:FreeCAD_sf_master,代码行数:17,代码来源:PathLoadTool.py

示例12: onChanged

    def onChanged(self, obj, prop):
        PathLog.track('prop: {}  state: {}'.format(prop, obj.State))


        if 'Restore' not in obj.State:
            if prop == "ToolNumber":
                toolitem = obj.Tooltable.Tools.popitem()
                oldtoolnum = toolitem[0]
                tool = toolitem[1]
                obj.Tooltable.deleteTool(oldtoolnum)
                obj.Tooltable.setTool(obj.ToolNumber, tool)
            else:
                job = PathUtils.findParentJob(obj)
                if job is not None:
                    for g in job.Group:
                        if not(isinstance(g.Proxy, PathScripts.PathLoadTool.LoadTool)):
                            g.touch()
开发者ID:crobarcro,项目名称:FreeCAD,代码行数:17,代码来源:PathLoadTool.py

示例13: Activated

    def Activated(self):
        FreeCAD.ActiveDocument.openTransaction(translate("Current Tool","Tool Number to Load"))
        FreeCADGui.addModule("PathScripts.PathLoadTool")
        snippet = '''
import Path
import PathScripts
from PathScripts import PathProject, PathUtils
prjexists = False
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","Tool")
PathScripts.PathLoadTool.LoadTool(obj)

PathScripts.PathLoadTool._ViewProviderLoadTool(obj.ViewObject)

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

示例14: setFields

    def setFields(self):
        self.form.cboToolSelect.blockSignals(True)

        self.form.vertFeed.setText(str(self.obj.VertFeed.Value))
        self.form.horizFeed.setText(str(self.obj.HorizFeed.Value))
        self.form.vertRapid.setText(str(self.obj.VertRapid.Value))
        self.form.horizRapid.setText(str(self.obj.HorizRapid.Value))

        self.form.spindleSpeed.setValue(self.obj.SpindleSpeed)
        self.form.tcoName.setText(str(self.obj.Label))

        index = self.form.cboSpindleDirection.findText(self.obj.SpindleDir, QtCore.Qt.MatchFixedString)
        if index >= 0:
            self.form.cboSpindleDirection.setCurrentIndex(index)
        myJob = PathUtils.findParentJob(self.obj)

        #populate the toolselector and select correct tool
        self.form.cboToolSelect.clear()
        tooltable = myJob.Tooltable
        for number, tool in tooltable.Tools.iteritems():
            self.form.cboToolSelect.addItem(tool.Name)

        try:
            tool = myJob.Tooltable.Tools[self.obj.ToolNumber]
            self.form.txtToolType.setText(tool.ToolType)
            self.form.txtToolMaterial.setText(tool.Material)
            self.form.txtToolDiameter.setText(str(tool.Diameter))

            index = self.form.cboToolSelect.findText(tool.Name, QtCore.Qt.MatchFixedString)
            if index >= 0:
                self.form.cboToolSelect.setCurrentIndex(index)

        except:
            self.form.cboToolSelect.setCurrentIndex(-1)
            self.form.txtToolType.setText("UNDEFINED")
            self.form.txtToolMaterial.setText("UNDEFINED")
            self.form.txtToolDiameter.setText("UNDEFINED")
        self.form.cboToolSelect.blockSignals(False)

        radius = tool.Diameter / 2
        length = tool.CuttingEdgeHeight
        t = Part.makeCylinder(radius, length)
        self.toolrep.Shape = t
开发者ID:hemanshupa,项目名称:FreeCAD_sf_master,代码行数:43,代码来源:PathLoadTool.py

示例15: __init__

    def __init__(self, config=None):
        '''
        Constructor
        '''        
        self.restrictionEnzymeList = list()
        self.speciesList = list()
        resDir = os.path.join(PathUtils.getCwd(), "res")
        
        self.SPSUMHandler = KazusaSPSUMHandler(resDir)
        
        if config:
            self.loadConfig(config)
        
        self.possibleOptimizationStrategies = ["Fastest Codons", "Adapt Speed To Source", "Random Adapt To Target"]
        self.optimizer = None
        
#         self.speciesList.append(("1234", "Testus specius"))
        
        self.sourceSequence = ""
        self.optimizedSequence = ""
开发者ID:hoerldavid,项目名称:codonoptimizer,代码行数:20,代码来源:OptimizerApp.py


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