當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。