question

Hai L2 avatar image
0 Likes"
Hai L2 asked Mikael B commented

Duplicate objects (multiprocessor, processor, operator) in code?

Is there a quick way in code to duplicate the existing 3d object and its settings?

I have a default multiprocessor defined that I like to duplicate and relocate during model reset.

FlexSim 20.1.2
flexsim 20.1.2custom codemultiprocessorduplicate
5 |100000

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

1 Answer

Matthew Gillespie avatar image
0 Likes"
Matthew Gillespie answered Mikael B commented

You can use the createcopy() command. For example:

Object defaultMultiProcessor = Model.find("MultiProcessor1");
Object newObject = createcopy(defaultMultiProcessor, model());
newObject.location = Vec3(5, 5, 0);
· 6
5 |100000

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

Hai L2 avatar image Hai L2 commented ·

Thanks for the reply. Does that copy the object and all of its settings?

0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ Hai L2 commented ·

@Hai L2 Yes, it duplicates the object.

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Hai L2 commented ·

That works with fixed resources and simple flow items, but any object that inherits coupling nodes get problems with a simple copy command. Module objects like AGV paths, conveyors, some taskexecuters and people module aren’t made for this easy method.

0 Likes 0 ·
Hai L2 avatar image Hai L2 Joerg Vogel commented ·

Do you mean the links between objects or other assignments are not copied?

0 Likes 0 ·
Show more comments