Share

Advanced Material Exchange API

Advanced Material Exchange offers an Application Programming Interface (API) which can be used to automate parts of your workflow. The API is accessed through a script named API.vbs. The details of this script are given below.

To run the API.vbs script:

  1. Open a command prompt
  2. Navigate to the directory containing the API.vbs script
  3. Enter API.vbs to execute the script
Note: The first time you run the API.vbs script with a new version of Advanced Material Exchange you will need to do the following before completing steps 1-3 above:
  1. Open a command prompt as an administrator
  2. Navigate to the installation directory for Advanced Material Exchange (usually C:\Program Files\Helius PFA 20XX\ame\bin)
  3. Enter ame.exe /unregister in the command prompt to unregister the OLE interface
  4. Enter ame.exe /register in the command prompt to register the OLE interface

Available Keywords

Option Explicit

The Option Explicit keyword requires that all variables be explicitly declared with the Dim or ReDim keyword. When the Option Explicit keyword is used, any variable that is used before being declared will cause an error. It is recommended to use this keyword as it can reduce programming errors.

SetLocale("en-us")

When the SetLocale("en-us") keyword is present, it forces non-English systems to interpret numerical values in the en-us format. If this keyword is not included, numerical values are interpreted in the system's native language.

Dim Synergy
Set Synergy = CreateObject("ame.Synergy')

These two lines create an OLE automation object which starts the version of Synergy (the Advanced Material Exchange user interface) that was most recently run. Only one version of Synergy can be run at any time.

Synergy.SetUnits "SYSTEM"

Where the SYSTEM parameter can be set to:

  • ENGLISH - use the US unit system
  • METRIC - use the Metric unit system
Synergy.OpenProject "PATH"

Where the PATH parameter specifies the full directory path to the saved project (ex. "C:\AME\project.mps"). This keyword will open the project specified.

Synergy.MapStructuralResults

This keyword is used to map the results from the Moldflow analysis to the structural model. The models must be aligned before using this keyword (make sure the alignment.res file is present in the working directory).

Synergy.SelectMaterialModel #

Where the # parameter is used to select the material model. # can be set to:

  • 0 - Linear Elastic material model
  • 1 - Elastic-Plastic material model
Synergy.ExportStructuralFiles "PATH",#,RESIDUAL STRAINS

Where the PATH parameter specifies the full directory path and file name for the input file to be exported (ex. "C:\AME\project.inp"), the # parameter identifies the material environment to select, and the RESIDUAL STRAINS parameter determines whether or not to export residual strains to the .sif file.

# can take the following values:

  • 0 - Don't select a material environment. Use this option in conjunction with the Linear Elastic material model.
  • 1 - Select the first material environment.
  • 2 - Select the second material environment.

RESIDUAL STRAINS can take the following values:

  • True - Enable the output of residual strains to the .sif file
  • False - Disable the output of residual strains

Example API Script

The script below will open an existing Advanced Material Exchange project, map the results to the structural model, select the elastic-plastic material model with the 1st material environment, and export results.

'@
'@ Open project, map results, choose material model, choose environment, export
'@ 
'@
'@@ 
Option Explicit
SetLocale("en-us")
Dim Synergy
Set Synergy = CreateObject("ame.Synergy")
Synergy.SetUnits "METRIC"

Synergy.OpenProject "C:\Testing\example.mps"
Synergy.MapStructuralResults
Synergy.SelectMaterialModel 1
Synergy.ExportStructuralFiles "C:\Testing\example.inp",1, False, False

'
' Put remainder of code here.
' 
MsgBox "Script Complete"
Wscript.Quit

Was this information helpful?