Exemple #1
0
from compas_fea.structure import GeneralStep
from compas_fea.structure import PinnedDisplacement
from compas_fea.structure import PointLoad
from compas_fea.structure import Structure

from math import pi

# Author(s): Andrew Liew (github.com/andrewliew)

# Structure

mdl = Structure(name='beam_simple', path='C:/Temp/')

# Elements

network = rhino.network_from_lines(layer='elset_lines')
mdl.add_nodes_elements_from_network(network=network,
                                    element_type='BeamElement',
                                    elset='elset_lines',
                                    axes={'ex': [0, -1, 0]})

# Sets

rhino.add_sets_from_layers(mdl,
                           layers=['nset_left', 'nset_right', 'nset_weights'])

# Materials

mdl.add(ElasticIsotropic(name='mat_elastic', E=20 * 10**9, v=0.3, p=1500))

# Sections
import rhinoscriptsyntax as rs

__author__ = ['Andrew Liew <*****@*****.**>']
__copyright__ = 'Copyright 2018, BLOCK Research Group - ETH Zurich'
__license__ = 'MIT License'
__email__ = '*****@*****.**'

# Structure

mdl = Structure(name='beam_grid', path='C:/Temp/')

# Beams

beams = [i for i in rs.LayerNames() if i[:2] in ['BX', 'BY']]
for beam in beams:
    network = rhino.network_from_lines(rs.ObjectsByLayer(beam))
    axes = {'ex': [0, 1, 0]} if 'X' in beam else {'ex': [1, 0, 0]}
    mdl.add_nodes_elements_from_network(network=network,
                                        element_type='BeamElement',
                                        elset=beam,
                                        axes=axes)
    xyzs = [network.vertex_coordinates(i) for i in network.leaves()]
    ends = [mdl.check_node_exists(i) for i in xyzs]
    mdl.add_set('{0}_ends'.format(beam), type='node', selection=ends)

# Sets

rhino.add_sets_from_layers(mdl, layers=['lift_points'] + beams)

# Materials