how to change hinge to existing defined hinge in sap2000 model by SM toolbox

4 views (last 30 days)
I have defined hinges in existing sap2000 model and I opend this model by matlab using SM toolbox and I thave tried to change the assigned hinges with another defined hinges but I did not find any code using SM toolbox codes

Answers (1)

UDAYA PEDDIRAJU
UDAYA PEDDIRAJU on 27 Dec 2024
Hi Ali,
The following code might help you:
SapObject = actxserver('SAP2000.SapObject');
% Start Sap2000 application
SapObject.ApplicationStart;
Sap = SapObject.SapModel;
Sap.File.OpenFile([FilePath,'.sdb'])
% Define the hinge properties
oldHingeName = 'OldHinge'; % Name of the existing hinge
newHingeName = 'NewHinge'; % Name of the new hinge to assign
% Get the number of hinges in the model
numHinges = Sap.Hinges.Count;
% Loop through each hinge to change it
for hingeIndex = 1:numHinges
% Get the hinge name
[hingeName, ~] = Sap.Hinges.GetName(hingeIndex);
% Check if it matches the old hinge name
if strcmp(hingeName, oldHingeName)
% Change the hinge to the new hinge
Sap.Hinges.SetHinge(hingeIndex, newHingeName);
end
end
% close Sap2000
SapObject.ApplicationExit(false());
SapModel = 0;
SapObject = 0;
If the above workaround doesn't help, you may need to check the following query with similar details: https://www.mathworks.com/matlabcentral/answers/2062232-how-can-i-edit-the-hinges-already-previously-created-in-the-object.
Let me know if anything works for you?

Categories

Find more on Modeling in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!