### Example Using CreateObjectProgID in VB.NET Source: https://github.com/priyankgodhat/etabs-docs/blob/main/Individual_files/3f1a3df2-006a-723d-f97c-4fd19fd4fa03.md Demonstrates a complete VB.NET example showing how to use the cHelper.CreateObjectProgID method to create the ETABS object, start the application, get the SapModel, initialize a new model, and properly exit the application. ```VB.NET Public Sub Example() Dim myHelper As cHelper Dim SapModel As cSapModel Dim EtabsObject As cOAPI Dim ret As Integer = -1 'create ETABS object myHelper = New Helper EtabsObject = myHelper.CreateObjectProgID("CSI.ETABS.API.ETABSObject") 'start ETABS application ret = EtabsObject.ApplicationStart() 'create SapModel object SapModel = EtabsObject.SapModel 'initialize model ret = SapModel.InitializeNewModel() 'close ETABS EtabsObject.ApplicationExit(False) 'clean up variables SapModel = Nothing EtabsObject = Nothing myHelper = Nothing End Sub ``` -------------------------------- ### Example: Initialize ETABS, Run Analysis, Get Status - VB.NET Source: https://github.com/priyankgodhat/etabs-docs/blob/main/Individual_files/94fc4a33-5784-228c-62ad-edcc74eaf034.md This comprehensive VB.NET example demonstrates interacting with the ETABS API. It shows how to create an ETABS object, start the application, initialize a new model using a template, set analysis options, save and run the analysis, retrieve the load case statuses using GetCaseStatus, and finally close ETABS. ```VB Public Sub Example() Dim SapModel As cSapModel Dim EtabsObject As cOAPI Dim ret As Integer = -1 Dim NumberItems As Integer Dim CaseName() As String Dim Status() As Integer 'create ETABS object Dim myHelper as cHelper = New Helper EtabsObject = myHelper.CreateObjectProgID("CSI.ETABS.API.ETABSObject") 'start ETABS application ret = EtabsObject.ApplicationStart() 'create SapModel object SapModel = EtabsObject.SapModel 'initialize model ret = SapModel.InitializeNewModel() 'create steel deck template model ret = SapModel.File.NewSteelDeck(4,12,12,4,4,24,24) 'set load case run flag ret = SapModel.Analyze.SetRunCaseFlag("MODAL", False) 'run analysis System.IO.Directory.CreateDirectory("c:\CSI_API_temp") ret = SapModel.File.Save("C:\CSI_API_temp\example.edb") ret = SapModel.Analyze.RunAnalysis 'get load case status ret = SapModel.Analyze.GetCaseStatus(NumberItems, CaseName, Status) 'close ETABS EtabsObject.ApplicationExit(False) 'clean up variables SapModel = Nothing EtabsObject = Nothing End Sub ``` -------------------------------- ### Example of Using CreateAnalysisModel (VB) Source: https://github.com/priyankgodhat/etabs-docs/blob/main/Individual_files/4e608741-8192-d3b4-84e3-e6c550a1c2db.md Demonstrates a complete VB.NET example using the ETABS API to start ETABS, create a new model, populate it using a template, call the CreateAnalysisModel method, and then close ETABS. Shows the typical workflow for automating ETABS tasks via the API. Requires the ETABS installation and the ETABSv1 API assembly. ```VB Public Sub Example() Dim SapModel As cSapModel Dim EtabsObject As cOAPI Dim ret As Integer = -1 'create ETABS object Dim myHelper as cHelper = New Helper EtabsObject = myHelper.CreateObjectProgID("CSI.ETABS.API.ETABSObject") 'start ETABS application ret = EtabsObject.ApplicationStart() 'create SapModel object SapModel = EtabsObject.SapModel 'initialize model ret = SapModel.InitializeNewModel() 'create steel deck template model ret = SapModel.File.NewSteelDeck(4,12,12,4,4,24,24) 'create the analysis model ret = SapModel.Analyze.CreateAnalysisModel 'close ETABS EtabsObject.ApplicationExit(False) 'clean up variables SapModel = Nothing EtabsObject = Nothing End Sub ``` -------------------------------- ### Using cHelper.CreateObject and ETABS API - VB Example Source: https://github.com/priyankgodhat/etabs-docs/blob/main/individual_files_2/e070ca06-d6bc-bf74-d391-416766761e9a.md This comprehensive Visual Basic snippet demonstrates how to use `cHelper.CreateObject` to start the ETABS application via the API. It then shows how to get the `SapModel` object, initialize a new model, and properly exit the application. ```VB Public Sub Example() Dim myHelper As cHelper Dim SapModel As cSapModel Dim EtabsObject As cOAPI Dim ret As Integer = -1 'create ETABS object myHelper = New Helper EtabsObject = myHelper.CreateObject("C:\Program Files\Computers and Structures\ETABS 19\ETABS.exe") 'start ETABS application ret = EtabsObject.ApplicationStart() 'create SapModel object SapModel = EtabsObject.SapModel 'initialize model ret = SapModel.InitializeNewModel() 'close ETABS EtabsObject.ApplicationExit(False) 'clean up variables SapModel = Nothing EtabsObject = Nothing myHelper = Nothing End Sub ``` -------------------------------- ### Full Workflow Example (VB) Source: https://github.com/priyankgodhat/etabs-docs/blob/main/Individual_files/59e98a30-56bc-d6b7-00ff-e622b8f38224.md A complete Visual Basic subroutine demonstrating a typical ETABS API workflow, including creating the application object, starting ETABS, initializing a new model, creating a steel deck template, saving and running analysis, *deselecting all cases/combos for output* using the featured method, selecting a specific case ("DEAD"), checking its selection status, and finally exiting the application. This example requires the ETABS API to be installed. ```VB Public Sub Example() Dim SapModel As cSapModel Dim EtabsObject As cOAPI Dim ret As Integer = -1 Dim Selected As Boolean 'create ETABS object Dim myHelper as cHelper = New Helper EtabsObject = myHelper.CreateObjectProgID("CSI.ETABS.API.ETABSObject") 'start ETABS application ret = EtabsObject.ApplicationStart() 'create SapModel object SapModel = EtabsObject.SapModel 'initialize model ret = SapModel.InitializeNewModel() 'create steel deck template model ret = SapModel.File.NewSteelDeck(4,12,12,4,4,24,24) 'run analysis System.IO.Directory.CreateDirectory("c:\CSI_API_temp") ret = SapModel.File.Save("C:\CSI_API_temp\example.edb") ret = SapModel.Analyze.RunAnalysis 'deselect all cases and combos ret = SapModel.Results.Setup.DeselectAllCasesAndCombosForOutput 'set case selected for output ret = SapModel.Results.Setup.SetCaseSelectedForOutput("DEAD") 'check if case is selected ret = SapModel.Results.Setup.GetCaseSelectedForOutput("DEAD", Selected) 'close ETABS EtabsObject.ApplicationExit(False) 'clean up variables SapModel = Nothing EtabsObject = Nothing End Sub ``` -------------------------------- ### Example: Retrieving Area Property Names (VB) Source: https://github.com/priyankgodhat/etabs-docs/blob/main/Individual_files/6c82b66e-b9be-edf6-3996-d2da7bd4ebca.md This Visual Basic example demonstrates the end-to-end process of interacting with the ETABS API to retrieve area property names. It shows how to create the ETABS object, start the application, get the SapModel, initialize a new model, create a template model, call GetNameList, close the application, and clean up objects. ```VB Public Sub Example() Dim SapModel As cSapModel Dim EtabsObject As cOAPI Dim ret As Integer = -1 Dim i As Integer Dim NumberNames As Integer Dim MyName() As String 'create ETABS object Dim myHelper as cHelper = New Helper EtabsObject = myHelper.CreateObjectProgID("CSI.ETABS.API.ETABSObject") 'start ETABS application ret = EtabsObject.ApplicationStart() 'create SapModel object SapModel = EtabsObject.SapModel 'initialize model ret = SapModel.InitializeNewModel() 'create steel deck template model ret = SapModel.File.NewSteelDeck(4,12,12,4,4,24,24) 'get area property names ret = SapModel.PropArea.GetNameList(NumberNames, MyName) 'close ETABS EtabsObject.ApplicationExit(False) 'clean up variables SapModel = Nothing EtabsObject = Nothing End Sub ``` -------------------------------- ### Example Usage - Setting Story GUID - VB Source: https://github.com/priyankgodhat/etabs-docs/blob/main/individual_files_2/e8b8f661-42dd-fb00-9595-4dcc09f4c938.md This Visual Basic example demonstrates a complete workflow to set a GUID for a story using the ETABS API. It covers creating API objects, starting the ETABS application, initializing a new model from a template, setting a new GUID for 'Story2', retrieving the GUID, and finally closing ETABS. ```VB Public Sub Example() Dim SapModel As cSapModel Dim EtabsObject As cOAPI Dim ret As Integer = -1 Dim iGUID As String 'create ETABS object Dim myHelper as cHelper = New Helper EtabsObject = myHelper.CreateObjectProgID("CSI.ETABS.API.ETABSObject") 'start ETABS application ret = EtabsObject.ApplicationStart() 'create SapModel object SapModel = EtabsObject.SapModel 'initialize model ret = SapModel.InitializeNewModel() 'create steel deck template model ret = SapModel.File.NewSteelDeck(4,12,12,4,4,24,24) 'set story GUID Dim g As String = Guid.NewGuid.ToString ret = SapModel.Story.SetGUID("Story2", g) 'get story GUID ret = SapModel.Story.GetGUID("Story2", iGUID) 'close ETABS EtabsObject.ApplicationExit(False) 'clean up variables SapModel = Nothing EtabsObject = Nothing End Sub ``` -------------------------------- ### Initializing ETABS API, Running Analysis, and Getting Results (C++) Source: https://github.com/priyankgodhat/etabs-docs/blob/main/Individual_files/19ec34d0-117e-45f7-a3c4-73c6688d16cf.md Demonstrates how to initialize COM, connect to or launch an ETABS instance using the API helper, create a new model using a template, save it, run analysis, select output cases, and retrieve analysis results, specifically frame forces. Includes options for attaching to existing instances or specifying the ETABS executable path, along with basic error handling and cleanup. ```C++ #include "stdafx.h" #import "ETABSv1.tlb" no_dual_interfaces using namespace std; bool CheckHRESULT(HRESULT hRes, const wchar_t* msg) { if (hRes == S_FALSE || FAILED(hRes)) { MessageBox(0, msg, L"ERROR!", MB_SETFOREGROUND); return (false); } return (true); } int _tmain(int argc, _TCHAR* argv[]) { // set the following flag to true to attach to an existing instance of the program // otherwise a new instance of the program will be started bool bAttachToInstance; bAttachToInstance = false; // set the following flag to true to manually specify the path to ETABS.exe // this allows for a connection to a version of ETABS other than the latest installation // otherwise the latest installed version of ETABS will be launched bool bSpecifyPath; bSpecifyPath = false; // if the above flag is set to true, specify the path to ETABS below const wchar_t* ProgramPath; ProgramPath = L"C:\\Program Files\\Computers and Structures\\ETABS 19\\ETABS.exe"; // use res to check if functions return successfully (res = 0) or fail (res = nonzero) HRESULT hRes = 0; int res = 0; // initialize COM hRes = CoInitialize(NULL); if (!CheckHRESULT(hRes, L"Error initializing COM subsystem!")) return (hRes); // ETABSObject pointer CComPtr pETABSObject; try { // create Helper CComPtr pHelper; hRes = pHelper.CoCreateInstance(L"ETABSv1.Helper", NULL, CLSCTX_INPROC_SERVER); if (!CheckHRESULT(hRes, L"Cannot instantiate helper!")) return (hRes); if (bAttachToInstance) { // attach to a running instance of ETABS // get the active ETABS object pETABSObject = pHelper->GetObject(L"CSI.ETABS.API.ETABSObject"); hRes = ((pETABSObject) ? S_OK : S_FALSE); if (!CheckHRESULT(hRes, L"Cannot attach to ETABSObject!")) return (hRes); } else { // start a new instance of ETABS if (bSpecifyPath) { // create an instance of the ETABS object from the specified path pETABSObject = pHelper->CreateObject(ProgramPath); hRes = ((pETABSObject) ? S_OK : S_FALSE); if (!CheckHRESULT(hRes, L"Cannot instantiate ETABSObject!")) return (hRes); } else { // create an instance of the ETABS object from the latest installed ETABS pETABSObject = pHelper->CreateObjectProgID(L"CSI.ETABS.API.ETABSObject"); hRes = ((pETABSObject) ? S_OK : S_FALSE); if (!CheckHRESULT(hRes, L"Cannot instantiate ETABSObject!")) return (hRes); } // start ETABS application res = pETABSObject->ApplicationStart(); if (!CheckHRESULT(hRes, L"ETABSObject.ApplicationStart failed!")) return (hRes); } // Get a reference to SapModel to access all API classes and functions CComPtr pSapModel = pETABSObject->SapModel; // initialize model res = pSapModel->InitializeNewModel(ETABSv1::eUnits_kip_in_F); // create steel deck template model res = pSapModel->File->NewSteelDeck(4, 12, 12, 4, 4, 24, 24); // save model; CreateDirectory(L"C:\\CSi_ETABS_API_example\\", NULL); res = pSapModel->File->Save(L"C:\\CSi_ETABS_API_example\\example.edb"); // run model (this will create the analysis model) res = pSapModel->Analyze->RunAnalysis(); // clear all case and combo output selections res = pSapModel->Results->Setup->DeselectAllCasesAndCombosForOutput(); // set case and combo output selections res = pSapModel->Results->Setup->SetCaseSelectedForOutput("DEAD", VARIANT_TRUE); // get frame forces for all frame objects long NumberResults; CComSafeArray Obj(1); Obj[0] = ::SysAllocString(L""); CComSafeArray ObjSta(1); CComSafeArray Elm(1); Elm[0] = ::SysAllocString(L""); CComSafeArray ElmSta(1); CComSafeArray LoadCase(1); LoadCase[0] = ::SysAllocString(L""); CComSafeArray StepType(1); StepType[0] = ::SysAllocString(L""); CComSafeArray StepNum(1); CComSafeArray P(1); CComSafeArray V2(1); CComSafeArray V3(1); CComSafeArray T(1); CComSafeArray M2(1); CComSafeArray M3(1); LPSAFEARRAY pObj = Obj.Detach(); LPSAFEARRAY pObjSta = ObjSta.Detach(); LPSAFEARRAY pElm = Elm.Detach(); LPSAFEARRAY pElmSta = ElmSta.Detach(); LPSAFEARRAY pLoadCase = LoadCase.Detach(); LPSAFEARRAY pStepType = StepType.Detach(); LPSAFEARRAY pStepNum = StepNum.Detach(); LPSAFEARRAY pP = P.Detach(); LPSAFEARRAY pV2 = V2.Detach(); LPSAFEARRAY pV3 = V3.Detach(); LPSAFEARRAY pT = T.Detach(); LPSAFEARRAY pM2 = M2.Detach(); LPSAFEARRAY pM3 = M3.Detach(); res = pSapModel->Results->FrameForce("All", ETABSv1::eItemTypeElm_GroupElm, &NumberResults, &pObj, &pObjSta, &pElm, &pElmSta, &pLoadCase, &pStepType, &pStepNum, &pP, &pV2, &pV3, &pT, &pM2, &pM3); Obj.Attach(pObj); ObjSta.Attach(pObjSta); Elm.Attach(pElm); ElmSta.Attach(pElmSta); LoadCase.Attach(pLoadCase); StepType.Attach(pStepType); StepNum.Attach(pStepNum); P.Attach(pP); V2.Attach(pV2); V3.Attach(pV3); T.Attach(pT); M2.Attach(pM2); M3.Attach(pM3); // close ETABS CComVariant vFalse(false); res = pETABSObject->ApplicationExit(false); // uninitialize COM CoUninitialize(); // we're done! return (res); } catch (_com_error& ex) { CheckHRESULT(ex.Error(), ex.ErrorMessage()); // close ETABS CComVariant vRes = pETABSObject->ApplicationExit(false); // uninitialize COM CoUninitialize(); return (-1); } } ``` -------------------------------- ### Calling GetNameList - ETABS API VB.NET Example Source: https://github.com/priyankgodhat/etabs-docs/blob/main/individual_files_2/da6bfe37-713c-d2bf-7e54-f3a94f4a84bd.md Provides a Visual Basic.NET example demonstrating how to connect to the ETABS API, start the application, initialize a model, create a basic structure (steel deck), call the GetNameList method on the cStory object to get story names, and then properly close the application and clean up variables. Requires the ETABS API installed and accessible. ```VB.NET Public Sub Example() Dim SapModel As cSapModel Dim EtabsObject As cOAPI Dim ret As Integer = -1 Dim NumberNames As Integer Dim MyName() As String 'create ETABS object Dim myHelper as cHelper = New Helper EtabsObject = myHelper.CreateObjectProgID("CSI.ETABS.API.ETABSObject") 'start ETABS application ret = EtabsObject.ApplicationStart() 'create SapModel object SapModel = EtabsObject.SapModel 'initialize model ret = SapModel.InitializeNewModel() 'create steel deck template model ret = SapModel.File.NewSteelDeck(4,12,12,4,4,24,24) 'get story names ret = SapModel.Story.GetNameList(NumberNames, MyName) 'close ETABS EtabsObject.ApplicationExit(False) 'clean up variables SapModel = Nothing EtabsObject = Nothing End Sub ``` -------------------------------- ### Example: Retrieving Solver Options (VB) Source: https://github.com/priyankgodhat/etabs-docs/blob/main/individual_files_2/f07d0feb-6508-0ec3-b47a-f5186f578689.md Provides a complete VB example demonstrating how to instantiate the ETABS API object, start the application, initialize a new model, create a template, call the GetSolverOption_2 method to retrieve solver settings, and then clean up by closing the application and releasing objects. ```VB Public Sub Example() Dim SapModel As cSapModel Dim EtabsObject As cOAPI Dim ret As Integer = -1 Dim SolverType As Integer Dim SolverProcessType As Integer Dim NumberParallelRuns As Integer Dim StiffCase As String 'create ETABS object Dim myHelper as cHelper = New Helper EtabsObject = myHelper.CreateObjectProgID("CSI.ETABS.API.ETABSObject") 'start ETABS application ret = EtabsObject.ApplicationStart() 'create SapModel object SapModel = EtabsObject.SapModel 'initialize model ret = SapModel.InitializeNewModel() 'create steel deck template model ret = SapModel.File.NewSteelDeck(4,12,12,4,4,24,24) 'get model solver options ret = SapModel.Analyze.GetSolverOption_2(SolverType, SolverProcessType, NumberParallelRuns, StiffCase) 'close ETABS EtabsObject.ApplicationExit(False) 'clean up variables SapModel = Nothing EtabsObject = Nothing End Sub ``` -------------------------------- ### Example Starting and Exiting ETABS Application in VB Source: https://github.com/priyankgodhat/etabs-docs/blob/main/Individual_files/9780b1c4-791b-07a8-c329-970707104d91.md This Visual Basic example demonstrates the typical workflow for interacting with the ETABS API: creating the core API object using a helper, calling `ApplicationStart` to launch ETABS, and finally using `ApplicationExit` to close it cleanly. It also includes variable declaration and cleanup. ```VB Public Sub Example() Dim SapModel As cSapModel Dim EtabsObject As cOAPI Dim ret As Integer = -1 'create ETABS object Dim myHelper as cHelper = New Helper EtabsObject = myHelper.CreateObjectProgID("CSI.ETABS.API.ETABSObject") 'start ETABS application ret = EtabsObject.ApplicationStart() 'close ETABS EtabsObject.ApplicationExit(False) 'clean up variables SapModel = Nothing EtabsObject = Nothing End Sub ``` -------------------------------- ### Example: Get Base Reaction Location - ETABS API - VB.NET Source: https://github.com/priyankgodhat/etabs-docs/blob/main/Individual_files/13d5546b-9997-5097-0f36-4c20eb88a54b.md This VB.NET example demonstrates the full workflow to create an ETABS API object, start the application, initialize a model, create a sample structure, call `GetOptionBaseReactLoc` to get the base reaction location, and then close ETABS. ```VB.NET Public Sub Example() Dim SapModel As cSapModel Dim EtabsObject As cOAPI Dim ret As Integer = -1 Dim Selected As Boolean Dim gx As Double Dim gy As Double Dim gz As Double 'create ETABS object Dim myHelper as cHelper = New Helper EtabsObject = myHelper.CreateObjectProgID("CSI.ETABS.API.ETABSObject") 'start ETABS application ret = EtabsObject.ApplicationStart() 'create SapModel object SapModel = EtabsObject.SapModel 'initialize model ret = SapModel.InitializeNewModel() 'create steel deck template model ret = SapModel.File.NewSteelDeck(4,12,12,4,4,24,24) 'get base reaction location ret = SapModel.Results.Setup.GetOptionBaseReactLoc(gx, gy, gz) 'close ETABS EtabsObject.ApplicationExit(False) 'clean up variables SapModel = Nothing EtabsObject = Nothing End Sub ``` -------------------------------- ### Example: Getting and Comparing ETABS API Versions - VB Source: https://github.com/priyankgodhat/etabs-docs/blob/main/individual_files_2/d28f3634-a3f5-f333-0f77-748e390c4742.md A complete Visual Basic example demonstrating how to use the `cHelper.GetOAPIVersionNumber` method to get the client API version and the `cOAPI.GetOAPIVersionNumber` method to get the program API version. It includes steps for creating and starting the ETABS object, performing an API compatibility check, and cleaning up resources. ```VB Public Sub Example() Dim myHelper As cHelper Dim EtabsObject As cOAPI Dim clientAPIVersion As Double Dim programAPIVersion As Double Dim ret As Integer = -1 'create ETABS object myHelper = New Helper EtabsObject = myHelper.CreateObjectProgID("CSI.ETABS.API.ETABSObject") 'start ETABS application ret = EtabsObject.ApplicationStart() 'get client API version clientAPIVersion = myHelper.GetOAPIVersionNumber() 'get program API version programAPIVersion = EtabsObject.GetOAPIVersionNumber() 'API compatibility check If clientAPIVersion > programAPIVersion Then 'API client uses a newer version of the API than the program. 'All API functionality may be not be available. Exit Sub End If 'close ETABS EtabsObject.ApplicationExit(False) 'clean up variables EtabsObject = Nothing myHelper = Nothing End Sub ``` -------------------------------- ### Creating ETABS Object Remotely using VB.NET Source: https://github.com/priyankgodhat/etabs-docs/blob/main/Individual_files/1b10eea6-a7b3-2b2c-c681-baa0628a4f87.md Demonstrates how to use the cHelper.CreateObjectHost method in VB.NET to connect to and start ETABS on a remote server. It shows the steps for creating the helper object, creating the ETABS API object, starting the ETABS application, getting the SapModel object, initializing a new model, and finally closing ETABS and cleaning up variables. ```VB Public Sub Example() Dim myHelper As cHelper Dim SapModel As cSapModel Dim EtabsObject As cOAPI Dim ret As Integer = -1 'create ETABS object myHelper = New Helper EtabsObject = myHelper.CreateObjectHost("RemoteServer", "C:\Program Files\Computers and Structures\ETABS 19\ETABS.exe") 'start ETABS application ret = EtabsObject.ApplicationStart() 'create SapModel object SapModel = EtabsObject.SapModel 'initialize model ret = SapModel.InitializeNewModel() 'close ETABS EtabsObject.ApplicationExit(False) 'clean up variables SapModel = Nothing EtabsObject = Nothing myHelper = Nothing End Sub ``` -------------------------------- ### Getting Area Object GUID - VB Syntax and Example Source: https://github.com/priyankgodhat/etabs-docs/blob/main/individual_files_2/ffb6ef94-eb13-970b-8272-87062de64cff.md Presents the VB.NET syntax for the GetGUID method and a brief example of how to call it. The method takes the object's name as a string and a string variable by reference to output the GUID, returning an integer status code. ```VB.NET Function GetGUID ( Name As String, ByRef GUID As String ) As Integer ``` ```VB.NET Dim instance As cAreaObj Dim Name As String Dim GUID As String Dim returnValue As Integer returnValue = instance.GetGUID(Name, GUID) ``` -------------------------------- ### Defining ApplicationStart Method Signature in C# Source: https://github.com/priyankgodhat/etabs-docs/blob/main/Individual_files/9780b1c4-791b-07a8-c329-970707104d91.md Provides the syntax for the `ApplicationStart` method in C#, showing its signature and indicating it returns an integer. This method is part of the `cOAPI` interface and is used to initiate the ETABS application. ```C# int ApplicationStart() ``` -------------------------------- ### Full Example Retrieving Buckling Factors in VB.NET Source: https://github.com/priyankgodhat/etabs-docs/blob/main/Individual_files/4c601f77-172b-00c9-8ac2-bd528c32a3ff.md A comprehensive VB.NET subroutine demonstrating the end-to-end process of using the ETABS API to get buckling factors. It includes creating the API object, starting ETABS, initializing a model, running an analysis, selecting results for a specific load case, calling `BucklingFactor`, and cleaning up API objects. ```VB Public Sub Example() Dim SapModel As cSapModel Dim EtabsObject As cOAPI Dim ret As Integer = -1 Dim NumberResults As Integer Dim LoadCase() As String Dim StepType() As String Dim StepNum() As Double Dim Factor() As Double 'create ETABS object Dim myHelper as cHelper = New Helper EtabsObject = myHelper.CreateObjectProgID("CSI.ETABS.API.ETABSObject") 'start ETABS application ret = EtabsObject.ApplicationStart() 'create SapModel object SapModel = EtabsObject.SapModel 'initialize model ret = SapModel.InitializeNewModel() 'create steel deck template model ret = SapModel.File.NewSteelDeck(4,12,12,4,4,24,24) 'run analysis System.IO.Directory.CreateDirectory("c:\CSI_API_temp") ret = SapModel.File.Save("C:\CSI_API_temp\example.edb") ret = SapModel.Analyze.RunAnalysis() 'deselect all cases and combos ret = SapModel.Results.Setup.DeselectAllCasesAndCombosForOutput() 'set case selected for output ret = SapModel.Results.Setup.SetCaseSelectedForOutput("DEAD") 'get buckling factors ret = SapModel.Results.BucklingFactor(NumberResults, LoadCase, StepType, StepNum, Factor) 'close ETABS EtabsObject.ApplicationExit(False) 'clean up variables SapModel = Nothing EtabsObject = Nothing End Sub ``` -------------------------------- ### Getting Analysis Results Buckling Mode Options (VB.NET) Source: https://github.com/priyankgodhat/etabs-docs/blob/main/individual_files_2/cc52d5f2-f222-4442-5e84-58393d112a8d.md Retrieves the analysis setup options for buckling modes from the ETABS API. This method is part of the `cAnalysisResultsSetup` interface and outputs the starting buckling mode (`BuckModeStart`), ending buckling mode (`BuckModeEnd`), and a flag indicating if all modes are considered (`BuckModeAll`) via ByRef parameters. It returns an integer status code. An example call on an interface instance is included. ```VB.NET Function GetOptionBucklingMode ( ByRef BuckModeStart As Integer, ByRef BuckModeEnd As Integer, ByRef BuckModeAll As Boolean ) As Integer Dim instance As cAnalysisResultsSetup Dim BuckModeStart As Integer Dim BuckModeEnd As Integer Dim BuckModeAll As Boolean Dim returnValue As Integer returnValue = instance.GetOptionBucklingMode(BuckModeStart, BuckModeEnd, BuckModeAll) ``` -------------------------------- ### Defining and Calling ApplicationStart Function in VB Source: https://github.com/priyankgodhat/etabs-docs/blob/main/Individual_files/9780b1c4-791b-07a8-c329-970707104d91.md Illustrates the syntax for the `ApplicationStart` function in Visual Basic and provides a minimal example of how to declare variables, get a `cOAPI` instance, and call the function, capturing the integer return value. This function initiates the ETABS application. ```VB Function ApplicationStart As Integer Dim instance As cOAPI Dim returnValue As Integer returnValue = instance.ApplicationStart() ``` -------------------------------- ### Using ETABS API to Get Solid Slab Deck Properties VB Example Source: https://github.com/priyankgodhat/etabs-docs/blob/main/Individual_files/69caa577-8c87-9122-aeb8-0f51f6f8d53b.md A complete Visual Basic example demonstrating how to interact with the ETABS API to create a model, define a solid slab deck property (`SetDeckSolidSlab`), and then retrieve its properties (`GetDeckSolidSlab`). It shows the typical API workflow including object creation, initialization, model setup, property definition, property retrieval, and application exit. Requires the ETABS API assembly. ```VB Public Sub Example() Dim SapModel As cSapModel Dim EtabsObject As cOAPI Dim ret As Integer = -1 Dim DeckType As eDeckType Dim ShellType As eShellType Dim MatProp As String Dim Thickness As Double Dim Color As Integer Dim Notes As String Dim GUID As String Dim SlabDepth As Double Dim ShearStudDia As Double Dim ShearStudHt As Double Dim ShearStudFu As Double 'create ETABS object Dim myHelper as cHelper = New Helper EtabsObject = myHelper.CreateObjectProgID("CSI.ETABS.API.ETABSObject") 'start ETABS application ret = EtabsObject.ApplicationStart() 'create SapModel object SapModel = EtabsObject.SapModel 'initialize model ret = SapModel.InitializeNewModel() 'create steel deck template model ret = SapModel.File.NewSteelDeck(4,12,12,4,4,24,24) 'set new area property ret = SapModel.PropArea.SetDeck("MyShellProp1A", eDeckType.SolidSlab, eShellType.ShellThin, "4000Psi", 14) 'set new area property ret = SapModel.PropArea.SetDeckSolidSlab(Name:="MyShellProp1A", SlabDepth:=3.5, ShearStudDia:=0.75, ShearStudHt:=6, ShearStudFu:=65000) 'get area property data ret = SapModel.PropArea.GetDeck("MyShellProp1A", DeckType, ShellType, MatProp, Thickness, Color, Notes, GUID) 'get area property data ret = SapModel.PropArea.GetDeckSolidSlab("MyShellProp1A", SlabDepth, ShearStudDia, ShearStudHt, ShearStudFu) 'close ETABS EtabsObject.ApplicationExit(False) 'clean up variables SapModel = Nothing EtabsObject = Nothing End Sub ``` -------------------------------- ### Getting Tower Names ETABS API VB.NET Example Source: https://github.com/priyankgodhat/etabs-docs/blob/main/individual_files_2/d65a6802-594a-79e4-2a4e-27d6b119662a.md An example demonstrating how to declare variables and call the `cTower.GetNameList` method in VB.NET. It shows the setup needed before invoking the method on an instance of the `cTower` interface. ```VB Dim instance As cTower Dim NumberNames As Integer Dim MyName As String() Dim returnValue As Integer returnValue = instance.GetNameList(NumberNames, MyName) ``` -------------------------------- ### Getting Model Units - ETABS API Full Example - VB.NET Source: https://github.com/priyankgodhat/etabs-docs/blob/main/individual_files_2/bbeca1c7-a471-6d04-bd18-2df96a44a7a3.md A complete VB.NET example demonstrating how to interact with the ETABS API to get the current model units. The code instantiates the API, starts ETABS, creates a new model, retrieves the units using GetPresentUnits_2, runs analysis, and then closes the ETABS application. ```VB.NET Public Sub Example() Dim SapModel As cSapModel Dim EtabsObject As cOAPI Dim ret As Integer = -1 'create ETABS object Dim myHelper as cHelper = New Helper EtabsObject = myHelper.CreateObjectProgID("CSI.ETABS.API.ETABSObject") 'start ETABS application ret = EtabsObject.ApplicationStart() 'create SapModel object SapModel = EtabsObject.SapModel 'initialize model ret = SapModel.InitializeNewModel() 'create steel deck template model ret = SapModel.File.NewSteelDeck(4,12,12,4,4,24,24) 'get present units Dim forceUnits As eForce Dim lengthUnits As eLength Dim temperatureUnits As eTemperature ret = SapModel.GetPresentUnits_2(forceUnits, lengthUnits, temperatureUnits) 'run model (this will create the analysis model) ret = SapModel.Analyze.RunAnalysis 'close ETABS EtabsObject.ApplicationExit(False) 'clean up variables SapModel = Nothing EtabsObject = Nothing End Sub ``` -------------------------------- ### Defining ApplicationStart Method Signature in C++ Source: https://github.com/priyankgodhat/etabs-docs/blob/main/Individual_files/9780b1c4-791b-07a8-c329-970707104d91.md Shows the C++ syntax for the `ApplicationStart` method signature, indicating it returns an integer. This method, belonging to the `cOAPI` interface, is used to start the ETABS application programmatically. ```C++ int ApplicationStart() ``` -------------------------------- ### Getting Story Height ETABS API VB Example Source: https://github.com/priyankgodhat/etabs-docs/blob/main/Individual_files/37caf9a0-2ad5-1934-bda0-6378f7cb4c8e.md This complete VB example demonstrates how to automate ETABS using the API. It shows creating the ETABS object, starting the application, initializing a model, creating a steel deck template, getting the height of 'Story2' using the GetHeight method, and finally closing the application and cleaning up variables. ```VB Public Sub Example() Dim SapModel As cSapModel Dim EtabsObject As cOAPI Dim ret As Integer = -1 Dim Height As Double 'create ETABS object Dim myHelper as cHelper = New Helper EtabsObject = myHelper.CreateObjectProgID("CSI.ETABS.API.ETABSObject") 'start ETABS application ret = EtabsObject.ApplicationStart() 'create SapModel object SapModel = EtabsObject.SapModel 'initialize model ret = SapModel.InitializeNewModel() 'create steel deck template model ret = SapModel.File.NewSteelDeck(4,12,12,4,4,24,24) 'get story height ret = SapModel.Story.GetHeight("Story2", Height) 'close ETABS EtabsObject.ApplicationExit(False) 'clean up variables SapModel = Nothing EtabsObject = Nothing End Sub ``` -------------------------------- ### Retrieving Database Units - ETABS API VB Example Source: https://github.com/priyankgodhat/etabs-docs/blob/main/individual_files_2/fb780d03-aa2a-02bb-a9c2-ff0038bbba36.md Provides a complete Visual Basic example demonstrating how to automate ETABS, initialize a new model, create a basic structure, and retrieve the database units using the SapModel.GetDatabaseUnits_2 method. It shows the necessary steps from API creation to application exit. ```VB Public Sub Example() Dim SapModel As cSapModel Dim EtabsObject As cOAPI Dim ret As Integer = -1 'create ETABS object Dim myHelper as cHelper = New Helper EtabsObject = myHelper.CreateObjectProgID("CSI.ETABS.API.ETABSObject") 'start ETABS application ret = EtabsObject.ApplicationStart() 'create SapModel object SapModel = EtabsObject.SapModel 'initialize model ret = SapModel.InitializeNewModel() 'create steel deck template model ret = SapModel.File.NewSteelDeck(4,12,12,4,4,24,24) 'get database units Dim forceUnits As eForce Dim lengthUnits As eLength Dim temperatureUnits As eTemperature ret = SapModel.GetDatabaseUnits_2(forceUnits, lengthUnits, temperatureUnits) 'run model (this will create the analysis model) ret = SapModel.Analyze.RunAnalysis 'close ETABS EtabsObject.ApplicationExit(False) 'clean up variables SapModel = Nothing EtabsObject = Nothing End Sub ``` -------------------------------- ### Example: Setting Italian NTC 2008 Concrete Design Preference (VB.NET) Source: https://github.com/priyankgodhat/etabs-docs/blob/main/individual_files_2/d677bfa4-d427-5542-0500-a0e239d240d2.md A complete VB.NET example demonstrating the use of the ETABS API, including starting the application, initializing a model, creating sections, setting the design code to Italian NTC 2008, running analysis, starting concrete design, setting a specific NTC 2008 preference, getting the preference, and exiting ETABS. Required dependencies: ETABS installed, ETABSv1 API library referenced. Parameters: - Example demonstrates setting preference item 2 with value 7 (Note: documentation states valid items are 3-34). Expected output: The specified preference is set within the ETABS model. ```VB Public Sub Example() Dim SapModel As cSapModel Dim EtabsObject As cOAPI Dim ret As Integer = -1 Dim Value As Double 'create ETABS object Dim myHelper as cHelper = New Helper EtabsObject = myHelper.CreateObjectProgID("CSI.ETABS.API.ETABSObject") 'start ETABS application ret = EtabsObject.ApplicationStart() 'create SapModel object SapModel = EtabsObject.SapModel 'initialize model ret = SapModel.InitializeNewModel() 'create steel deck template model ret = SapModel.File.NewSteelDeck(4, 12, 12, 4, 4, 24, 24) 'create new concrete frame section property ret = SapModel.PropFrame.SetRectangle("R1", "4000Psi", 20, 12) 'set frame section property ret = SapModel.FrameObj.SetSection("8", "R1") 'set concrete design code ret = SapModel.DesignConcrete.SetCode("Italian NTC 2008") 'run analysis System.IO.Directory.CreateDirectory("c:\CSI_API_temp") ret = SapModel.File.Save("C:\CSI_API_temp\example.edb") ret = SapModel.Analyze.RunAnalysis 'start concrete design ret = SapModel.DesignConcrete.StartDesign() 'set preference item ret = SapModel.DesignConcrete.ItalianNTC2008C.SetPreference(2, 7) 'get preference item ret = SapModel.DesignConcrete.ItalianNTC2008C.GetPreference(2, Value) 'close ETABS EtabsObject.ApplicationExit(False) 'clean up variables SapModel = Nothing EtabsObject = Nothing End Sub ``` -------------------------------- ### ETABS API: Example Setting and Retrieving Point Springs (VB) Source: https://github.com/priyankgodhat/etabs-docs/blob/main/Individual_files/001c55da-41a5-a188-8af9-15c260f79748.md Provides a full Visual Basic example demonstrating how to connect to the ETABS API, initialize a model, assign a spring stiffness to a point object using `SetSpring`, retrieve the assigned stiffnesses using `GetSpring`, and properly close the application. ```VB Public Sub Example() Dim SapModel As cSapModel Dim EtabsObject As cOAPI Dim ret As Integer = -1 'create ETABS object Dim myHelper as cHelper = New Helper EtabsObject = myHelper.CreateObjectProgID("CSI.ETABS.API.ETABSObject") 'start ETABS application ret = EtabsObject.ApplicationStart() 'create SapModel object SapModel = EtabsObject.SapModel 'initialize model ret = SapModel.InitializeNewModel() 'create steel deck template model ret = SapModel.File.NewSteelDeck(4, 12, 12, 4, 4, 24, 24) 'assign spring to a point ReDim k(5) k(2) = 10 ret = SapModel.PointObj.SetSpring("3", k) 'get spring values ReDim k(5) ret = SapModel.PointObj.GetSpring("3", k) 'close ETABS EtabsObject.ApplicationExit(False) 'clean up variables SapModel = Nothing EtabsObject = Nothing End Sub ``` -------------------------------- ### Example Usage of SetDeck Method - VB.NET Source: https://github.com/priyankgodhat/etabs-docs/blob/main/individual_files_2/f9ab6c11-c39e-beab-a6c0-0d709e5e189f.md This VB.NET subroutine demonstrates how to programmatically interact with the ETABS API to create a new model, define a steel deck template, add a deck area property using the `SetDeck` method, and then retrieve the properties of the newly created deck using `GetDeck`. It shows the typical workflow including object creation, initialization, model setup, property definition, and application exit. ```VB.NET Public Sub Example() Dim SapModel As cSapModel Dim EtabsObject As cOAPI Dim ret As Integer = -1 Dim DeckType As eDeckType Dim ShellType As eShellType Dim MatProp As String Dim Thickness As Double Dim Color As Integer Dim Notes As String Dim GUID As String 'create ETABS object Dim myHelper as cHelper = New Helper EtabsObject = myHelper.CreateObjectProgID("CSI.ETABS.API.ETABSObject") 'start ETABS application ret = EtabsObject.ApplicationStart() 'create SapModel object SapModel = EtabsObject.SapModel 'initialize model ret = SapModel.InitializeNewModel() 'create steel deck template model ret = SapModel.File.NewSteelDeck(4,12,12,4,4,24,24) 'set new area property ret = SapModel.PropArea.SetDeck("MyShellProp1A", eDeckType.Filled, eShellType.ShellThin, "4000Psi", 14) 'get area property data ret = SapModel.PropArea.GetDeck("MyShellProp1A", DeckType, ShellType, MatProp, Thickness, Color, Notes, GUID) 'close ETABS EtabsObject.ApplicationExit(False) 'clean up variables SapModel = Nothing EtabsObject = Nothing End Sub ```