You are on page 1of 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