Esempio n. 1
0
 def draw(self, layer=None, clear_layer=True, settings=None):
     from compas_tna.rhino import FormArtist
     artist = FormArtist(self, layer=layer)
     if clear_layer:
         artist.clear_layer()
     if not settings:
         settings = {}
     if settings.get('show.vertices', True):
         vertexcolor = {}
         vertexcolor.update({
             key: '#00ff00'
             for key in self.vertices_where({'is_fixed': True})
         })
         vertexcolor.update({
             key: '#0000ff'
             for key in self.vertices_where({'is_external': True})
         })
         vertexcolor.update({
             key: '#ff0000'
             for key in self.vertices_where({'is_anchor': True})
         })
         artist.draw_vertices(color=vertexcolor)
     if settings.get('show.edges', True):
         artist.draw_edges(keys=list(self.edges_where({'is_edge': True})))
     if settings.get('show.faces', True):
         artist.draw_faces(keys=list(self.faces_where({'is_loaded': True})))
     if settings.get('show.forces', False):
         artist.draw_forces(scale=settings.get('scale.forces', 0.1))
     if settings.get('show.reactions', False):
         artist.draw_reactions(scale=settings.get('scale.reactions', 0.01))
     artist.redraw()
Esempio n. 2
0
import compas
import compas_rhino
import compas_tna

compas_tna.TEMP = os.path.join(os.path.dirname(__file__), 'tmp')

from compas.utilities import i_to_green

from compas_tna.diagrams import FormDiagram
from compas_tna.diagrams import ForceDiagram

from compas_tna.rhino import FormArtist

# create diagrams from serialised files

form = FormDiagram.from_json('aag_08_final_formdiagram.json')
force = ForceDiagram.from_json('aag_08_final_forcediagram.json')

# draw the result

form.draw(layer='AAG::FormDiagram')
force.draw(layer='AAG::ForceDiagram')

artist = FormArtist(form, layer='AAG::FormDiagram')

artist.clear_reactions()
artist.draw_reactions(scale=0.25)
artist.draw_forces(scale=0.01)

artist.redraw()
Esempio n. 3
0
 def show_forces(self):
     artist = FormArtist(self.form, layer=self.settings['form.layer'])
     artist.clear_forces()
     artist.draw_forces()
     artist.redraw()
Esempio n. 4
0
# ------------------------------------------------------------------------------
horizontal(form, force, kmax=100)

# ------------------------------------------------------------------------------
# vertical equilibrium
# ------------------------------------------------------------------------------
vertical_from_zmax(form, force, zmax=5.)
vertical_from_self(form, force)
vertical_from_formforce(form, force)

# ------------------------------------------------------------------------------
# rhino drawings
# ------------------------------------------------------------------------------

# form diagram -----------------------------------------------------------------
artist = FormArtist(form, layer='FormDiagram')
artist.clear_layer()
artist.draw_vertices(keys=list(form.vertices_where({'is_external': False})))
artist.draw_edges(keys=list(form.edges_where({'is_edge': True, 'is_external': False})))
artist.draw_faces(fkeys=list(form.faces_where({'is_loaded': True})), join_faces=True)
artist.draw_reactions(scale=.1)
artist.draw_forces(scale=.003)
artist.redraw()

# force diagram ----------------------------------------------------------------
artist_ = ForceArtist(force, layer='ForceDiagram')
artist_.clear_layer()
artist_.draw_vertices()
artist_.draw_edges()
artist_.redraw()