question

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

Duplicated operators location change for no reason?

OperatorLocationReset.fsm

In the attached model, the OnModelReset code was used to create tools and operators by duplicating existing ones. For some reason, the duplicated operator location is revert back to the parent operator location after exiting the OnModelReset code?


Object defaultOperator = Model.find("Operator1");
table = Table("Operators");
rows = table.numRows;

for(int i=1; i <= rows;i++){

string name = table[i]["Name"];

Object newOperator = createcopy(defaultOperator, model());
setname(newOperator, name);
operators.addMember(newOperator);

newOperator.location.x = 0;
newOperator.location.y = 5;
}

FlexSim 20.1.2
operatorscustomecode
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

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

There is an option set to be active on default: Set Reset Position. You have to turn this option off on the operator you want to copy.

· 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.

Hai L2 avatar image Hai L2 commented ·

There are so much to learn, Thanks for your help!

I couldn't find the option you mentioned, but I was able to use setresetposition()

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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