question

Martin K5 avatar image
0 Likes"
Martin K5 asked Jason Lightfoot commented

Import custom object by code

Hi,


I would like to ask if it is possible to import custom object by code?


Thank you,


Martin

FlexSim 23.2.0
codeimportcustom object
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jason Lightfoot avatar image Jason Lightfoot ♦ commented ·

Hi @Martin K5, was Joerg Vogel's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes 0 ·

1 Answer

Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Jason Lightfoot edited

I assume you want to reuse a customized object from one model file in a different model. You need to export your customized object into a user library file. This file can you load into a new model file manually or always for any new model by environment settings. In a case where you need a set of different objects you put all customized objects into a single user library and export this.
Adding a user library by code makes only sense, if you are absolutely sure this action takes only place once during existence of your model or you need structures which deletes and unloads user library objects on each simulation run start.
https://docs.flexsim.com/en/23.2/Using3DObjects/CreatingCustomObjectsAnimations/CreatingCustomLibraries/CreatingCustomLibraries.html

· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Martin K5 avatar image Martin K5 commented ·
Not exactly. The idea is to automatically import more custom objects into FlexSim model instead of dragging 'Shape' object for each custom object and then changing its Visuals.


Is this somehow possible?


Thank you.

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ Martin K5 commented ·

In your preferences set the user library to load every time FlexSim starts and then create a script to copy instances from the library into your model.

0 Likes 0 ·