Quantcast
Channel: RAM | STAAD | ADINA Wiki
Viewing all articles
Browse latest Browse all 8748

OpenSTAAD and Python

$
0
0
Current Revision posted to RAM | STAAD Wiki by BadrZ on 7/17/2019 4:05:56 PM

Accessing SPRO from python script works differently. Loading ‘StaadPro.dll’ as we generally do won't work here

Hereunder you may find a Python script, which will give some idea about how one can connect.

**************************

import win32com.client

# Open STAAD.Pro and create an empty project first
os = win32com.client.GetActiveObject("StaadPro.OpenSTAAD");

# get the Geometry object
geometry = os.Geometry;

# For some reason comtypes don't automatically flag the methods
geometry._FlagAsMethod("GetNodeCount")

# call the method to get node count
nodeCount = geometry.GetNodeCount();

print nodeCount;

**************************

Note that STAAD.Pro needs to be installed on the same machine and started for the scripts to work.

Tags: python, OpenSTAAD, STAAD

Viewing all articles
Browse latest Browse all 8748

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>