set executionOrderId default value to 0 python3
authorGP Orcullo <kinsamanka@gmail.com>
Mon, 31 Oct 2022 17:49:28 +0800
branchpython3
changeset 3769 f5124b39ae56
parent 3768 c032fff8af32
child 3770 1eee037e81f7
set executionOrderId default value to 0
PLCGenerator.py
--- a/PLCGenerator.py	Mon Oct 31 14:48:25 2022 +0800
+++ b/PLCGenerator.py	Mon Oct 31 17:49:28 2022 +0800
@@ -984,7 +984,7 @@
             orderedInstances = []
             for instance in body.getcontentInstances():
                 if isinstance(instance, (OutVariableClass, InOutVariableClass, BlockClass)):
-                    executionOrderId = instance.getexecutionOrderId()
+                    executionOrderId = instance.getexecutionOrderId() or 0  # 0 if None
                     if executionOrderId > 0:
                         orderedInstances.append((executionOrderId, instance))
                     elif isinstance(instance, (OutVariableClass, InOutVariableClass)):
@@ -1100,7 +1100,7 @@
 
         name = block.getinstanceName()
         type = block.gettypeName()
-        executionOrderId = block.getexecutionOrderId()
+        executionOrderId = block.getexecutionOrderId() or 0     # 0 if None
         input_variables = block.inputVariables.getvariable()
         output_variables = block.outputVariables.getvariable()
         inout_variables = {}