AmesimKnowledge

The File menu

Generate model script

Scripting menu

The File > Generate model script menu provides the following functions:

  • Python Generate Python script file

  • C++ Generate CPP source file

  • Visual Basic for Applications Generate VBA script file

These functions are related to the Simcenter Amesim API. They generate Python, C or VBA code corresponding to the currently-active system.

This function has been created to save you time during API script creation. Instead of writing a script from scratch, you can create your system with Simcenter Amesim, then launch the scripting function, which creates a script skeleton for you.

Note

Scripts generated from systems created with older versions of Simcenter Amesim (prior to 7.0) will work, but will not contain rotation and flip instructions.

For more information, please consult the Simcenter Amesim API manual.

Warning

When you generate a script file for a Simcenter Amesim model, if that model contains unsupported features (such as statecharts, bus junctions or linear analysis) the generated script will ignore the unsupported feature. The features supported by script generation are listed in the table below.

Supported Feature Python VBA C
Create circuit
Add component to circuit
Create empty supercomponent
Add port to supercomponent
Add dynamic component
Set remote port tag
Rotate component
Flip component
Move component
Set a submodel
Connect two ports
Connect two ports with a line
Connect supercomponent port to a constituent of this supercomponent
Add global parameters
Insert text in supercomponent
Set parameter value
Set run parameter value
Save and close circuit
Generate model code and compile it
Save variable results at next simulation run
Lock variable
Create global parameter group
Expand global parameter group
Add text item
Add interface block X

Source: https://docs.sw.siemens.com/en-US/doc/254352342/PL20250521841123434.amesim_collection.Reference/xid874398 · retrieved 2026-07-17