Beispiel #1
0
    return f, g


# ==============================================================================
# Debugging
# ==============================================================================

if __name__ == "__main__":

    import compas
    from compas.datastructures.mesh.mesh import Mesh
    from compas.visualization.plotters.meshplotter import MeshPlotter

    data = compas.get_data('faces.obj')
    mesh = Mesh.from_obj(data)

    mesh_split_edge(mesh, 17, 32)

    print(mesh.face_vertices(11, ordered=True))
    print(mesh.face_vertices(16, ordered=True))

    print(mesh.halfedge[32][36])
    print(mesh.halfedge[36][32])

    print(mesh.halfedge[36][17])
    print(mesh.halfedge[17][36])

    plotter = MeshPlotter(mesh)

    plotter.draw_vertices()
Beispiel #2
0
        faces.append(face)
    mesh = Mesh.from_vertices_and_faces(vertices, faces)
    return mesh


def ansys_remesh(mesh, output_path, filename, size=None):
    s = Structure()
    s.add_nodes_elements_from_mesh(mesh, 'ShellElement')
    s = areas_from_mesh(s, mesh)
    write_preprocess(output_path, filename)
    write_request_mesh_areas(s,
                             output_path,
                             filename,
                             size=size,
                             smart_size=None,
                             div=None)
    ansys_launch_process(s, output_path, filename)
    mesh = mesh_from_ansys_results(output_path)
    return mesh


if __name__ == '__main__':

    name = 'remesh.txt'
    path = '//Mac/Home/Desktop/ok/'

    mesh = Mesh.from_obj(compas.get_data('faces.obj'))
    mesh = Mesh.from_data(mesh.to_data())
    mesh = ansys_remesh(mesh, path, name, 0.5)
    mesh.plot()