Headless Scripting

Headless scripting is a Pro feature, and only available with KeyShot 9.3 or newer.

This page describes the various functions, classes, and constants exposed when running KeyShot in headless mode.
Note that only a subset of the scripting functionality in KeyShot can currently be used through headless scripting.

Headless Usage

For headless usage on macOS use the following executable:

keyshot -headless [options] [scene path] -script <script path> [script arguments]

This executable is also still in use on Windows for backwards compatibility.

For stdin (standard input) and stdout (standard output) on Windows use new KeyShot headless executable:

keyshot_headless [options] [scene path] -script <script path> [script arguments]

You can for example use the stdout to output the script to a file by using the redirect operator “>” or “>>”.

The executable would then look like this:
keyshot_headless -script <script path> [script arguments] > logfile.txt

Options

You can open the options by entering keyshot -help -headless

This will show you the following in your terminal:

-xlic <external license folder>

-floating_license_server <FlexLM server>

Note

The server must be preceeded with “@” when default port is used and “port@” if not.

-floating_feature <FlexLM feature> (<NR cores>)
Accepted FlexLM features:

  • keyshot2 (Pro)
  • keyshot_enterprise
  • keyshot_network_rendering (NR, checks out all cores if <NR cores> is not specified)

-subscription <email> <password> <product code>
Use subscription. Email, password and product code can be left out individually by using ‘-‘. Unspecified information will be asked for on CLI unless already known in settings file from prior sign in. The product code can be used for choosing a specific product without choosing from the list of available products.

-deactivate-on-exit
Deactivate subscription seat when exiting program. Otherwise, the seat is kept for future invocations.

-generateconfig [no cloud] [no auto-update] [FlexLM server] [FlexLM feature]
Generates a config file in the KeyShot resource folder. Unrelated to headless: KeyShot Cloud is disabled if [no cloud] is ‘1’, and auto-update checking is disabled if [no auto-update] is ‘1’.

[FlexLM server] and [FlexLM feature] can be skipped by using ‘-‘.

-progress
Writes rendering progress on stdout, e.g. ‘Rendering: xxx.x%’.

Locally configured node-locked, floating licenses or subscription in the settings file will automatically be used if no arguments are given to override them.

Headless scripting documentation

The full documentation for functions, classes and constants, can be found as part of the KeyShot Scripting Documentation, here.