Skip to content

01. Getting Started

Daniel Ogg edited this page Sep 27, 2020 · 6 revisions

Python Environment

The examples in this wiki will be written using Anaconda Spyder https://www.anaconda.com/products/individual.

Connecting to the CSI Etabs API using python

After running the main.py script. You can connect to the API by calling the function SapModel,EtabsObject=connect_to_etabs()

The first time this function is run and performs the operation EtabsObject=comtypes.client.GetActiveObject("CSI.ETABS.API.ETABSObject") a new .py file will be created in the comtypes generated modules folder "comtypes\gen". This file will have a path to the file "CSiAPIv1.tlb" which will be located in the Etabs install directory.

Calling Functions

The below is a simple example of a 4-storey, flat slab building on a grid of columns.

IMAGE

Some simple functions have been provided, including get_story_data(SapModel); get_all_frames(SapModel); get_all_points(SapModel)

Begin by using get_story_data.

story_data=get_story_data(SapModel);
print(story_data);

This will return the values

[['Story4', 3750.0, 15000.0, True, None, False, 0.0],
 ['Story3', 3750.0, 11250.0, False, 'Story4', False, 0.0],
 ['Story2', 3750.0, 7500.0, False, 'Story4', False, 0.0],
 ['Story1', 3750.0, 3750.0, False, 'Story4', False, 0.0],
 ['Base', 0.0, 0.0, False, None, False, 0.0]]`

Values will be as per data table when the user selects "Edit>Edit Stories and Grid Systems...>Modify/Show Story Data..."

IMAGE

Clone this wiki locally