idinhobbollahi
Civil/Environmental
- Aug 2, 2014
- 2
hi Im new in OAPI , i cant exract farme force in code, and all the time isee erorr, plz help if any one have any code or idea,
my code
close all
clc
% Link Sap2000 and matlab for passing one-dimensional arrays
feature('COM_SafeArraySingleDim', 1);
% Link Sap2000 and matlab for passing non-scalar arrays by reference
feature('COM_PassSafeArrayByRef', 1);
% Create Link Between Matlab and SAP
SapObject = actxserver('Sap2000v15.SapObject');
% Start SAP
SapObject.ApplicationStart;
% Create SAP Model
SapModel = SapObject.SapModel;
% initialize model
ret = SapModel.InitializeNewModel;
%open an existing file
ret = SapObject.SapModel.File.OpenFile('C:\API\idin2');
% Run model (this will create the analysis model)
ret = SapModel.Analyze.RunAnalysis();
ret = SapObject.SapModel.Results.Setup.DeselectAllCasesAndCombosForOutput;
ret = SapObject.SapModel.Results.Setup.SetCaseSelectedForOutput('DEAD');
Name = '38';
Element = 1;
NumberResults = 0;
(Object);
ObjSta = zeros(1,1,'double');
(Elm );
ElmSta = zeros(1,1,'double');
(LoadCase);
(StepType);
StepNum = zeros(1,1,'double');
P = zeros(1,1,'double');
V2 = zeros(1,1,'double');
V3 = zeros(1,1,'double');
T = zeros(1,1,'double');
M2 = zeros(1,1,'double');
M3 = zeros(1,1,'double');
[ret, NumberResults, Obj, ObjSta, Elm, ElmSta, LoadCase, StepType, StepNum, P, V2, V3, T, M2, M3] = SapObject.SapModel.Results.FrameForce(Name, Element, NumberResults, Obj, ObjSta, Elm, ElmSta, LoadCase, StepType, StepNum, P, V2, V3, T, M2, M3);
my code
close all
clc
% Link Sap2000 and matlab for passing one-dimensional arrays
feature('COM_SafeArraySingleDim', 1);
% Link Sap2000 and matlab for passing non-scalar arrays by reference
feature('COM_PassSafeArrayByRef', 1);
% Create Link Between Matlab and SAP
SapObject = actxserver('Sap2000v15.SapObject');
% Start SAP
SapObject.ApplicationStart;
% Create SAP Model
SapModel = SapObject.SapModel;
% initialize model
ret = SapModel.InitializeNewModel;
%open an existing file
ret = SapObject.SapModel.File.OpenFile('C:\API\idin2');
% Run model (this will create the analysis model)
ret = SapModel.Analyze.RunAnalysis();
ret = SapObject.SapModel.Results.Setup.DeselectAllCasesAndCombosForOutput;
ret = SapObject.SapModel.Results.Setup.SetCaseSelectedForOutput('DEAD');
Name = '38';
Element = 1;
NumberResults = 0;
(Object);
ObjSta = zeros(1,1,'double');
(Elm );
ElmSta = zeros(1,1,'double');
(LoadCase);
(StepType);
StepNum = zeros(1,1,'double');
P = zeros(1,1,'double');
V2 = zeros(1,1,'double');
V3 = zeros(1,1,'double');
T = zeros(1,1,'double');
M2 = zeros(1,1,'double');
M3 = zeros(1,1,'double');
[ret, NumberResults, Obj, ObjSta, Elm, ElmSta, LoadCase, StepType, StepNum, P, V2, V3, T, M2, M3] = SapObject.SapModel.Results.FrameForce(Name, Element, NumberResults, Obj, ObjSta, Elm, ElmSta, LoadCase, StepType, StepNum, P, V2, V3, T, M2, M3);