simetrix.script.runScript

simetrix.script.runScript(script: str, arguments: list[ArrayLike | str | float | complex | GroupVector]) bool

Runs a SIMetrix script and returns True if successful otherwise False.

Parameters:
  • command (str) – SIMetrix script name.

  • arguments – Arguments to the script. See details below.

Arguments Parameter

This is a list of up to 16 objects which can be any of these types:

  • Scalar integer, float, string or complex values. These can be literal constants or passed as a Python variable.

  • List of integer, float, string or complex values. These can be literal constants or passed as a Python variable.

  • simetrix.GroupVector object. This can be used to pass a value to the script by reference. See below.

Any combination of the above items may be passed.

Passing by Reference

To pass data by reference to a SIMetrix script, create a variable using the getVariable() function and prefix its name with ‘@’. In the SIMetrix script the corresponding argument must also be prefixed with ‘@’. For example:

Python script:

import simetrix.script as scr

arg_a = scr.getVariable("@arg_1")

scr.runScript("my_script.sxscr", [arg_a])

print(arg_a.yreal)
SIMetrix script:

Arguments @arg_a

Let arg_a = [1,2,3,4]

The above will print:

[1.0, 2.0, 3.0, 4.0]