Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open the existing or saved SAP2000 model using MATLAB

Status
Not open for further replies.

reddyteja

Civil/Environmental
May 15, 2012
6
Hi all,
I would like to request all experts of SAP2000, the following question.

"I would like to open the existing model (already modelled and saved in my folder)using MATLAB"
Please help me in this regard.

Thank you all
 
Replies continue below

Recommended for you

Hello,

I let you code in python. I hope you can translate it to matlab:

------------------------------------------------------------------------
import os
import sys
import comtypes.client

#create API helper object
helper = comtypes.client.CreateObject('SAP2000v1.Helper')
helper = helper.QueryInterface(comtypes.gen.SAP2000v1.cHelper)

#create an instance of the SAPObject from the latest installed SAP2000
mySapObject = helper.CreateObjectProgID("CSI.SAP2000.API.SapObject")

#start SAP2000 application
mySapObject.ApplicationStart()

#create SapModel object
SapModel = mySapObject.SapModel

#initialize model
ret = SapModel.InitializeNewModel()

#open existing file
FileName = 'C:\\CSiAPIexample\\Model.sdb'
ret = SapModel.File.OpenFile(FileName)
---------------------------------------------------------------------------------------
First lines are directly copied from CSI OAPI Example, so only last lines are related to opening files. I hope it will be useful

Greetings
 
No idea if this is valid, but I thought ChatGPT might have a go at it.
Code:
% Initialize the SAP2000 COM interface
sapObject = actxserver('SAP2000v20.SapObject');

% Start the SAP2000 application
sapObject.StartApplication;

% Open an existing model
modelPath = 'C:\path\to\model.sdb';
sapObject.SapModel.File.OpenFile(modelPath);

TTFN (ta ta for now)
I can do absolutely anything. I'm an expert! faq731-376 forum1529 Entire Forum list
 
I hope you gave chatGPT a thumbs down for that one because that code doesn't work
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor