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.
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"
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 #
Synergy.ExportStructuralFiles "PATH",#, ELEMENT DELETION, 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, the ELEMENT DELETION parameter determines whether or not to enable element deletion (when Abaqus is used), and the RESIDUAL STRAINS parameter determines whether or not to export residual strains to the .sif file.
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