Making object [ConveyorSystem] with Flexscript

Making object [ConveyorSystem] with Flexscript

wooram_kim
Enthusiast Enthusiast
121 Views
1 Reply
Message 1 of 2

Making object [ConveyorSystem] with Flexscript

wooram_kim
Enthusiast
Enthusiast

I want to make a ConveyorSystem without dragging a conveyor object into the model.

Therefore, I used the following script and it seems to work well. Is it a proper way?

  • Object conv_system = createcopy(maintree().find("project/library/conveyor/ConveyorSystem"), model);
    conv_system.name = "ConveyorSystem";

But the following script does not work, even though the manual recommends using treenode.copy() instead of createcopy(). What is the difference?

  • Object conv_system = maintree().find("project/library/conveyor/ConveyorSystem").copy(model);
    conv_system.name = "ConveyorSystem";

Thank you.

0 Likes
Accepted solutions (1)
122 Views
1 Reply
Reply (1)
Message 2 of 2

moehlmann_fe
Advocate
Advocate
Accepted solution

The 'proper' way would be to use the "create()" method of the Object class.

https://docs.flexsim.com/en/25.1/Reference/CodingInFlexSim/FlexScriptAPIReference/Tree/Object.html#M...

Object.create("Conveyor::ConveyorSystem")

 

I don't know why copy() doesn't work and what differences there are between the commands though. 

0 Likes