KeyShot Forum

Technical discussions => Extending KeyShot => Scripting => Topic started by: sethcshort on November 28, 2016, 02:51:25 PM

Title: Script to isolate selected object/group and save as separate file/package?
Post by: sethcshort on November 28, 2016, 02:51:25 PM
Hi guys,

I'm planning out the task of processing a lot of large KeyShot scenes that have many objects inside of them, breaking out the individual object/groups inside each scene into separate files, to create a library of BIP and/or KSP files, each with one object/group inside.

Each object/group we want to extract is in the root of the model tree, not within a subgroup (other than the default object/group that imported objects retain). There are no scene states or cameras to worry about. We do need to retain materials and textures.

Is there a way to do this via script? I'm thinking something along the lines of:
1. Manually hide everything
2. Manually unhide the object/group(s) I want
3. Run a script to delete all hidden objects and save the scene with a custom filename -- either manually typed, or preferably taken from the root name of the visible group/object.
4. If possible, automatically save as a package of the same name, in the same folder
5. Progressively undo to undelete objects
6. Repeat from step 2.

Is this a good way to accomplish this goal? Is there a script function for Undo? I'm a beginner in KeyShot scripting so any tips would be super helpful.

Thanks!
Seth