question

Gilles avatar image
0 Likes"
Gilles asked Gilles commented

conveyor behavior/properties in code

Hello,
I am creating a conveyor system using a code. I have 3 mains questions:

1)using the code, I am able to create the conveyor. however, when I reset the model, it erases all the properties that I have set using the code.

could you help me to understand what is happening and fix it?

crossbeltconvincode.png


2) where could I access the list of all properties of a conveyor. below are some properties that I have found in library/conveyor/conveyor/properties. however, if you look at the three, the properties "StartLocation", "EndLocation", "SetZ", and many others don't exist. Where can we find the complete list of properties that can be set using the method "setProperties"

1728952317114.png

3) since I am creating a power free conveyor, how can I use ""setProperty"" or other method to set the catch condition which is: (item.size.x > 12) ? (dogNum % 4 == 0) : 1


here is the model

layoutGeneratorTest.fsm

FlexSim 23.2.0
conveyorspropertiesusing code
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

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Gilles commented

1) Create the object while the model is reset, not during runtime (On Model Reset trigger or script console). There probably is some under-the-hood command to keep the properties when creating it during the runtime, but I don't know what that is and you will very likely need to reset the model anyway to properly initialize things like port-connections.

2) You should find a complete list of properties for all objects in the online documentation. Note that objects often inherit properties from their parent class. I also often just go by what columns are available in the property table.

1728976108866.png

3) The code in the node is just text, so you can alter it using the methods available to the string class (or replace it entirely by a new string you enter).

string catchCondition = conv.getProperty("CatchCondition");
catchCondition = catchCondition.replace("Always Catch", "Custom Condition"); catchCondition = catchCondition.replace("return 1", "return (item.size.x > 12) ? (dogNum % 4 == 0) : 1"); conv.setProperty("CatchCondition", catchCondition);

1728976108866.png (26.0 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.

Gilles avatar image Gilles commented ·

Hello @Felix Möhlmann ,

thank you for your valuable answer.


0 Likes 0 ·