#Importando bibliotecas
#O módulo clr é um módulo de strings
#Utilizando o pythonnet o módulo clr serve como um python package
import clr
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import sys
#GUI toolkit
#import tkinter as tk
#------------------------------------------------------------------------------------------#
#Adicionando path de referencias e importando objetos da bilbioteca
#A linha abaixo adiciona a referencia à função clr, ou seja adiciona o arquivo ao python package
clr.AddReference('C:\Program Files\Autodesk\Autodesk Robot Structural Analysis Professional 2021\System\Exe\Interop.RobotOM.dll')
#Da acesso aos módulos da biblioteca compartilhada do Robot (Habilita a utilização dos objetos do Robot)
from RobotOM import *
from System import Object
from System import Environment
from matplotlib import pyplot as plt
#from tkinter import *
#------------------------------------------------------------------------------------------#
#Abre a aplicação
Robotapp = RobotApplicationClass()
#Abre a janela
Robotapp.Interactive = 1
Robotapp.Visible = 1
project = Robotapp.Project
#Abre o projeto ja existente
project.Open("C:\Temp\\projeto.rtd")
#Definindo variaveis
preferences = project.Preferences
structure = project.Structure
bars = structure.Bars
#Server de acesso ás barras
labels = structure.Labels
#Server de acesso a seções
#secoes = labels.GetAvailableNames(3)
#IRobotBarSectionType
selections = structure.Selections
results = structure.Results
r_Bars = results.Bars
cases = structure.Cases
obj = structure.Objects
#Acessando informações do projeto
#Acessando servidores
#Acessa o servidor de resultados para barras (API->Get the results-> Results for bars -> Forces)
force_serv = r_Bars.Forces
#Acessando objetos no servidor
#Pega a coleção de resultado para todas as barras
bar_col = RobotBarCollection(bars.GetAll())
cas_col = IRobotCaseCollection(cases.GetAll())
precisão = 0.1 #em m
precisão_decimal = 1
#------------------------------------------------------------------------------------------#
#Cria uma seleção com vigas apenas
seleção_vigas = RobotSelection(selections.Create(1))
for i1 in range(bar_col.Count):
structural_type = obj.GetStructuralType(i1+1)
if structural_type == 1:
seleção_vigas.AddOne(i1+1)
else:
pass
vigas = IRobotCollection(bars.GetMany(seleção_vigas))
print(vigas.Count)
#------------------------------------------------------------------------------------------#
#definir uma funçao Valor = (M ou F, Barra, Caso, Ponto)
def MomentoX(Viga_Numero, Caso_Numero, Ponto😞
if obj.GetStructuralType(Viga_Numero) == 1:
L = IRobotBar(bars.Get(Viga_Numero)).Length
MX1 = force_serv.Value(Viga_Numero, Caso_Numero, Ponto/L).MX /1000
return MX1
#print(MX)
else:
pass
def MomentoY(Viga_Numero, Caso_Numero, Ponto😞
if obj.GetStructuralType(Viga_Numero) == 1:
L = IRobotBar(bars.Get(Viga_Numero)).Length
MY1 = force_serv.Value(Viga_Numero, Caso_Numero, Ponto/L).MY /1000
return MY1
#print(MY)
else:
pass
def MomentoZ(Viga_Numero, Caso_Numero, Ponto😞
if obj.GetStructuralType(Viga_Numero) == 1:
L = IRobotBar(bars.Get(Viga_Numero)).Length
MZ1 = force_serv.Value(Viga_Numero, Caso_Numero, Ponto/L).MZ /1000
#print(MZ)
return MZ1
else:
pass
With this I can acess all Moments value for beams just calling MomentoX(Beam number, case number, point at bar), the code have some portuguese so could be a quite dificult to read
Now im working on this...
but I still cant acess section dimentions, I dont found anything on internet or on API that (even on VBA) could lead me to figure this out 😕