示例#1
0
from fofin.shell import Shell
from fofin.shellartist import ShellArtist

# ==============================================================================
# Input
# ==============================================================================

guids = compas_rhino.select_lines()
lines = compas_rhino.get_line_coordinates(guids)

# ==============================================================================
# Shell
# ==============================================================================

shell = Shell.from_lines(lines, delete_boundary_face=True)

# ==============================================================================
# Vertex attributes
# ==============================================================================

corners = list(shell.vertices_where({'vertex_degree': 3}))
high = 26
higher = 43

shell.set_vertices_attribute('is_fixed', True, keys=corners)
shell.set_vertex_attribute(higher, 'z', 7.0)
shell.set_vertex_attribute(high, 'z', 5.0)

# ==============================================================================
# Edge attributes
示例#2
0
from fofin.shell import Shell
from fofin.shellartist import ShellArtist

# ==============================================================================
# Input file
# ==============================================================================

HERE = os.path.dirname(__file__)
DATA = os.path.join(HERE, 'data')
FILE = os.path.join(DATA, 'faces.obj')

# ==============================================================================
# Shell
# ==============================================================================

shell = Shell.from_obj(FILE)

# ==============================================================================
# Vertex attributes
# ==============================================================================

corners = list(shell.vertices_where({'vertex_degree': 2}))
high = [0, 35]

shell.set_vertices_attribute('is_fixed', True, keys=corners)
shell.set_vertices_attribute('z', 7.0, keys=high)

# ==============================================================================
# Edge attributes
# ==============================================================================
示例#3
0
from compas_rhino.modifiers import VertexModifier
from compas_rhino.modifiers import EdgeModifier

# ==============================================================================
# I/O
# ==============================================================================

HERE = os.path.dirname(__file__)
DATA = os.path.join(HERE, 'data')
FILE = os.path.join(DATA, 'fofin.json')

# ==============================================================================
# Shell
# ==============================================================================

shell = Shell.from_json(FILE)

# ==============================================================================
# Visualization helpers
# ==============================================================================

artist = ShellArtist(shell, layer="Mesh")
artist.clear_layer()
artist.draw_vertices()
artist.draw_edges()
artist.redraw()

def redraw():
    artist.clear_layer()
    artist.draw_vertices()
    artist.draw_edges()