0% found this document useful (0 votes)
536 views

SAP2000 - API Ejemplo

This document provides an example Visual Basic script for creating a new model in ETABS using the object application programming interface (OAPI). The script initializes a new ETABS OAPI object, starts an ETABS session, initializes a new blank model with specified units, creates a new blank file, allows performing additional actions on the model, saves the model to a file path, exits the ETABS session, and clears the OAPI objects. The script demonstrates the basic process for programmatically generating a new ETABS model file using the OAPI.

Uploaded by

Henry Hoyos
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
536 views

SAP2000 - API Ejemplo

This document provides an example Visual Basic script for creating a new model in ETABS using the object application programming interface (OAPI). The script initializes a new ETABS OAPI object, starts an ETABS session, initializes a new blank model with specified units, creates a new blank file, allows performing additional actions on the model, saves the model to a file path, exits the ETABS session, and clears the OAPI objects. The script demonstrates the basic process for programmatically generating a new ETABS model file using the OAPI.

Uploaded by

Henry Hoyos
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

https://structuresbycode.wordpress.

com/2013/08/27/etabs-oapi-how-to-get-started/

Sub template_New_model()

' EXAMPLE: Creating a new model and save it

Dim ret As Long ' return value from OAPI calls

Dim filename As String

filename = "C:\test.edb"

Dim myEtabs As ETABS2013.cOAPI ' the OAPI class has methods related to high level
program stuff, like .applicationStart()

Dim myModel As ETABS2013.cSapModel ' the SapModel class is where most things we are
interested in reside

' Create the OAPI object

Set myEtabs = CreateObject("CSI.ETABS.API.ETABSObject") ' Create the OAPI object

' Start ETABS

myEtabs.ApplicationStart

' Assign the resulting SAP model

myModel = myEtabs.SapModel

' Initialise a new model

myModel.InitializeNewModel (eUnits_kN_m_C) ' Initialize a new model with units)

' Create a new model file

ret = myEtabs.SapModel.file.NewBlank ' actually create the blank file

' DO STUFF

'Save the file

ret = myEtabs.SapModel.file.Save(filename) ' save the model

' close ETABS

ret = myEtabs.ApplicationExit(False) ' exit ETABS

Set myModel = Nothing

Set myEtabs = Nothing

End Sub

You might also like