News: HyperSizer.com has a Community Board and Customer Support System. Submit a ticket at http://hypersizer.com/ticket

Author Topic: Material allowables  (Read 22849 times)

adeschenes

  • Client
  • **
  • Posts: 4
    •  
Material allowables
« on: November 14, 2012, 12:01:00 AM »
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

  • Administrator
  • *****
  • Posts: 145
    •  
Re: Material allowables
« Reply #1 on: November 14, 2012, 09:29:29 AM »
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: [Select]
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

-Ryan

adeschenes

  • Client
  • **
  • Posts: 4
    •  
Re: Material allowables
« Reply #2 on: November 14, 2012, 02:19:29 PM »
Thank you.  Answers my questions. 

Neergaard

  • Client
  • **
  • Posts: 20
    •  
Re: Material allowables
« Reply #3 on: January 06, 2015, 01:09:54 PM »
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

  • Administrator
  • *****
  • Posts: 145
    •  
Re: Material allowables
« Reply #4 on: January 06, 2015, 08:56:10 PM »
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

Neergaard

  • Client
  • **
  • Posts: 20
    •  
Re: Material allowables
« Reply #5 on: January 07, 2015, 01:24:19 PM »
Good to know.