Software Use > Scripting

Material allowables

(1/2) > >>

adeschenes:
I would like to be able to modify the material allowables (FtuL, FtyL, etc)for isotropic materials.  I can identify the material keys, but cannot find any method to tie a material of interest to the oHS.IsotropicTemperatureCol level. Is there a method to hook them up?

Thank you,

Ryan:
Once you have the isotropic object, use isotropic.Temperatures to get a collection (Col) of all the temperature dependent data (IsotropicTemperature). I've posted a MATLAB example in the online help.

http://hypersizer.com/help/index.php#COM/Object/Isotropic.php


--- Code: ---function ModifyIsotropicMaterial(databasePath, materialName)

    hs = actxserver('HyperSizer.Application');

    while(hs.AutomationMode == false)
        hs = actxserver('HyperSizer.Application');
    end

    hs.Login('HyperSizer Admin', '');
    hs.OpenDatabase(databasePath);
   
    key = FindMaterialKeyByName(hs.Isotropics, materialName);
   
    isotropic = get(hs.Isotropics, 'Key', key);
   
    for i = 1:double(isotropic.Temperatures.Count)
       isoTemp = get(isotropic.Temperatures, 'Item', i);
       isoTemp.FtuL = 25e3; % psi
    end
   
    isotropic.Save();

end


function key = FindMaterialKeyByName(materialCol, materialName)

    for i = 1:double(materialCol.Count)

        material = get(materialCol, 'Item', i);
       
        if strcmp(material.MaterialName, materialName)           
            key = material.Key;
            return
        end           
    end
   
    error('Material was not found. %s', materialName)

end
--- End code ---

-Ryan

adeschenes:
Thank you.  Answers my questions. 

Neergaard:
Gentlemen

This is a very clever trick. :) 

I have done this, and run into a unit conversion problem.  I wrote my new materials data in MKS units, and when I opened the material card in HyperSizer for browsing, I found that the units were English - (density > 4000 lbm/ft^3? ::)). 

Were I doing this manually, I would set the units toggle at the top of the page to SI before adding data.  Is there a command to script this (preferably in Matlab code)? 

Alternately, can I trust that the units will always be English if I don't intentionally set them to SI?

In other news, don't forget that the command to address a specific item in a temperature collection has changed from
isotemp = get(isotropic.Temperatures, 'Item', i) to
isotemp = isotropic.Temperatures.Item(i) in version 7.0.

-neergaard

Ryan:
The scripting API is limited to English units only. So if you are using MKS units, it is up to you to do the conversion.

The collection semantics have change in 7.0 to make it easier for MATLAB users. Check out the 7.0 release notes for more details.
http://hypersizer.com/help/#COM/com-release_notes.php

-Ryan

Navigation

[0] Message Index

[#] Next page

Go to full version