question

Abhay Bajpai avatar image
0 Likes"
Abhay Bajpai asked Jeanette F commented

Change a flow item to a different flow item (in processor or process flow)

Cabinet Assembly Simulation_14_autosave_5.fsm

Every token created, has a label called "CabinetType_ForToken". It just represents what type of cabinet it is (pantry or base or overhead).

I have also designed some cabinets and uploaded them in the Flow Item Bin.

1717095149766.png

I would like for the Process Flow or Processor to reference the label "CabinetType_ForToken" of the token and convert the visual into one of the Flowitem Bin circled above. I tried using "Change Visual" in Process Flow but it only allows 'by case' for changing colors not the entire flowitem altogether.

FlexSim 24.0.2
change visual
· 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.

Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @Abhay Bajpai, was Paula LG's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes 0 ·

1 Answer

Paula LG avatar image
1 Like"
Paula LG answered Felix Möhlmann commented

Hi,

In order to change the flow item shape you need to use a Custom Code activity and select Visual → Change 3D Shape.

1717139336728.png

However, it has no predefined option to choose the destination shape conditionally, so you'll have to edit the code manually and add as many if clauses as values your label can have. Let me know if you need help doing that.

I hope it helps!


1717139336728.png (8.7 KiB)
· 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.

Felix Möhlmann avatar image Felix Möhlmann commented ·

You could also define the different visualizations as shape frames on a single flow item and switch between them with the "Change Shape Frame" option in the "Change Visuals" activity.

capture2.png

There you'd just have to edit the code so it uses a token label as the shape name instead of a fixed value.

{ //************* PickOption Start *************\\
Object object = token.item; string framename = token.CabinetType_ForToken; if (framename == "Base Frame" || framename == "0") {     setframe(object, 0); } else {     if (stringtonum(framename) > 0)         setframe(object, stringtonum(framename));     else         setframe(object, framename); } } //******* PickOption End *******\\

In both cases you will have to update the size of the item as well. It might be best to keep a global table with the correct dimensions for the different cabinet types for this purpose.

1 Like 1 ·
capture2.png (8.9 KiB)