# Automation Workbench



# Introduction

<div id="bkmrk-simlab-composer-allo">SimLab Composer allows using Python, and Java Scripts to automate processes, both scripts automation is supported in two modes:</div><div id="bkmrk-">  
</div><div id="bkmrk-command-line-%28for-ba"><div><div>1. Command line (for batch processing a large number of files). This includes command line without scripting using -ie command, and with scripting using Python, and Java scripts.
2. Interactive mode (from inside the GUI of SimLab Composer)

</div></div></div>[![image.png](https://simlab-soft.com/help/uploads/images/gallery/2023-12/scaled-1680-/Mo1image.png)](https://simlab-soft.com/help/uploads/images/gallery/2023-12/Mo1image.png)

Scripting is supported in the **Ultimate edition** of SimLab Composer

### Command line without scripting

<div id="bkmrk-open-command-line-wi">Open the command line window, by typing "cmd" in Start. Go to the directory where SimLab Composer was installed, the default installation directory is "C:\Program Files\SimLab\SimLab Composer 10" to go there type **cd C:\\Program Files\\SimLab\\SimLab Composer 10** </div><div id="bkmrk--1">  
</div>[![image.png](https://simlab-soft.com/help/uploads/images/gallery/2022-09/scaled-1680-/KBaimage.png)](https://simlab-soft.com/help/uploads/images/gallery/2022-09/KBaimage.png)

<div id="bkmrk-to-run-import%2Fexport">Now to run import/export functions in SimLab Composer, type Sim.. then start clicking the Tab button, until SimLabComposer.exe appears. </div>[![image.png](https://simlab-soft.com/help/uploads/images/gallery/2022-09/scaled-1680-/kvOimage.png)](https://simlab-soft.com/help/uploads/images/gallery/2022-09/kvOimage.png)

<div id="bkmrk-type-in-the-code--ie">Type in the code -ie &lt;import_file&gt; &lt;export_file&gt;</div><div id="bkmrk--5">  
</div><div id="bkmrk-with-actual-files-lo">With actual file locations, the below line will convert RubikCube.obj 3D models into RubikCube.skp in the indicated folders. Don't forget " "</div><div id="bkmrk--6">  
</div>-ie "C:\\Users\\simlab\\Desktop\\Delete\\RubikCube.obj" "C:\\Users\\simlab\\Desktop\\Delete\\RubikCube.skp"

Check this **[article](https://vrforcad.com/approaches-to-automatically-do-things-with-simlab-composer)** for more ab out the command line-based methods, also for commands on Mac.

<div id="bkmrk--7"></div>### Command line Python Scripts

<div id="bkmrk-python-scripts-can-b"><div><div>Python scripts can be run from the command line using the following command</div><div>  
</div></div></div>```
SimLabComposer.exe -py “File.py”
```

<div id="bkmrk-so-if-the-user-named"><div><div>So if the user named a script as example.py, and saved it in folder C:\Scripts, The user should use the following command</div><div>  
</div></div></div>```
SimLabComposer.exe -py “C:\Scripts\example.py”
```

#### Passing arguments to Python Scripts

Passing arguments to a script makes it dynamic, and reusable without the need to change its code.

```
	
scene =Scene()
runtime =RunTime()
scene.reset()
fileName= runtime.args.getAsString("-path")
scene.importFile(fileName)
```

#### Interactive Scripting - Running Python script interactively

The user can run Python Scripts interactively in different ways:

1. Select a script from the scripting library, drag it, and drop it on the 3D area [![image.png](https://simlab-soft.com/help/uploads/images/gallery/2022-09/scaled-1680-/o48image.png)](https://simlab-soft.com/help/uploads/images/gallery/2022-09/o48image.png)
2. Select a script from the library, then from the Script menu, click Run [![image.png](https://simlab-soft.com/help/uploads/images/gallery/2022-09/scaled-1680-/Fe1image.png)](https://simlab-soft.com/help/uploads/images/gallery/2022-09/Fe1image.png)
3. Select the node/geometry to Isolate from the 3D area or the Object Tree, then click OK.

[ ![image.png](https://simlab-soft.com/help/uploads/images/gallery/2022-11/scaled-1680-/image.png) ](https://simlab-soft.com/help/uploads/images/gallery/2022-11/image.png)[ ](https://simlab-soft.com/help/uploads/images/gallery/2022-11/x8Pimage.png)[ ](https://simlab-soft.com/help/uploads/images/gallery/2022-11/x8Pimage.png)

[ ![image.png](https://simlab-soft.com/help/uploads/images/gallery/2022-11/scaled-1680-/x8Pimage.png)](https://simlab-soft.com/help/uploads/images/gallery/2022-11/x8Pimage.png)

#### My first Python script / Python Scripts using GUI input

The following script gets the location to save the rendered image, using a GUI dialog. Renders the current scene, saves the resulting image in the selected location, and finally displays a dialog indicating that rendering is done.

```
from simlabpy import *

scene = Scene()
runtime = RunTime()
render_path = runtime.ui.getSaveFileName("Exported rendered image location:", "", "*.jpg;;*.png")
scene.render(render_path)
runtime.ui.alert("Rendered image was created.")
```

For a list of supported Python scripting commands visit this [page](https://www.simlab-soft.com/3d-products/docs/help/scripting/English/Python-Scripting-Documentation/index.html)

<p class="callout info">Check out a blog about [the approaches to automatically do things with SimLab Composer](https://blog.simlab-soft.com/approaches-to-automatically-do-things-with-simlab-composer/).</p>

[![image.png](https://simlab-soft.com/help/uploads/images/gallery/2022-12/scaled-1680-/L9rimage.png)](https://blog.simlab-soft.com/approaches-to-automatically-do-things-with-simlab-composer/)

# Visual Scripting

Visual Scripting in SimLab Composer is a tool created to minimize the programming effort for non-technical users with no coding skills. Therefore, instead of writing the computer code in a text editor, the Visual Scripting tool allows the user to develop her\\his desired programs via block diagrams using a graphical user interface. This makes the code easier to be written as well as to be understoodز Any designer, artist, or animator reading the diagrams can quickly grasp the flow of logic therein.

### Getting Started

Select Visual Scripting from the automation workbench, the window shown below will appear with the following main parts:

<div class="p" id="bkmrk-%C2%A01%29-%C2%A0-%C2%A0-options-for-"><span class="de_8D14AB4A83"> **1**) Options to ‘Run’ the existing flow, ‘Create’ a new flow, ‘Open’, or ‘Save’ flows.</span></div><div class="p" id="bkmrk-%C2%A02%29-%C2%A0-%C2%A0-the-%E2%80%98main-ob"><span class="de_8D14AB4A83"> **2**) The Main Object Groups Bar, which includes the category titles of all the available sources and functions.</span></div><div class="p" id="bkmrk-%C2%A03%29-%C2%A0-%C2%A0-for-each-%E2%80%98ob"><span class="de_8D14AB4A83"> **3**) For each Object Group, corresponding ‘Sources’ and ‘Functions’ are available.</span></div><div class="p" id="bkmrk-%C2%A04%29-%C2%A0-%C2%A0-the-%E2%80%98work-sp"><span class="de_8D14AB4A83"> **4**) The ‘Work Space’, where blocks can be dragged, dropped, and linked to create the desired flow charts.</span></div><div class="p" id="bkmrk-"></div>[![drex_first_topic_screen.png](https://simlab-soft.com/help/uploads/images/gallery/2022-09/scaled-1680-/aGydrex-first-topic-screen.png)](https://simlab-soft.com/help/uploads/images/gallery/2022-09/aGydrex-first-topic-screen.png)

Any flow in the Visual Scripting should consist of three main components: source, smart block, and connections.

A) Source: Sources are used to define file paths and/or 3D nodes to be used as inputs for different blocks in the diagram. Users can find several source types in the sources tab.  
   
B) Block: Blocks are basically functions that (can) take inputs and produce outputs. Each block performs a single process, for example, the block on the left side in the previous figure takes an integer number as input and converts it to a string as an output. Users can find several block types categorized into different tabs throughout the <span class="de_8D14AB4A83">Main Object Groups Bar</span>.  
   
C) Connections: Connections are used to make the whole flowchart meaningful by linking sources and blocks. They thus define which sources and blocks are connected, accordingly, they arrange the execution order of the block diagram. The green parts on the blocks are not essential but they are very important to ensure the right execution order and to create dependencies between the blocks. To make the process easier for users. Ports on each block are colored based on the data type that should be passed through them.  
   
After completing the flow diagram, hit the run button to start the execution, and a pop-up message will appear once the execution completes. Flowcharts can be saved and shared to be used in different projects.

To learn more about Visual Scripting in SimLab Composer, check the tutorial below, and visit the SimLab Visual Scripting web **[page](https://www.simlab-soft.com/technologies/simlab-visual-scripting.aspx)**

<iframe allowfullscreen="allowfullscreen" height="314" src="https://www.youtube.com/embed/yROPc90VFGk" width="560"></iframe>