SAP2000 API MatLab - Setting restraints
SAP2000 API MatLab - Setting restraints
(OP)
Hi,
does anybody know, why the following part of my codes doensn't work?
%% Add Restrains to Point K1
U1=true;
U2=true;
U3=true;
R1=true;
R2=true;
R3=true;
Restraint=[U1,U2,U3,R1,R2,R3];
ret = SapModel.PointObj.setRestraint('K1',Restraint)
I get the following MatLab error:
??? No appropriate method, property, or field setRestraint for
class Interface.AF6944AC_37D3_42A0_8C32_A8DE5E501EF0.
Thanks for your help
Mathias
does anybody know, why the following part of my codes doensn't work?
%% Add Restrains to Point K1
U1=true;
U2=true;
U3=true;
R1=true;
R2=true;
R3=true;
Restraint=[U1,U2,U3,R1,R2,R3];
ret = SapModel.PointObj.setRestraint('K1',Restraint)
I get the following MatLab error:
??? No appropriate method, property, or field setRestraint for
class Interface.AF6944AC_37D3_42A0_8C32_A8DE5E501EF0.
Thanks for your help
Mathias





RE: SAP2000 API MatLab - Setting restraints
Try this:
PointName1 = ' ';
PointName2 = ' ';
Restraint = logical(zeros(6,1));
for i = 1 : 6
Restraint(i,1) = true();
end
[ret, PointName1, PointName2] = SapModel.FrameObj.GetPoints('K1', PointName1, PointName2);
ret = SapModel.PointObj.SetRestraint(PointName1, Restraint);
Regards
RE: SAP2000 API MatLab - Setting restraints
Solved!!
Thanks for your help!
BR
Mathias
RE: SAP2000 API MatLab - Setting restraints
I am using Matlab2017a to interact with Sap2000. Now that my model is built, i want to add a load case for response spectrum. In the CSi OAPI help documentation, the function to do so is:
SapObject.SapModel.LoadCases.ResponseSpectrum.SetCase
I tried to call the fonction with the following syntax :
LoadCases = NET.explicitCast(SapModel.LoadCases,'SAP2000v18.cLoadCases');
ret = LoadCases.ResponseSpectrum.SetCase('Spec');
It keeps giving me errors that the syntax for this function isn't appropriate:
Error using MatSap (line 357)
No appropriate method, property, or field 'SetCase' for class 'SAP2000v18.wCaseResponseSpectrum'.
Can you help me with the syntax in matlab to Add a load case ?
RE: SAP2000 API MatLab - Setting restraints
NET.explicitCast refers to Visual Basic, therefore it does not run. Remove it.
Regards
RB
RE: SAP2000 API MatLab - Setting restraints
Actually the newest CSi OAPI documentation exemple for matlab uses it for ALL its functions !
Here is what a part of their example looks like:
%% create SapModel object
SapModel = NET.explicitCast(SapObject.SapModel,'SAP2000v18.cSapModel');
%% initialize model
ret = SapModel.InitializeNewModel;
%% create new blank model
File = NET.explicitCast(SapModel.File,'SAP2000v18.cFile');
ret = File.NewBlank;
%% define material property
PropMaterial = NET.explicitCast(SapModel.PropMaterial,'SAP2000v18.cPropMaterial');
ret = PropMaterial.SetMaterial('CONC', SAP2000v18.eMatType.Concrete);
%% assign isotropic mechanical properties to material
ret = PropMaterial.SetMPIsotropic('CONC', 3600, 0.2, 0.0000055);
%% define rectangular frame section property
PropFrame = NET.explicitCast(SapModel.PropFrame,'SAP2000v18.cPropFrame');
ret = PropFrame.SetRectangle('R1', 'CONC', 12, 12);
%% define frame section property modifiers
ModValue = NET.createArray('System.Double',8);
for i = 1 : 8
ModValue(i) = 1;
end
ModValue(1) = 1000;
ModValue(2) = 0;
ModValue(3) = 0;
ret = PropFrame.SetModifiers('R1', ModValue);
%% switch to k-ft units
ret = SapModel.SetPresentUnits(SAP2000v18.eUnits.kip_ft_F);
%% add frame object by coordinates
FrameObj = NET.explicitCast(SapModel.FrameObj,'SAP2000v18.cFrameObj');
FrameName1 = System.String(' ');
FrameName2 = System.String(' ');
FrameName3 = System.String(' ');
[ret, FrameName1] = FrameObj.AddByCoord(0, 0, 0, 0, 0, 10, FrameName1, 'R1', '1', 'Global');
[ret, FrameName2] = FrameObj.AddByCoord(0, 0, 10, 8, 0, 16, FrameName2, 'R1', '2', 'Global');
[ret, FrameName3] = FrameObj.AddByCoord(-4, 0, 10, 0, 0, 10, FrameName3, 'R1', '3', 'Global');
RE: SAP2000 API MatLab - Setting restraints
"No appropriate method, property, or field 'Count' for class 'SAP2000v19.wFrameObj'."
I want to extract total number of Frames, coordinates x,y and z, joint i, joint j, labels, and all result how displecement , Stress, but I do not get any properties again.
Do you can to help me ?
how the commands of OAPI SAP they work?
Do you have any example ?
RE: SAP2000 API MatLab - Setting restraints
"No appropriate method, property, or field 'Count' for class 'SAP2000v19.wFrameObj'."
I want to extract total number of Frames, coordinates x,y and z, joint i, joint j, labels, and all result how displecement , Stress, but I do not get any properties again.
Do you can to help me ?
how the commands of OAPI SAP they work?
Do you have any example ?