Here is a less elegant approach to assigning materials families. I have a limited and known set of aerospace alloys I am trying to transfer from an internal materials database into HyperSizer.
I use a GUI for materials input, so my variable names are a bit odd, but what follows is my code.
handles.inputdata.name = name;
switch (name)
case {'Aluminum 2024', 'Aluminum 7075-T6'};
handles.inputdata.MaterialFamily = 'Aluminum';
case {'Stainless Steel 304 full hard', 'Maraging steel','A-286',...
'Stainless Steel 316 quarter hard'};
handles.inputdata.MaterialFamily = 'Steel';
case 'Narloy-Z'
handles.inputdata.MaterialFamily = 'Copper';
case {'Ti-6Al-4V', 'Ti 6Al 2Sn 4Zr 2Mo'}
handles.inputdata.MaterialFamily = 'Titanium';
case {'Inconel 718', 'Rene 41', 'Inconel 625', 'Haynes 230'}
handles.inputdata.MaterialFamily = 'Heat-Resistant Alloys';
otherwise
handles.inputdata.MaterialFamily = 'Miscellaneous Isotropic';
end
% Then, some time later
isotropic = hs.Isotropic.GetIsotropic('Al 2024'); %Identify existing material
isotropic.MaterialName = handles.inputdata.name;{1}% change the name
isotropic.MaterialFamily = handles.inputdata.MaterialFamily;
One could conceivably use parsing logic to automate a similar process for a larger group of materials. For example, look for the string 'steel' anywhere in the material name (put that in the Steel material family), or look at the first two letters, putting Ti into the titanium material family, Mg or Ma in the magnesium material family (you would want to eliminate the steels by putting that case first, so Maraging steel doesn't end up in the Magnesium family)
-neergaard