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


Python PathUtil.isSolid方法代码示例

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


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

示例1: candidates

# 需要导入模块: from PathScripts import PathUtil [as 别名]
# 或者: from PathScripts.PathUtil import isSolid [as 别名]
 def candidates(self, obj):
     solids = [o for o in obj.Document.Objects if PathUtil.isSolid(o)]
     if obj.Base in solids and PathJob.isResourceClone(obj, 'Base'):
         solids.remove(obj.Base)
     if obj.Stock in solids:
         # regardless, what stock is/was, it's not a valid choice
         solids.remove(obj.Stock)
     return sorted(solids, key=lambda c: c.Label)
开发者ID:pgilfernandez,项目名称:FreeCAD,代码行数:10,代码来源:PathJobGui.py

示例2: setupModel

# 需要导入模块: from PathScripts import PathUtil [as 别名]
# 或者: from PathScripts.PathUtil import isSolid [as 别名]
    def setupModel(self, job = None):
        if job:
            sel = [PathUtil.getPublicObject(job.Proxy.baseObject(job, obj)) for obj in job.Model.Group]
            xxx = job.Model.Group + [job.Stock]
        else:
            sel = FreeCADGui.Selection.getSelection()
            xxx = []

        if sel:
            selected = [s.Label for s in sel]
        else:
            selected = []

        PathLog.track('selected', selected)

        expandSolids = False
        expandTwoDs  = False
        expandJobs   = False
        index = 0
        candidates = sorted(PathJob.ObjectJob.baseCandidates(), key=lambda o: o.Label)
        for base in candidates:
            PathLog.track(base.Label)
            if not base in xxx and not PathJob.isResourceClone(job, base, None) and not hasattr(base, 'StockType'):
                PathLog.track('base', base.Label)
                item = QtGui.QTreeWidgetItem([base.Label])
                item.setData(0, self.DataObject, base)
                sel = base.Label in selected
                if sel or (1 == len(candidates) and not selected):
                    item.setCheckState(0, QtCore.Qt.CheckState.Checked)
                else:
                    item.setCheckState(0, QtCore.Qt.CheckState.Unchecked)
                if PathUtil.isSolid(base):
                    self.itemsSolid.addChild(item)
                    if sel:
                        expandSolids = True
                else:
                    self.itemsTwoD.addChild(item)
                    if sel:
                        expandTwoDs = True

        for j in sorted(PathJob.Instances(), key=lambda x: x.Label):
            if j != job:
                item = QtGui.QTreeWidgetItem([j.Label])
                item.setData(0, self.DataObject, j)
                if j.Label in selected:
                    expandJobs = True
                    item.setCheckState(0, QtCore.Qt.CheckState.Checked)
                else:
                    item.setCheckState(0, QtCore.Qt.CheckState.Unchecked)
                self.itemsJob.addChild(item)

        if self.itemsSolid.childCount() > 0:
            self.dialog.modelTree.addTopLevelItem(self.itemsSolid)
            if expandSolids or not (expandTwoDs or expandJobs):
                PathLog.track()
                self.itemsSolid.setExpanded(True)
                expandSolids = True
        if self.itemsTwoD.childCount() > 0:
            self.dialog.modelTree.addTopLevelItem(self.itemsTwoD)
            if expandTwoDs:
                self.itemsTwoD.setExpanded(True)
        if self.itemsJob.childCount() > 0:
            self.dialog.modelTree.addTopLevelItem(self.itemsJob)
            if expandJobs:
                self.itemsJob.setExpanded(True)
        self.dialog.modelGroup.show()
开发者ID:DevJohan,项目名称:FreeCAD_sf_master,代码行数:68,代码来源:PathJobDlg.py


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