(您需要在计算机中安装MATLAB和ETABS才能运行示例)
我开始使用API MATLAB-ETABS,我发现了一个错误,我希望你可以帮我解决,接下来你会找到这个例子的代码:
clc, clear all, close all
NumberResults = NaN;
Obj = cellstr(' ');
Elm = cellstr(' ');
LoadCase = cellstr(' ');
StepType= cellstr(' ');
StepNum=NaN;
F1=zeros(1,1,'double');
F2=zeros(1,1,'double');
F3=zeros(1,1,'double');
M1=zeros(1,1,'double');
M2=zeros(1,1,'double');
M3=zeros(1,1,'double');
% 'create ETABS object
EtabsObject = actxserver('CSI.ETABS.API.ETABSObject')
% 'start ETABS application
ret = EtabsObject.ApplicationStart()
% 'create SapModel object
SapModel = EtabsObject.SapModel
% 'initialize model
ret = SapModel.InitializeNewModel()
% 'create steel deck template model
ret = SapModel.File.NewSteelDeck(4,12,12,4,4,24,24)
% 'run analysis
System.IO.Directory.CreateDirectory('c:\CSI_API_temp')
ret = SapModel.File.Save('C:\CSI_API_temp\example.edb')
ret = SapModel.Analyze.RunAnalysis
% 'deselect all cases and combos
ret = SapModel.Results.Setup.DeselectAllCasesAndCombosForOutput
% 'set case selected for output
ret = SapModel.Results.Setup.SetCaseSelectedForOutput('DEAD')
% 'get point displacements
ret = SapModel.Results.JointReact('1',1,NumberResults, Obj, Elm, LoadCase, StepType, StepNum, F1, F2, F3, M1, M2, M3)
% 'close ETABS
EtabsObject.ApplicationExit(1)
% 'clean up variables
clearvars SapModel EtabsObject
如果您运行该代码,将在您的命令窗口中显示:
No method 'JointReact' with matching signature found for class
'Interface.ETABS_2015_Application_Programming_Interface__API_.cAnalysisResults'.
我在VBA-ETABS中有类似的问题,当我将“NumberResults”更改为整数值时,我的问题就解决了。另外,我建议你使用“SelectionElm”作为“eItemTypeElm”。
设置两个应用程序以管理员身份运行
你的问题将得到解决
我尝试了同样的方法,它对我有用,希望它适合你。