Urgent Help Needed: Python Script Not Working in Dynamo for Robot Structural Analysis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone,
I’m currently facing issues with a Python script in Dynamo for the Robot Structural Analysis Professional. The script is intended to interface with the Robot API to manipulate structural elements but doesn't seem to execute as expected. Here’s the code snippet:
# Place your code below this line
robapp = RobotApplicationClass()
project = robapp.Project
structure = project.Structure
labels = structure.Labels
loads = structure.Cases
ProjectPrefs = project.Preferences
# Initialize the variable representing the forces server
force_serv = robapp.Project.Structure.Results.Bars.Forces
# Get the collection including all the bars
bar_col = robapp.Project.Structure.Bars.GetAll()
# Iterate for consecutive bars from the collection
for i in range(1, bar_col.Count + 1):
# Get i-th bar
bar = bar_col.Get(i)
# Read number of the bar
bar_num = bar.Number
start_node_num = bar.StartNode
end_node_num = bar.EndNodeWhen running this script, I encounter
AttributeError:”__ComObject’ object has no attribute ‘Count’ [File “<string>”, line 133, in <module> \n]
I’ve checked the usual suspects (references, API initialization, etc.) but can’t seem to find what’s wrong.
Here’s what I aim to achieve with the script:
Access the project's structure and get a list of all bars.
Retrieve specific properties like the bar number and node numbers.
Could someone with experience in this area point out what might be going wrong or suggest any corrections? I appreciate any help or pointers to get this script functioning as intended!
Thank you in advance!