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!

*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.

Jobs

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

RE: SAP2000 API MatLab - Setting restraints

hi! Mathias

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

(OP)
Dear ricbus,

Solved!!

Thanks for your help!

BR
Mathias

RE: SAP2000 API MatLab - Setting restraints

Hi guys,

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

Hi Ushaann

NET.explicitCast refers to Visual Basic, therefore it does not run. Remove it.

Regards

RB

RE: SAP2000 API MatLab - Setting restraints

Hello ricbus,

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

My name is Waldy Torres, studen of master degree in Mechanical computational, i am trying to converse SAP2000 with Matlab, for optimization free form, but the help the commands of OAPI SAP it not works to matlab, mainly all commands get, Count.... the next message is shown
"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

My name is Waldy Torres, studen of master degree in Mechanical computational, i am trying to converse SAP2000 with Matlab, for optimization free form, but the help the commands of OAPI SAP it not works to matlab, mainly all commands get, Count.... the next message is shown
"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 ?

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


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close