本文整理汇总了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)
示例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()