コード例 #1
0
def RunCommand(is_interactive):
    if 'TNA' not in sc.sticky:
        raise Exception("Initialise the plugin first!")

    TNA = sc.sticky['TNA']

    form = TNA['form']
    force = ForceDiagram.from_formdiagram(form)

    del TNA['force']
    TNA['force'] = force

    force.draw(layer=TNA['settings']['layer.force'], clear_layer=True)
コード例 #2
0
def from_vertices_and_faces(vs, fs):
    mesh = Mesh.from_vertices_and_faces(vs, fs)
    form = FormDiagram.from_mesh(mesh)
    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()
    force = ForceDiagram.from_formdiagram(form)

    horizontal_nodal(form, force, alpha=95)
    scale = vertical_from_zmax(form, 450.0)

    return form
コード例 #3
0
# Note: you should apply 3 sets of constraints
#       1. the edges in the spanning direction                 => fmin := 2, fmax := 2
#       2. the edges in the spanning direction on the boundary => fmin := 1, fmin := 1
#       3. the edges in the opposite direction                 => fmin := 0, fmax := 0

while True:
    edges = DiagramHelper.select_edges(form)
    if not edges:
        break

    if DiagramHelper.update_edge_attributes(form, edges):
        form.draw(layer='TNA::FormDiagram', clear_layer=True)

# 5. make the force diagram

force = ForceDiagram.from_formdiagram(form)
force.draw(layer='TNA::ForceDiagram', clear_layer=True)

DiagramHelper.move(force)
force.draw(layer='TNA::ForceDiagram', clear_layer=True)

# 6. compute horizontal equilibrium

horizontal(form, force, alpha=100, kmax=500)
force.draw(layer='TNA::ForceDiagram', clear_layer=True)

# 7. compute vertical equilibrium based on a chosen height of the highest point of the equilibrium network

while True:
    zmax = rs.GetReal('Z Max')