question

Patricia_brenny R avatar image
0 Likes"
Patricia_brenny R asked Jason Lightfoot edited

Apply new shape and location to moving flowitem.

Hey there,

I'm trying to change the shape, size and location of a flowitem that's already in movement, similarly to items in a conveyor, but using the SDK and C++.

tried using this setframe function and the set loc function but it simply didn't take effect.

for setFrame I used this:

setframe(item, getobjectshapeindex(otherItem));


Is there any other function I can use that will forcefully change the position and shape of a moving flowitem? Am I using setframe wrong?

FlexSim 23.0.1
flowitemmodule sdkdevelopment
· 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.

Jason Lightfoot avatar image Jason Lightfoot ♦♦ commented ·
If you're moving the item with a kinematic won't that override any changes that you make to the location?
0 Likes 0 ·
Patricia_brenny R avatar image Patricia_brenny R Jason Lightfoot ♦♦ commented ·

That's actually the goal, I have different shaped items that move in a chain effect movement, and I wanted the first one to to switch places and shape with the last one and resume from there. But I think I get what you mean, the setLoc is probably working but being overwritten...
Shouldn't the change of shape stick anyways, though?

0 Likes 0 ·

1 Answer

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

The setframe command needs the frame number (or name) related to that flow item's frame list- not the shapeindex number of another object - which is the global media index of the shape as show here:

1678716921409.png

You can of course set the shape directly without reference to the frames using setobjectshapeindex()

Frame example attached.

ShapeFrameBottleTest.fsm


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

Patricia_brenny R avatar image Patricia_brenny R commented ·
Thanks a lot! That helps with what I had in mind
0 Likes 0 ·