Greetings
I am trying to change the data in an existing material description card, then save it with a different name. The tricky bit is I want to script the exercise because I have all the data in a MATLAB datastructure. I am using MATLAB R2012b in a Windows Pro 64 bit environment. I found the MATLAB example for addressing and changing temperature-dependent materials properties in the help documentation (help/Scripting/Reference/Classes/Isotropic)
. I have somehow messed it up
.
My code looks like this:
% Check for bad path. Must be absolute.
databasePath = handles.inputdata.Path;
projectName = handles.inputdata.Project;
if exist(databasePath, 'file') ~= 2
error([
'The database does not exist. ', databasePath])
end
% Launch HyperSizer.exe.
hs = actxserver('HyperSizer.Application');
while(hs.AutomationMode == false)
hs = actxserver('HyperSizer.Application');
end hs.Login(
'HyperSizer Admin', '');
hs.OpenDatabase(databasePath);
% Open project (if exists).
projects = hs.Projects;
if ~projects.Contains(projectName)
error(['Project does not exist. ', projectName])
end
project = projects.GetProject(projectName);
Mat_db = PASS.material_db.mat(1,handles.inputdata.Mat_Ix);
FtyLV = Mat_db.Fty.v * handles.inputdata.FtyL / handles.inputdata.FtyT;
FcyLV = Mat_db.Fcy.v * handles.inputdata.FcyL / handles.inputdata.FcyT;
FtuLV = Mat_db.Ftu.v * handles.inputdata.FtuL / handles.inputdata.FtuT;
% Create new material
isotropic = hs.Isotropic.GetIsotropic('Al 2024');
%Identify existing material isotropic.MaterialName = handles.inputdata.name{1};
% change the name %Load data from handles.inputdata to the new material
isotropic.Basis = handles.inputdata.allowables{1};
isotropic.Density = handles.inputdata.density;
isotropic.FemMaterialId = handles.inputdata.mat_num;
isotropic.Form = handles.inputdata.form;
isotropic.Note = [handles.inputdata.Additional_comments{1},...
' valid for thicknesses between ', num2str(handles.inputdata.Min_range),...
' and ', num2str(handles.inputdata.Max_range)];
isotropic.Temper = handles.inputdata.temper;
isotropic.Specification = handles.inputdata.spec;
isotropic.ThicknessRange = handles.inputdata.Max_range;
for ii = 1:double(isotropic.Temperatures.Count)%Num_Temps
% isoTemp = isotropic.Temperatures(ii);
isoTemp = get(isotropic.Temperatures, 'Item', ii);
isoTemp.FtuL = FtuLV(ii);
end
The important bits look like this:
% Launch HyperSizer.exe.
hs = actxserver('HyperSizer.Application');
while(hs.AutomationMode == false)
hs = actxserver('HyperSizer.Application');
end
hs.Login(
'HyperSizer Admin', '');
hs.OpenDatabase(databasePath);
% Create new material
isotropic = hs.Isotropic.GetIsotropic('Al 2024');
%Identify existing material
…
for ii = 1:double(isotropic.Temperatures.Count)%Num_Temps
% isoTemp = isotropic.Temperatures(ii);
isoTemp = get(isotropic.Temperatures,
'Item', ii);
isoTemp.FtuL = FtuLV(ii);
end
which is almost verbatim from the MATLAB example. When I get to the isoTemp line, I get the following error message:
K>> isoTemp = get(isotropic.Temperatures, 'Item', i);
Error using
Interface.E8DEE168_BAF1_41A1_8297_CA2E08A2D218/get
Invoke Error: Incorrect number of arguments
On the other hand, with HyperSizer 7.0 there is a new way to invoke collection classes (help/Scripting/Release Notes/Version 7.0). When I use that vocabulary, I have success until I proceed to the next line, where I get the following error:
K>> isoTemp.FtuL = FtuLV(ii);
No public field FtuL exists for class
Interface.E8DEE168_BAF1_41A1_8297_CA2E08A2D218.
What modifications should be made to the MATLAB example so it will run with HyperSizer 7.0.54?