本文整理汇总了Python中component.Component.part方法的典型用法代码示例。如果您正苦于以下问题:Python Component.part方法的具体用法?Python Component.part怎么用?Python Component.part使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类component.Component
的用法示例。
在下文中一共展示了Component.part方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: calcBosses
# 需要导入模块: from component import Component [as 别名]
# 或者: from component.Component import part [as 别名]
def calcBosses(components):
'''
To generate bosses, we create a uniform field of bosses, then remove any that
intersect with our components' bounding boxes. Finally, we'll prune to just
the bosses that actually touch our object.
'''
# some things that will be important:
boss_rotations = []
boss_base = []
for component in components:
if Component.part(component['type']):
boss_rotations = list(component['rotations'])
boss_base = list(component['coords'])
break
if len(boss_rotations) == 0:
# no parting line => no bosses
return stl
# first order of business, which bosses are good?
good_bosses = []
grid_spacing = 30
min_coords = -150
max_coords = -min_coords
field_x = range(min_coords,max_coords,grid_spacing)
field_z = range(min_coords,max_coords,grid_spacing)
for x in field_x:
for z in field_z:
potential_boss = {
'type':Component.boss,
'coords':boss_base,
'axis':0,
'rotations':boss_rotations,
'offset':[x,0,z],
}
writeOpenSCAD(BOSS_CHECK_COMPS_SCRIPT, components, boss=potential_boss)
empty = createsEmptySTL(BOSS_CHECK_COMPS_SCRIPT, SCRATCH)
if empty:
good_bosses.append(potential_boss)
return good_bosses