Hello,
I have a structural model created in Autodesk Robot Structural Analysis and I’m using Dynamo to automate some checks.
My question is simple:
How can I extract the deflection (vertical displacement) for each bar automatically?
I need to loop through all bars in the Robot model and get their deflection values. Eu já tentei usar com o Python script, mas ele retorna zero. Veja o código abaixo
Any guidance or examples would help a lot.
Thanks!
import clr
import System
# Conecta ao Robot aberto
robot = System.Activator.CreateInstance(
System.Type.GetTypeFromProgID("Robot.Application")
)
project = robot.Project
structure = project.Structure
bars = structure.Bars
nodes = structure.Nodes
displacements = structure.Results.Bars.Displacements
total_barras = bars.GetAll().Count
vigas = []
CASO_CARGA = 1
POSICAO = 0.5 # meio do vão
for i in range(1, total_barras + 1):
bar = bars.Get(i)
n1 = nodes.Get(bar.StartNode)
n2 = nodes.Get(bar.EndNode)
dx = abs(n2.X - n1.X)
dy = abs(n2.Y - n1.Y)
dz = abs(n2.Z - n1.Z)
# critério geométrico
if dz <= (dx + dy):
uz = displacements.Value(
i,
CASO_CARGA,
POSICAO
).UZ
vigas.append({
"Tipo": "VIGA",
"ID_Barra": i,
"Comprimento": bar.Length,
"Deflexao_UZ": round(uz, 4)
})
OUT = vigas