Пример #1
0
#     path = os.path.join(DATA, 'FABRIC', 'unrolled', SIDE, "{}.json".format(mesh.attributes['name']))
#     mesh.to_json(path)

# for mesh in NW_unrolled:
#     path = os.path.join(DATA, 'FABRIC', 'unrolled', SIDE, "{}.json".format(mesh.attributes['name']))
#     mesh.to_json(path)

# ==============================================================================
# Visualize
# ==============================================================================

ARTIST = ShellArtist(None)

for mesh in SOUTH_unrolled:
    points = [
        mesh.vertex_coordinates(key)
        for key in mesh.vertices_on_boundary(ordered=True)
    ]
    polygon = offset_polygon(points, SEEM)
    polygons = [{'points': polygon + polygon[:1]}]

    ARTIST.mesh = mesh
    ARTIST.layer = "Unrolled::{}::{}".format(SIDE, mesh.attributes['name'])
    ARTIST.clear_layer()
    ARTIST.draw_faces()
    ARTIST.draw_facelabels(text={
        key: "{}".format(attr['count'])
        for key, attr in mesh.faces(True)
    })
    ARTIST.draw_polygons(polygons)
Пример #2
0
for key in shell.vertices():
    normal = shell.vertex_normal(key)
    xyz = shell.vertex_coordinates(key)

    up = scale_vector(normal, 0.5 * thickness)
    down = scale_vector(normal, -0.5 * thickness)

    xyz_up = add_vectors(xyz, up)
    xyz_down = add_vectors(xyz, down)

    edos.set_vertex_attributes(key, 'xyz', xyz_up)
    idos.set_vertex_attributes(key, 'xyz', xyz_down)

# ==============================================================================
# Visualise
# ==============================================================================

artist = ShellArtist(None)

artist.mesh = idos
artist.layer = "Geometry::Offset::Intrados"
artist.clear_layer()
artist.draw_mesh(color=(255, 0, 0))

artist.mesh = edos
artist.layer = "Geometry::Offset::Extrados"
artist.clear_layer()
artist.draw_mesh(color=(0, 0, 255))

artist.redraw()
    POLYGONS.append({
        'points': [box1[1], box2[1], box2[2], box1[2], box1[1]],
        'color': (0, 0, 0)
    })

    FRAMES += framelines(origin, xaxis, yaxis, zaxis, 'box')

# ==============================================================================
# Visualize
# ==============================================================================

ARTIST = ShellArtist(SHELL, layer="Scaffolding")
ARTIST.clear_layer()

ARTIST.layer = "Scaffolding::Anchors"
ARTIST.clear_layer()
ARTIST.draw_points(POINTS)

ARTIST.layer = "Scaffolding::Connectors"
ARTIST.clear_layer()
ARTIST.draw_lines(LINES)

ARTIST.layer = "Scaffolding::Beams"
ARTIST.clear_layer()
ARTIST.draw_polygons(POLYGONS)

ARTIST.layer = "Scaffolding::Frames"
ARTIST.clear_layer()
ARTIST.draw_lines(FRAMES)
Пример #4
0
# ==============================================================================
# Initialise
# ==============================================================================

HERE = os.path.dirname(__file__)
DATA = os.path.abspath(os.path.join(HERE, '..', 'data'))
FILE_I = os.path.join(DATA, 'data.json')

SHELL = Shell.from_json(FILE_I)

# ==============================================================================
# Visualise
# ==============================================================================

ARTIST = ShellArtist(SHELL, layer="FoFin")
ARTIST.clear_layer()

ARTIST.layer = "FoFin::Data"
ARTIST.draw_vertices(color={
    key: (255, 0, 0)
    for key in SHELL.vertices_where({'is_anchor': True})
})
ARTIST.draw_edges()
ARTIST.draw_faces()

ARTIST.layer = "FoFin::Forces"
ARTIST.draw_forces(scale=0.025)

ARTIST.layer = "FoFin::Reactions"
ARTIST.draw_reactions(scale=0.5)
Пример #5
0
    for v in children[:-1]:
        faces.append(SUBD1.halfedge[u][v])
    grandchildren = []
    for fkey in faces:
        grandchildren += SUBD1.get_face_attribute(fkey, 'children')
    descendants[root] = children + grandchildren

# ==============================================================================
# Visualise
# ==============================================================================

ARTIST = ShellArtist(None, layer="Pillows")
ARTIST.clear_layer()

keys = []
for root in descendants:
    keys += list(SHELL.face_vertices(root))

ARTIST.mesh = SHELL
ARTIST.layer = "Pillows::Control"
ARTIST.draw_vertices(keys=keys, color={key: (255, 0, 0) for key in keys})
ARTIST.draw_edges()

keys = []
for root in descendants:
    keys += descendants[root]

ARTIST.mesh = SUBD2
ARTIST.layer = "Pillows::Subd"
ARTIST.draw_vertices(color={key: (0, 255, 0) for key in keys})
Пример #6
0
# ==============================================================================
# Visualise
# ==============================================================================

ARTIST = ShellArtist(SHELL, layer="Shell")
ARTIST.clear_layer()

# ARTIST.layer = "Shell::FoFin"
# ARTIST.draw_vertices(color={key: (255, 0, 0) for key in SHELL.vertices_where({'is_anchor': True})})
# ARTIST.draw_edges()
# ARTIST.draw_faces()
# ARTIST.draw_reactions(scale=0.5)
# ARTIST.draw_forces(scale=0.025)

# ARTIST.layer = "Shell::Intrados"
# ARTIST.mesh = IDOS
# ARTIST.draw_mesh(color=(255, 0, 0))
# ARTIST.draw_facenormals(color=(255, 0, 0), scale=0.05)

# ARTIST.layer = "Shell::Extrados"
# ARTIST.mesh = EDOS
# ARTIST.draw_mesh(color=(0, 0, 255))
# ARTIST.draw_facenormals(color=(0, 0, 255), scale=0.05)

ARTIST.layer = "Shell::Volume"
ARTIST.mesh = VOLUME
ARTIST.draw_mesh()

ARTIST.redraw()
Пример #7
0
    attr['x'] = xyz[index][0]
    attr['y'] = xyz[index][1]
    attr['z'] = xyz[index][2]

# ==============================================================================
# Volume
# ==============================================================================

# ==============================================================================
# Visualise
# ==============================================================================

ARTIST = ShellArtist(None, layer='Pillows')
ARTIST.clear_layer()

anchors = list(EDOS.vertices_where({'is_anchor': True}))

ARTIST.mesh = EDOS
ARTIST.layer = "Pillows::EDOS"
ARTIST.clear_layer()
ARTIST.draw_vertices(keys=anchors, color={key: (255, 0, 0) for key in anchors})
ARTIST.draw_mesh()

anchors = list(IDOS.vertices_where({'is_anchor': True}))

ARTIST.mesh = IDOS
ARTIST.layer = "Pillows::IDOS"
ARTIST.clear_layer()
ARTIST.draw_vertices(keys=anchors, color={key: (255, 0, 0) for key in anchors})
ARTIST.draw_mesh()