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

조회 수: 4 (최근 30일)
Ali
Ali 2024년 12월 18일
답변: UDAYA PEDDIRAJU 2024년 12월 27일
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

답변 (1개)

UDAYA PEDDIRAJU
UDAYA PEDDIRAJU 2024년 12월 27일
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?

카테고리

Help CenterFile Exchange에서 QSP, PKPD, and Systems Biology에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by