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


Python OpenSCADUtils.meshoptempfile方法代码示例

本文整理汇总了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]))
开发者ID:worldmaker18349276,项目名称:magicpy,代码行数:50,代码来源:Operation.py


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