示例#1
0
    from compas_plotters import MeshPlotter

    mesh = Mesh.from_obj(compas.get('hypar.obj'))
    target = mesh.copy()

    points = mesh.vertices_attributes('xyz')
    points[:] = [[x, y, 0] for x, y, z in points]

    mesh_quads_to_triangles(target)

    pulled = trimesh_pull_points_numpy(target, points)

    plotter = MeshPlotter(mesh, figsize=(8, 5))
    plotter.defaults['vertex.fontsize'] = 6
    plotter.draw_vertices(text={
        key: "{:.1f}".format(attr['z'])
        for key, attr in mesh.vertices(True)
    },
                          radius=0.08)
    plotter.draw_faces()
    plotter.draw_points([{
        'pos': [x, y, z],
        'text': "{:.1f}".format(z),
        'radius': 0.08,
        'facecolor': '#00ff00',
        'fontsize': 6
    } for x, y, z in pulled])

    plotter.show()
示例#2
0
bbox = oriented_bounding_box_xy_numpy(mesh.get_vertices_attributes('xyz'))
points = []
lines = []
for index, (x, y) in enumerate(bbox[0]):
    point = Point(x, y, 0)
    points.append({
        'pos': point,
        'radius': 0.01,
    })
for u, v in pairwise(bbox[0] + bbox[0][:1]):
    lines.append({'start': u, 'end': v, 'width': 0.1})

plotter.mesh = mesh
plotter.draw_vertices(keys=mesh.attributes['corners'], radius=0.05, text='key')
plotter.draw_faces()
plotter.draw_points(points)
plotter.draw_lines(lines)

coldjoint = list(mesh.edges_where({'flap': 'coldjoint'}))
boundary = list(mesh.edges_where({'flap': 'boundary'}))
edges = coldjoint + boundary

plotter.draw_edges(keys=edges, color={key: '#ff0000' for key in boundary})

plotter.show()

# ==============================================================================
# Export
# ==============================================================================

for mesh in unrolled_SOUTH: