예제 #1
0
def weld_meshes_from_layer(layer_input, layer_output):
    """
    Grab meshes on an input layer and weld them onto an output layer.

    Parameters
    ----------
    layer_input : str
        Layer containing the Blender meshes to weld.
    layer_output : str
        Layer to plot single welded mesh.

    Returns
    -------
    None

    """

    print('Welding meshes on layer:{0}'.format(layer_input))

    S = Structure(path=' ')

    add_nodes_elements_from_layers(S,
                                   mesh_type='ShellElement',
                                   layers=layer_input)

    faces = []

    for element in S.elements.values():
        faces.append(element.nodes)

    try:
        clear_layer(layer_output)
    except:
        create_layer(layer_output)

    vertices = S.nodes_xyz()

    xdraw_mesh(name='welded_mesh',
               vertices=vertices,
               faces=faces,
               layer=layer_output)
예제 #2
0
def weld_meshes_from_layer(layer_input, layer_output):
    """ Grab meshes on an input layer and weld them onto an output layer.

    Parameters
    ----------
    layer_input : str
        Layer containing the Rhino meshes to weld.
    layer_output : str
        Layer to plot single welded mesh.

    Returns
    -------
    None

    """

    print('Welding meshes on layer:{0}'.format(layer_input))

    mdl = Structure(path=' ')

    add_nodes_elements_from_layers(mdl,
                                   mesh_type='ShellElement',
                                   layers=layer_input)

    faces = []

    for element in mdl.elements.values():
        enodes = element.nodes

        if len(enodes) == 3:
            enodes.append(enodes[-1])

        if len(enodes) == 4:
            faces.append(enodes)

    rs.DeleteObjects(rs.ObjectsByLayer(layer_output))
    rs.CurrentLayer(layer_output)
    rs.AddMesh(mdl.nodes_xyz(), faces)
예제 #3
0
# Elements

rhino.add_nodes_elements_from_layers(mdl,
                                     line_type='TrussElement',
                                     layers='elset_ties')
rhino.add_nodes_elements_from_layers(mdl,
                                     mesh_type='ShellElement',
                                     layers='elset_mesh')
rhino.add_nodes_elements_from_layers(mdl,
                                     line_type='BeamElement',
                                     layers='elset_ends')

# Sets

ymin, ymax = mdl.node_bounds()[1]
xyz = mdl.nodes_xyz()
nodes_top = [i for i, c in enumerate(xyz) if c[1] > ymax - 0.01]
nodes_bot = [i for i, c in enumerate(xyz) if c[1] < ymin + 0.01]
mdl.add_set(name='nset_top', type='node', selection=nodes_top)
mdl.add_set(name='nset_bot', type='node', selection=nodes_bot)

# Materials

mdl.add_materials(
    [Concrete(name='mat_concrete', fck=90),
     Steel(name='mat_steel', fy=355)])

# Sections

mdl.add_sections([
    ShellSection(name='sec_mesh', t=0.004),