Author Topic: How to automatically render a list of STEP files ?  (Read 2003 times)

0 Members and 2 Guests are viewing this topic.

Offline SebastianG

How to automatically render a list of STEP files ?
« on: February 08, 2021, 05:59:18 am »
I have a lot of assemblies in Onshape, that I want to import as step and render in KeyShot.
My customer wants a small rendering of each assembly for their website.

Manual steps I want to automate:

Import next Step file in the list.
1. Drag the materials on the parts
2. Set rounded edges to 0.2mm
3. Fit camera to model
4. Render still picture and save it with the name of the Step file

Repeat with next Step file...

I guess I should create a material template to select the materials according to the specific RGB values of the bodies.

What is the best approach to do something like that? With scripting? Can I automate KeyShot with another program?

Offline INNEO_MWo

  • Hero Member
  • *****
  • Posts: 1327
  • Total likes: 85
  • Senior Technical Consultant @ INNEO (Germany)
    • german KeyShot page from INNEO Solutions
Re: How to automatically render a list of STEP files ?
« Reply #1 on: February 08, 2021, 11:58:20 am »
Round edges is not supported via scripting. All the other stuff can be realized with the scripting console. Start KeyShot via batch, execute the script with every file in a folder, collect the render jobs in the queue or render results on demand.

The render images script is a good start. But it needs some work for camera settings, center and fit some nodes and manage output (path and naming).

The script language is Python. You don’t a need 3rd party software to drive an automation.
« Last Edit: February 08, 2021, 12:01:44 pm by INNEO_MWo »

Offline SebastianG

Re: How to automatically render a list of STEP files ?
« Reply #2 on: February 09, 2021, 03:53:59 am »
Thanks for the reply! The scripting is the solution I was looking forward to.
I start with the render images script. 

I found this article:

I  had to add the import option:
importOptions['separate_materials'] = False

Now it works with my Material Template, which was set up to with specific colors of the step geometry.

I will go through the Toytrain example to set up the camera, environment, ...
This will be a great time saver for me  :)