KeyShot Forum

Technical discussions => Extending KeyShot => Scripting => Topic started by: monsieurl on February 16, 2022, 08:58:55 AM

Title: Batch importing files to separate model sets + renaming Modestes
Post by: monsieurl on February 16, 2022, 08:58:55 AM
Hey guys,

for a while now im searching for a way to batch import a bunch of files - each one in an own modelset which should be named after the file name.

So far I worked out a script which imports the files + sets new model sets - the problem now is, that every new modelset contains the geometry of the model set before. Is there 1) a way to unmark the modelset before creating a new one; so that there will be no geometry copied?

or is there maybe a better workaround for my problem?

Thank you so much!
Title: Re: Batch importing files to separate model sets + renaming Modestes
Post by: Niko Planke on February 16, 2022, 09:34:14 AM
Hey Monsieurl,

You can set the "model_set_import_to" key in the import options dictionary returned by lux.getImportOptions() to "3".
You can pass that modified dictionary via the 'opts' keyword to lux.importFile()

For more information just type help(lux.getImportOptions) in the scripting console, that will give you the documentation and other import options you can modify.

If that does not work for you, you can try this:
Using lux.getSceneTree().find(types=lux.NODE_TYPE_MODEL_SET) should give you a list of all modelsets(if any exist).
By using .hide() on the resulting nodes you can then hide your Modelsets.

Let me know if you have further questions.