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


Python Component.part方法代码示例

本文整理汇总了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
开发者ID:valkyriesavage,项目名称:makers-marks,代码行数:40,代码来源:openscad.py


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