SimLab Python API Documentation
The SimLab Python API (simlabpy) provides comprehensive programmatic control over SimLab Composer, enabling automation of 3D workflows, batch processing, and custom tool development.
Scriptology
🛠️ General Tips for Python Scripting in SimLab Composer
Before diving into custom Python utilities for SimLab Composer, keep these essentials in mind:
- Always start your script with:
from simlabpy import *
- Python does not require a semicolon (
;
) at the end of statements. - For comments:
- Use
#
for single-line comments. - Use triple quotes to enclose multi-line comments or docstrings.
- Use
🧩 Ways to Run Python Scripts in SimLab Composer
You can execute Python scripts through several interfaces:
- Scripts Library (Automation Workbench):
Write, edit, and run scripts in GUI mode. - SimLab Visual Scripting:
Create and execute scripts in both GUI and non-GUI modes using the-fl
command. - Command Line Interface (CLI):
Run scripts in non-GUI mode using the-py
command.
📌 Want to explore more? Check out the article Approaches to Automatically Do Things with SimLab Composer on the SimLab blog.
Installation
The SimLab Python API is included with SimLab Composer. No additional installation is required.
To use the API in your Python scripts:
Import Statement
from simlabpy import *
Quick Start
Basic Scene Operations
from simlabpy import *
# Create a Scene instance
scene = Scene()
# Import a 3D model
model_path = "D:\\Models\\example.fbx"
imported_node = scene.importFile(model_path)
# Create a new material
new_material = scene.createMaterial()
new_material.setName("CustomMaterial")
new_material.setDiffuseColor(Color(0.5, 0.7, 1.0))
# Apply material
scene.replaceMaterial(imported_node, new_material)
# Render the scene
output_path = "D:\\Renders\\output.jpg"
scene.render(output_path, 1920, 1080, False)
Key Features
- Scene Management: Import, export, and manipulate 3D scenes
- Material Editing: Create and modify materials with textures
- Rendering: Programmatic control over rendering settings
- VR Support: Export VR packages and configure VR settings
- Batch Processing: Automate repetitive tasks