import compas_tna from compas_tna.diagrams import FormDiagram from compas_tna.diagrams import ForceDiagram from compas_tna.equilibrium import horizontal_nodal from compas_plotters import MeshPlotter FILE = compas_tna.get('tutorial/boundaryconditions.json') form = FormDiagram.from_json(FILE) force = ForceDiagram.from_formdiagram(form) horizontal_nodal(form, force, kmax=100) # ============================================================================== # Visualise # ============================================================================== plotter = MeshPlotter(force, figsize=(12, 8), tight=True) vertexcolor = { key: (1.0, 0.9, 0.9) for key in force.vertices() if not form.face_attribute(key, '_is_loaded') } radius = {key: 0.05 for key in force.vertices()} radius.update({ key: 0.1 for key in force.vertices() if not form.face_attribute(key, '_is_loaded') })
import compas_tna from compas_plotters import MeshPlotter from compas_tna.diagrams import FormDiagram from compas_tna.utilities import relax_boundary_openings FILE_I = compas_tna.get('tutorial/rhinomesh.obj') FILE_O = compas_tna.get('tutorial/boundaryconditions.json') form = FormDiagram.from_obj(FILE_I) corners = list(form.vertices_where({'vertex_degree': 2})) form.vertices_attribute('is_anchor', True, keys=corners) form.edges_attribute('q', 10.0, keys=form.edges_on_boundary()) relax_boundary_openings(form, corners) form.update_boundaries(feet=2) form.to_json(FILE_O) # ============================================================================== # Visualisation # ============================================================================== plotter = MeshPlotter(form, figsize=(12, 8), tight=True) vertexcolor = {} vertexcolor.update( {key: '#00ff00'
"""""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import compas_tna from compas_tna.diagrams import FormDiagram from compas_tna.diagrams import ForceDiagram from compas_tna.equilibrium import horizontal from compas.plotters import MeshPlotter form = FormDiagram.from_json(compas_tna.get('form_boundaryconditions.json')) force = ForceDiagram.from_formdiagram(form) horizontal(form, force) # force.plot() plotter = MeshPlotter(force, figsize=(12, 8), tight=True) vertexcolor = {key: (1.0, 0.9, 0.9) for key in force.vertices() if not form.get_face_attribute(key, 'is_loaded')} radius = {key: 0.05 for key in force.vertices()} radius.update({key: 0.1 for key in force.vertices() if not form.get_face_attribute(key, 'is_loaded')}) plotter.draw_vertices( facecolor=vertexcolor, radius=radius
import compas_tna from compas_tna.diagrams import FormDiagram from compas_tna.utilities import relax_boundary_openings FILE = compas_tna.get('tutorial/rhinomesh.obj') form = FormDiagram.from_obj(FILE) corners = list(form.vertices_where({'vertex_degree': 2})) form.edges_attribute('q', 10.0, keys=form.edges_on_boundary()) relax_boundary_openings(form, corners) form.plot()