Get maximum force value of a bar - Python
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi there,
How can I get the maximum and minimum force of a bar? I can get the global maximum values but not for individual elements.
def populateBarTableFromRobot(self😞
try:
rob_app = win32com.client.Dispatch("Robot.Application")
BarCollection = rob_app.Project.Structure.Selections.Get(1)
CaseCollection = rob_app.Project.Structure.Selections.Get(2)
BarForces = rob_app.Project.Structure.Results.Bars.Forces
if BarCollection.Count > 0:
self.setRowCount(BarCollection.Count)
for i in range(1, BarCollection.Count + 1😞
element_number = BarCollection.Get(i)
bar = rob_app.Project.Structure.Bars.Get(element_number)
es = rob_app.CmpntFactory.Create(42)
es.ValueType = 169 # References for MY
es.Selection.Set(1, bar)
es.Selection.Set(2, CaseCollection.GetAll)
try:
# Get max and min MY values for the bar
my_max = rob_app.Project.Structure.Results.Extremes.MaxValue(es).Value
my_min = rob_app.Project.Structure.Results.Extremes.MinValue(es).Value
print(f'Element: {element_number}, MY Max: {my_max.Value}, MY Min: {my_min.Value}')
except Exception as e:
print(f"Error retrieving MY extremes for element {element_number}: {e}")
else:
print("No elements selected in the model.")
except Exception as e:
print(f"Error: {e}")
finally:
if 'rob_app' in locals():
del rob_app