×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

SAP2000 API using MATLAB - Set Stage Definitions

SAP2000 API using MATLAB - Set Stage Definitions

SAP2000 API using MATLAB - Set Stage Definitions

(OP)
Dear users,
I'm using MATLAB r2014b API connection with SAP2000 v17.3.
I found some problem using the "SetStageDefinitions_1" function.
I tried to use this script, according to OAPI Documentation.

%% clean-up the workspace & command window
clear all
clc

% set the installation folder
ProgramPath='C:\Program Files (x86)\Computers and Structures\SAP2000 17\sap2000.exe';

%% pass data to Sap2000 as one-dimensional arrays
feature('COM_SafeArraySingleDim', 1);

%% pass non-scalar arrays to Sap2000 API by reference
feature('COM_PassSafeArrayByRef', 1);

%% create OAPI helper object
helper=actxserver('Sap2000v17.helper');
helper=helper.invoke('cHelper');

%% create Sap2000 object
SapObject=helper.CreateObject(ProgramPath);

%% start Sap2000 application
SapObject.ApplicationStart;

%% create SapModel object
SapModel=SapObject.SapModel;

%% initialize model
ret=SapModel.InitializeNewModel;

%% create model from template
ret=SapModel.File.New2DFrame(0, 2, 144, 2, 288);

%% add static nonlinear staged load case
ret=SapModel.LoadCases.StaticNonlinearStaged.SetCase...
('ACASE1');

MyDuration=zeros(2,1);

MyDuration(1,1)=30;
MyOutput=true;
MyOutputName={'ST1'};
MyComment={'Build structure'};

ret=SapModel.LoadCases.StaticNonlinearStaged.SetStageDefinitions_1...
('ACASE1', 1, MyDuration, MyOutput, MyOutputName, MyComment)

%% close Sap2000
ret=SapObject.ApplicationExit(false());
SapModel=0;
SapObject=0;

I received the following error from MATLAB an of course it's not still working on SAP.

Error using
Interface.2CE898D9_F0EA_4961_970F_D8A5FC72BC89/SetStageDefinitions_1
Error: Type mismatch, argument 3

Error in TEST_SETSTAGEDATA (line 44)
ret=SapModel.LoadCases.StaticNonlinearStaged.SetStageDefinitions_1...

I checked it on internet ad I understood that the problem is is "MyOutput" variable. I defined it as a logical value, comparing the Boolean one of VisualBasic language but it doesn't work.

Does anyone know how to help me and solve this problem?
Thank you to everyone in advance.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources