def triangulate_strips(zone):
    meshes = []
    for faces in zone:
        mesh = Mesh()
        mesh.update_default_vertex_attributes(FABRIC.default_vertex_attributes)
        mesh.update_default_edge_attributes(FABRIC.default_edge_attributes)
        mesh.update_default_face_attributes(FABRIC.default_face_attributes)

        for fkey in faces:
            keys = FABRIC.face_vertices(fkey)
            for key in keys:
                if key not in mesh.vertex:
                    attr = FABRIC.vertex[key].copy()
                    mesh.add_vertex(key=key, attr_dict=attr)
            attr = FABRIC.facedata[fkey].copy()
            mesh.add_face(keys, fkey=fkey, attr_dict=attr)

        for u, v, attr in mesh.edges(True):
            for name in attr:
                value = FABRIC.get_edge_attribute((u, v), name)
                attr[name] = value

        trimesh = mesh.copy()
        mesh_quads_to_triangles(trimesh, check_angles=True)
        meshes.append([mesh, trimesh])

    return meshes
Example #2
0
mesh = sd.mesh_subdivide_quad(mesh)

fkeys = list(mesh.faces())

for fk in fkeys:

    new_keys = msd.segment_face(mesh, fk, num=2, start_index=0)

    for key in new_keys:
        mesh.face_attribute(key, "ftype", "plot")

# artist = MeshArtist(mesh, layer="level1")
# artist.clear_layer()
# artist.draw_faces( join_faces=True)

m1 = mesh.copy()
subdivide_by_ftype(m1)
# artist2 = MeshArtist(m1, layer="level2")
# artist2.clear_layer()

m1fkeys = list(m1.faces())

#circulation = [key for key in m1fkeys if m1.face_attribute(key, 'ftype')== "circulation"]
#construction = [key for key in m1fkeys if m1.face_attribute(key, 'ftype')== "construction"]

# artist2.draw_faces( circulation, color= (255,0,0), join_faces=True)
# artist2.draw_faces( construction, color= (0,0,255), join_faces=True)

m2 = m1.copy()
subdivide_by_ftype(m2)
# artist3 = MeshArtist(m2, layer="level3")