Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

SAP2000 API getnamelist [matlab]

Status
Not open for further replies.

sherby88

Structural
Apr 2, 2013
1
hi guys,
I'm working on a project and I need to get all the point names (because SAP doesen't name points in an order) from the SAP model in matlab so i can use them after that.

My code so far in this section is:

feature('COM_SafeArraySingleDim', 1);
feature('COM_PassSafeArrayByRef', 1);
SapObject = actxserver('Sap2000v15.SapObject');
SapObject.ApplicationStart;
Sap = SapObject.SapModel;
% open and run file
ret = Sap.File.OpenFile('F:\Faculta\_Dizertatie\matlab\DDBD\SAP\exemplu cadru.sdb');
ret = Sap.Analyze.RunAnalysis();
countP= Sap.PointElm.Count;
PCTs= zeros(1,1); (I tried alot here, but haven't found the right one)
[ret,PCTs] = Sap.FrameObj.GetNameList(countP,PCTs);

The count is getting the corect number of points but I don't get the list of point names
And i also have a question, what is the diference between element and object (point, frame...)

I keep getting as a result => rect = 0 ; PCTs = 104
If someone can tell me what am i doing wrong I will be verfy gratefull.
 
Replies continue below

Recommended for you

Hi,

Did you try this?

[ret,NumberPointObjects,PointObjNames]=SapModel.PointObj.GetNameList(0,0);

That should do it
 
Hi Friends,
I'm using Sap2000 OAPI from Matlab
now I know how to open, run, save, hide, close
ie, this is my code,

%% clean-up the workspace & command window
clear;
clc;
%% 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 Sap2000 object
SapObject = actxserver('sap2000v15.SapObject');
%% start Sap2000 application
SapObject.ApplicationStart;
%% create SapModel object
Sap = SapObject.SapModel;
%% Hide Application, Hide <=> Visible
% SapObject.Hide;
%% open file
Sap.File.OpenFile('C:\Users\BRNS 1_8 WITH INFILL WITH OPENING MESHING.sdb');
%% run model (this will create the analysis model)
Sap.Analyze.RunAnalysis();
%% save model
Sap.File.Save('C:\Users\BRNS 1_8 WITH INFILL WITH OPENING MESHING.sdb');
%% close Sap2000
SapObject.ApplicationExit(false());
SapModel = 0;
SapObject = 0;

%% END

this working properly. but I don't know how to edit time history value(functn), load case, area edge constrains and how I can get result like frequency, so please help me to get those results...

%% get modal period
NumberResults = 'As Long';
LoadCase = 'As String';
StepType = 'As String';
StepNum = 'As Double';
Period = 'As Double';
Frequency = 'As Double';
CircFreq = 'As Double';
EigenValue = 'As Double';

Sap.Results.ModalPeriod(NumberResults, LoadCase, StepType, StepNum, Period, Frequency, CircFreq, EigenValue)

%% END

I used this to get frequency but it showing some error like this

No method 'ModalPeriod' with matching signature found for class
'Interface.020E9225_C884_4E04_ABD2_B91D15E6A45B'.

Error in my_sap_working (line 45)
Sap.Results.ModalPeriod(NumberResults, LoadCase, StepType, StepNum, Period, Frequency, CircFreq, EigenValue)


I found some people used $2k file, how use that? please help me...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor