""" from __future__ import print_function from __future__ import absolute_import from __future__ import division import compas_ags from compas_ags.diagrams import FormDiagram from compas_bi_ags.diagrams import ForceDiagram from compas_ags.viewers import Viewer from compas_bi_ags.bi_ags import graphstatics # make form diagram from obj # make force diagram from form form = FormDiagram.from_obj(compas_ags.get('zero_fd.obj')) force = ForceDiagram.from_formdiagram(form) # set the fixed points left = list(form.vertices_where({'x': 0.0, 'y': 0.0}))[0] right = list(form.vertices_where({'x': 12.0, 'y': 0.0}))[0] fixed = [left, right] form.set_fixed(fixed) e1 = { 'v': list(form.vertices_where({ 'x': 0.0, 'y': 6.0 }))[0], 'u': list(form.vertices_where({
import compas import compas_ags from compas_ags.diagrams import FormDiagram from compas_ags.diagrams import ForceDiagram from compas_ags.viewers import Viewer from compas_ags.ags import graphstatics # 0. set directory to location of this py file, find obj file HERE = os.path.abspath(os.path.dirname(__file__)) FILE = os.path.join(HERE, 'simple_truss.obj') # 1. make form diagram from obj form = FormDiagram.from_obj(FILE) # 2. make force diagram from form diagram force = ForceDiagram.from_formdiagram(form) # 3. set the fixed points left = list(form.vertices_where({'x': 0.0, 'y': 0.0}))[0] right = list(form.vertices_where({'x': 6.0, 'y': 0.0}))[0] # 4. set the magnitude of the applied load form.set_edge_force_by_index(1, 100.0) # 5. update diagrams
---------- .. [1] https://matplotlib.org/2.0.2/api/pyplot_api.html#matplotlib.pyplot.savefig """ plt.savefig(filepath, **kwargs) # ============================================================================== # Main # ============================================================================== if __name__ == '__main__': import compas_ags from compas_ags.diagrams import FormDiagram from compas_ags.diagrams import ForceDiagram form = FormDiagram.from_obj(compas_ags.get('paper/grid_irregular.obj')) form.identify_fixed() force = ForceDiagram.from_formdiagram(form) viewer = Viewer(form, force, delay_setup=False) viewer.draw_form(edgelabel={(u, v): '{:.1f}'.format(form.edge_length(u, v)) for u, v in form.edges()}) viewer.draw_force() viewer.show()
from compas_ags.diagrams import ForceDiagram from compas_ags.viewers import Viewer from compas_ags.ags import graphstatics as gs __author__ = [ 'Tom Van Mele', ] __copyright__ = 'Copyright 2016 - Block Research Group, ETH Zurich' __license__ = 'MIT License' __email__ = '*****@*****.**' __all__ = [] form = FormDiagram.from_obj(compas.get('lines.obj')) force = ForceDiagram.from_formdiagram(form) viewer = Viewer(form, force, delay_setup=False) viewer.draw_form( vertexsize=0.15, vertexlabel={key: key for key in form.vertices()}, edgelabel={uv: index for index, uv in enumerate(form.edges())}, external_on=True) viewer.draw_force(vertexsize=0.15, vertexlabel={key: key for key in force.vertices()})
from __future__ import absolute_import from __future__ import division import compas_ags from compas_ags.diagrams import FormDiagram from compas_ags.diagrams import ForceDiagram from compas_ags.viewers import Viewer from compas_ags.ags import graphstatics # make form diagram from obj # make force diagram from form form = FormDiagram.from_obj(compas_ags.get('paper/gs_form_force.obj')) force = ForceDiagram.from_formdiagram(form) # set the fixed points left = list(form.vertices_where({'x': 0.0, 'y': 0.0}))[0] right = list(form.vertices_where({'x': 6.0, 'y': 0.0}))[0] fixed = [left, right] form.set_fixed(fixed) force.set_fixed([2]) # set the magnitude of the applied load form.set_edge_force_by_index(0, -10.0)