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!

Matlab-SAP2000 API - PropFrame.GetGeneral Help

Status
Not open for further replies.

ffaabbiioo

Structural
Mar 25, 2017
3

Hello friends
I am studying the SAP2000-Matlab API.
I succeeded in the commands: "SAPModel.Results.FrameJointForce" and "SapModel.Results.ModalParticipatingMassRatios".

However, I'm trying to get the properties of the frames section.
"Frame section properties - General".
This command follows the same process as the previous ones and I do not know why I can not.

Command: "SapModel.PropFrame.GetGeneral"
Error: No 'GetGeneral' method with matching match found for class 'Interface.C2196046_B336_42DE_81FC_B82C14CAA123'.


Code:
feature('COM_SafeArraySingleDim', 1);
feature('COM_PassSafeArrayByRef', 1);
SapObject = actxserver('sap2000.SapObject');
SapObject.ApplicationStart;
SapModel = SapObject.SapModel;

FileName = 'C:\Users\Fábio\Desktop\Model\Model10.sdb';
ret = SapModel.File.OpenFile(FileName);

Name      = cellstr('');
FileName1 = cellstr('');
Notes     = cellstr('');
GUID      = cellstr('');
MatProp   = cellstr('');
t3        = reshape(0:1,2,1);
t2        = reshape(0:1,2,1);
Area      = reshape(0:1,2,1);
As2       = reshape(0:1,2,1);
As3       = reshape(0:1,2,1);
Torsion   = reshape(0:1,2,1);
I22       = reshape(0:1,2,1);
I33       = reshape(0:1,2,1);
S22       = reshape(0:1,2,1);
S33       = reshape(0:1,2,1);
Z22       = reshape(0:1,2,1);
Z33       = reshape(0:1,2,1);
R22       = reshape(0:1,2,1);
R33       = reshape(0:1,2,1);
Color     = 1

[COLOR=#EF2929]ret = SapModel.PropFrame.GetGeneral('5', FileName1, MatProp, t3, t2, Area, As2, As3, Torsion, I22, I33, S22, S33, Z22, Z33, R22, R33, Color, Notes, GUID)[/color]


Could someone help me?
Thanks!
 
Replies continue below

Recommended for you

Hi ffaabbiioo,

I have a similar problem with the comand:

"
AnalysisResults.JointDispl(PointName2, SAP2000v19.eItemTypeElm.ObjectElm, NumberResults, Obj, Elm, ACase, StepType, StepNum, U1, U2, U3, R1, R2, R3);
"

I try to use a form to save my SAP2000 results (points displacements) in a matriz or vector. However I can't find the right way. Please, if you have noticed the problem, I would aprecciate your help.

The form is:

ret = AnalysisResults.JointDispl('ALL', 1, NumberResults, Obj, 2, ACase, StepType, StepNum, U1, U2, U3, R1, R2, R3);

Thanks

 
Hi Jose. Where are you from?

The possible error:

"1" is an element.
And "ALL" is a group

"Elm" is a string, I did not understand "2".


Try it:
Code:
ObjectElm = 0            
Element = 1              
GroupElm = 2          
SelectionElm = 3
     
NumberResults = 0;
LoadCase = cellstr('');
Obj = cellstr(' ');
Elm = cellstr(' ');
PointElm = cellstr('');
StepType = cellstr(' ');
StepNum = reshape(0:1,2,1);
U1 = reshape(0:1,2,1);
U2 = reshape(0:1,2,1);
U3 = reshape(0:1,2,1);
R1 = reshape(0:1,2,1);
R2 = reshape(0:1,2,1);
R3 = reshape(0:1,2,1);

ret = SapModel.Results.JointDispl('ALL', [COLOR=#EF2929]GroupElm[/color], NumberResults, Obj, [COLOR=#EF2929]Elm[/color], LoadCase, StepType, StepNum, U1, U2, U3, R1, R2, R3)

[code]
 
Hi again ffaabbiioo,

I am Jose Ruiz and I am from Peru. I tried with your code and it didn't work and I had an error with the following message:

"Error using SimSAP2000 (line 80)
No appropriate method, property, or field 'JointDispl' for class 'SAP2000v19.wAnalysisResults'."

Please I would apreciate your help if you tell me what the problem is. I posted the MATLAB code and I will explain you about my goal:

I created a function which it will be loaded from another MATLAB code. I have an structural model in SAP2000 which will be called from this function many times. The result that I need are the points displacements in every floor in every run that I perform with this function. The model is a simple 2D frame with four floors and it was saved in a .s2k file. I need to created a vector or matrix which will saved every point displacement from a inelastic or nonlinear time history analysis. I tried to follow the SAP2000 API GUIDE example in MATLAB code but I can't get the correct results and only errors.

I will also copy the code here:

Code:
function Simulacion = SimSAP2000(DirModelo, NombModelo);

% Dirección completa del ejecutable de SAP2000 (SAP2000.exe)
% Determinar de acuerdo a la carpeta donde se instaló
ProgramPath = 'C:\Program Files\Computers and Structures\SAP2000 19\sap2000.exe';

% Dirección completa del ejecutable del archivo API DLL
% Determinar de acuerdo a la carpeta donde se instaló
APIDLLPath = 'C:\Program Files\Computers and Structures\SAP2000 19\sap2000v19.dll';


% Dirección completa del modelo SAP2000
% Determinar la dirección de nuestra carpeta contenedora de los modelos
ModelDirectory = 'C:\Resultados Simulación SAP2000';

if ~exist(ModelDirectory, 'dir')
   mkdir(ModelDirectory);
end

ModelPath = strcat(ModelDirectory, filesep, NombModelo);

% Creación de objeto auxiliar OAPI
a = NET.addAssembly(APIDLLPath);
helper = SAP2000v19.Helper;
helper = NET.explicitCast(helper,'SAP2000v19.cHelper');

% Creación de objeto SAP2000
SapObject = helper.CreateObject(ProgramPath);
SapObject = NET.explicitCast(SapObject,'SAP2000v19.cOAPI');
helper = 0;

% Comenzamos la aplicación SAP2000
SapObject.ApplicationStart;

% Creación del objeto ObjSAP2000
SapModel = NET.explicitCast(SapObject.SapModel,'SAP2000v19.cSapModel');

% Escoder ventana del objeto ObjSAP2000
% SapObject.Hide;

% Inicializar modelo SAP2000
ret = SapModel.InitializeNewModel;

% Apertura de modelo existente SAP2000
File = NET.explicitCast(SapModel.File,'SAP2000v19.cFile');
ret = File.OpenFile(strcat(DirModelo, filesep, NombModelo));

% Guardado de modelo SAP2000
ret = File.Save(ModelPath);

% Análisis de modelo SAP2000
Analyze = NET.explicitCast(SapModel.Analyze,'SAP2000v19.cAnalyze');
ret = Analyze.RunAnalysis();

% Obtención de resultados de modelo SAP2000
SapResult = zeros(7,1,'double');

AnalysisResults = NET.explicitCast(SapModel.Results,'SAP2000v19.cAnalysisResults');
AnalysisResultsSetup = NET.explicitCast(AnalysisResults.Setup,'SAP2000v19.cAnalysisResultsSetup');

ObjectElm = 0;
Element = 1; 
GroupElm = 2; 
SelectionElm = 3;

NumberResults = 0;
LoadCase = cellstr('');
Obj = cellstr(' ');
Elm = cellstr(' ');
PointElm = cellstr('');
StepType = cellstr(' ');
StepNum = reshape(0:1,2,1);
U1 = reshape(0:1,2,1);
U2 = reshape(0:1,2,1);
U3 = reshape(0:1,2,1);
R1 = reshape(0:1,2,1);
R2 = reshape(0:1,2,1);
R3 = reshape(0:1,2,1);

ret = SapModel.Results.JointDispl('ALL', GroupElm, NumberResults, Obj, Elm, LoadCase, StepType, StepNum, U1, U2, U3, R1, R2, R3)

% Cerrar modelo Sap2000
ret = SapObject.ApplicationExit(false());

[code]

I you have time please run the model (I also posted it).

Thanks again for your help.



[attach_link]http://files.engineering.com/getfile.aspx?folder=9090a002-190b-4942-b3cf-b702881428e4&file=SimSAP2000.m[/attach_link]
 
 http://files.engineering.com/getfile.aspx?folder=9090a002-190b-4942-b3cf-b702881428e4&file=SimSAP2000.m
Status
Not open for further replies.

Part and Inventory Search

Sponsor