question

Iago MF avatar image
0 Likes"
Iago MF asked Iago MF commented

Error using copyobject with conveyors

Hi,

I was trying to use de fuction copyobject() with conveyors, but i've found that it's not possible to set properties of the new conveyor, some errors appear.

Why is this happening?

23.2 Error copyobject Conveyor.fsm

Thanks!

FlexSim 23.2.0
conveyorpropertiescopyobject
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

Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered Iago MF commented


Worked for me with:

Vec3 newlocation =  Vec3(0,0,1);    // update implicit cast from [0,0,1] is also okay - this was a red herring

You should not need the function_s call, since that is done by the property's setValue function.

· 7
5 |100000

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

Iago MF avatar image Iago MF commented ·

Hi @Jason Lightfoot

I'm still getting the same error in that way. Also, using copy instance is working with [0,0,1]

error2.gif

0 Likes 0 ·
error2.gif (645.6 KiB)
Jason Lightfoot avatar image Jason Lightfoot ♦♦ Iago MF commented ·

Yes - you're right - if you step through to debug the script with the 3D view open it works, while just running it outright (mostly) or stepping through with the 3D view closed seems not to.

As you say, this works:

Object newconv = conv.copy(model());
1 Like 1 ·
Iago MF avatar image Iago MF Jason Lightfoot ♦♦ commented ·

Using the next expression after createcopy works (moreless), maybe it's something about doing instantly:

Object conv = Model.find("StraightConveyor1");
Object newconv = createcopy(conv, model());

await Delay.realTime(0);

Vec3 newlocation =  Vec3(0,0,1);
newconv.setProperty("StartLocation",newlocation);
repaintall();
0 Likes 0 ·
Show more comments