KeyShot scripting uses Python 3.10.
Scripting functionality includes:
- Opening, saving and importing files
- Camera control – Add, get, list, manipulate and save camera.
- Lighting presets – Get, set.
- Materials – Get, set, delete.
- Load/import from .mtl
- Multi-materials – Get, set, create and manipulate.
- Metadata – Get
- Environment – List, set and manipulate.
- Export – Export to gltf, 3mf and usd.
- Geometry – Move, scale, duplicate, show/hide, lock/unlock.
- Model Set – Create, get, set, remove.
- Studios – List, get, set.
- Image styles – List, get, set and manipulate (high level only)
- Rendering – Manipulate render settings, add render passes and add jobs
hints() in the scripting console will provide you with a list of tips about scripting and working with the console.
The Scripts tab offer a number of scripting examples that you can run on your scene.
Scripts are located in the KeyShot Resource folder, e.g. \KeyShot 11\Scripts. To change this location or add another location, select Edit > Preferences > Folders and change the path for the Scripts folder. Scripts in the folder will be visible in the Scripts tab of the Scripting window.
Creating a Script
To create a script, select Create from the Scripts tab. Provide a name for the script and the author.
If Python 3.10 (64 bit) is installed locally on the machine, KeyShot will detect Python and all installed modules which then can be freely used for scripting in KeyShot (this can be disabled in the General Preferences).
Vector and matrix classes are made available in the
luxmath module to help with doing calculations. They are named
Import/Edit a script
You may also import a script or edit an existing script using the corresponding buttons on the Scripts tab.