trying to change the labels of my selected joints in etabs, but I am getting the following error

19 views (last 30 days)
try
% Connect to ETABS
ETABSObject = actxserver('CSI.ETABS.API.ETABSObject');
% Attempt to access the SapModel property to check if ETABS is open
SapModel = ETABSObject.SapModel;
% Prompt the user to select joints in ETABS
msgbox('Please manually select the joints in ETABS to rename.', 'Info', 'modal');
pause(5); % Allow time for user to select joints
% Get the selected joints
selectedJoints = SapModel.SelectObj.GetAllPoints;
% Check if any joints are selected
if isempty(selectedJoints)
error('No joints selected. Please select joints in ETABS before running the script.');
end
% Sort the selected joints by their current labels
[~, idx] = sort({selectedJoints.Name});
selectedJoints = selectedJoints(idx);
% Rename joints to consecutive labels (1 to 1500)
for i = 1:length(selectedJoints)
newLabel = num2str(i);
SapModel.PointObj.SetLabel(selectedJoints(i).Name, newLabel);
disp(['Joint ' selectedJoints(i).Name ' renamed to ' newLabel]);
end
I am getting this error,
Error: Undefined function 'GetAllPoints' for input arguments of type 'Interface.CSi_Application_Programming_Interface__API__v1_cSelect'.

Answers (1)

Abhishek Chakram
Abhishek Chakram on 12 Feb 2024
Hi Abdirahman Yasin,
The error message you are encountering in your MATLAB script indicates that the function “GetAllPoints” is not recognized for the input argument of type “Interface.CSi_Application_Programming_Interface__API__v1_cSelect”. Here are few ways to troubleshoot the issue:
  • Instead of using “GetAllPoints”, consider using the “GetSelected” method to retrieve selected objects.
% Get the selected joints
selectedJoints = SapModel.SelectObj.GetSelected;
  • Ensure that you are using the correct version of the ETABS API. If you’re using an older version, consider updating to a newer one.
I hope this helps!
Best Regards,
Abhishek Chakram

Tags

Community Treasure Hunt

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

Start Hunting!