Hi, I've set a variable in my RoutingRule how can I get Workprocess to control that variable

113236

A Works Process has a Write Property task to set the value of a property in a component.

Unfortunately I am using version 4.1 and I wonder if I can control it with a Python script

Works library has been around since VC 2014 product, so that task should be there in the Works process component in your eCat.

Can you give me an example?It doesn’t seem to work when I set the property value with workProcess


cross.vcmx (994.5 KB)

The routing rule behavior has a property only accessible from the modeling tab which defines whether the rules find the variable from the component being processed or the component that has the routing rule itself.

I’m guessing that in your component it is set to read the value from the component going through, so you would need to either add the property to those “product” components with the Works process or change the setting in the crossing conveyor from the modeling tab.

I see, thanks for your reply.

It is important to recognize a Works Process is a loop of tasks. So in your example, the value of H1 would always be set to 1 after creating each box.

Not sure if this layout made in VC 4.3 will open for you, but I made a few changes to demo one approach that the TSy mentioned.

Test - Route Based on Product Property.vcmx (1019.5 KB)

Figure 1 shows the sequence of tasks in the station. There is warmup loop that is executed once to set value of user variable at start of simulation. The main loop creates a box with a property that will be used to route it. I use an If statement to switch the value being assigned to the created property on the next loop.

Figure 1. Sequence of tasks to alternate a value

Note that the CreateProductProperty tasks is undocumented (note to the team) and by default it does not support expressions nor user variables. So in the OnRun script of the station, I modified the logic of that task for simple test as illustrated in figure 2.

Figure 2. Mod to CreateProductProperty task logic

No changes were made to routing rule behavior properties since by default it checks component being processed by the behavior and I am creating property in a part that has same name and value range as you defined.

With that being said, a lot of information for you, and the Task Reference Guide on this forum can help you with some things even though it is incomplete/missing info.

I think the best approach for you is to define what you are really trying to do with the crossing conveyor/routing rule. For example, if you want the routing to be determined by PLC, for example, consider using signals and possibly another station. Or consider creating signal and property in the component doing the routing to support the use case.

1 Like