Example #1
0
force.vertex[1]['is_param'] = True
force.vertex[2]['is_param'] = True
force.vertex[3]['is_param'] = True
force.vertex[4]['is_param'] = True
force.vertex[5]['is_param'] = True
force.vertex[6]['is_param'] = True

form.vertex[0]['is_fixed'] = True
form.vertex[1]['is_fixed'] = True
form.vertex[2]['is_fixed'] = True
form.vertex[3]['is_fixed'] = True
form.vertex[4]['is_fixed'] = True
form.vertex[5]['is_fixed'] = True
form.vertex[6]['is_fixed'] = True

graphstatics.form_update_from_force(form, force)
loadpath.optimise_loadpath(form, force)

viewer = Viewer(form, force, delay_setup=False)

viewer.draw_form(forcescale=5,
                 vertexlabel={key: key
                              for key in form.vertices()},
                 vertexsize=0.2)
viewer.draw_force(vertexlabel={key: key
                               for key in force.vertices()},
                  vertexsize=0.2)

viewer.show()
Example #2
0
for u, v in force.edges():
    force_lines.append({
        'start': force.vertex_coordinates(u, 'xy'),
        'end': force.vertex_coordinates(v, 'xy'),
        'width': 1.0,
        'color': '#cccccc',
        'style': '--'
    })

# modify the geometry of the force diagram

force.vertex[1]['x'] -= 5.0

# update the formdiagram

graphstatics.form_update_from_force(form, force, kmax=100)

# add arrow to lines to indicate movement

force_lines.append({
    'start': force_key_xyz[1],
    'end': force.vertex_coordinates(1),
    'color': '#ff0000',
    'width': 10.0,
    'style': '-',
})

# display the orginal configuration
# and the configuration after modifying the force diagram

viewer = Viewer(form, force, delay_setup=False)