Is there a better way to add a simple property (such as boolean, string, or integer) to a path statement?
I tried using a Python Script for a robot behavior and my boolean checkbox appears. However, I have to recompile my code after every new path statement. I just wanted to see if I could execute this code on the creation of every new path statement automatically? I tried creating a command, but that didn’t seem to work either. I know my code isn’t the cleanest. I’m just starting out in Python, so any suggestions would be welcome.
from vcScript import *
from vcApplication import *
app = getApplication()
comp = getComponent()
executor = comp.findBehaviour("Executor")
routine = executor.Program.MainRoutine
statement = routine.Statements[-1]
currentLen = len(routine.Statements)-1
if statement.Type == VC_STATEMENT_PTPMOTION:
if currentLen != len(routine.Statements):
statement.createProperty(VC_BOOLEAN, "checkbox")