本文整理汇总了Python中OpenSCADUtils.meshoptempfile方法的典型用法代码示例。如果您正苦于以下问题:Python OpenSCADUtils.meshoptempfile方法的具体用法?Python OpenSCADUtils.meshoptempfile怎么用?Python OpenSCADUtils.meshoptempfile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSCADUtils
的用法示例。
在下文中一共展示了OpenSCADUtils.meshoptempfile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fuse
# 需要导入模块: import OpenSCADUtils [as 别名]
# 或者: from OpenSCADUtils import meshoptempfile [as 别名]
def fuse(meshes):
meshes1 = []
meshes2 = []
for mesh in meshes:
o = orientation(mesh)
if o == "Forward":
meshes1.append(mesh)
elif o == "Reversed":
meshes2.append(complement(mesh))
else:
raise TypeError
# # broken
# mesh1 = None
# if len(meshes1) > 0:
# mesh1 = reduce(Mesh.Mesh.unite, meshes1)
# mesh2 = None
# if len(meshes2) > 0:
# mesh2 = reduce(Mesh.Mesh.intersect, meshes2)
# if mesh1 is None and mesh2 is None:
# return None
# elif mesh1 is None:
# return complement(mesh2)
# elif mesh2 is None:
# return mesh1
# else:
# return complement(mesh2.difference(mesh1))
mesh1 = None
if len(meshes1) > 1:
mesh1 = OpenSCADUtils.meshoptempfile('union', meshes1)
elif len(meshes1) == 1:
mesh1 = meshes1[0]
mesh2 = None
if len(meshes2) > 1:
mesh2 = OpenSCADUtils.meshoptempfile('intersection', meshes2)
elif len(meshes2) == 1:
mesh2 = meshes2[0]
if mesh1 is None and mesh2 is None:
return None
elif mesh1 is None:
return complement(mesh2)
elif mesh2 is None:
return mesh1
else:
return complement(OpenSCADUtils.meshoptempfile('difference', [mesh2, mesh1]))