Sync Task not working properly

Hello,

i am currently building a quite complex model with the Works Library. The more complex it gets, the more errors that I havent experienced before (especially with the Sync Task) appear.

The tasks usually look like this:
Works Process #1 waits for part X to be delivered
Works Process #1 then Syncs up with Works Process #2…6
Works Process #2…6 require Human for HumanProcess

The model has somewhere around 100 Works Process Components. Some of them with similar names. Many of them “communicate” with each other through the Sync Task. Now that the model is this complex I have encountered events, where the Sync Tasks simply refuse to be executed. Sometimes the Works Process Component also Sync up with a different Works Process Component with a similar but wrong name. I also get the following Output periodically:

"
File “Works_TaskControl::SyncScript”, line 34, in someSynced
AttributeError: ‘NoneType’ object has no attribute ‘SyncMessage’
"

Is there some kind of limit to the amount of Works Process Components, Sync Tasks, etc.?
Is the output message linked to the problem I am experiencing?

I will also upload the file here:
BachelorarbeitV5Vorlage.vcmx (10.2 MB)

I don’t know much about the Works library, but I did basic debugging for you.

File “Works_TaskControl::SyncScript”, line 34, in someSynced
AttributeError: ‘NoneType’ object has no attribute ‘SyncMessage’

The current cause is that you don’t have component named “St1.3AB2” in the layout but are referencing it in the Sync tasks of other components.

To find these particular errors easily in the future, change the OnSignal method in Works_TaskControl component’s SyncScript to be like this:

def OnSignal( signal ):
  global tasks, listeners
  if signal.Name == 'Sync' and signal.Value:
    sender, list_of_comps, sync_message = signal.Value.split('<>')
    sender_comp = app.findComponent( sender.strip() )
    
    comp_list = []
    for compName in list_of_comps.split(','):
      strippedName = compName.strip()
      compHandle = app.findComponent( strippedName )
      if compHandle != None:
        comp_list.append(compHandle)
      else:
        print "Sync task error in " + sender_comp.Name + ": Target component with name '" + strippedName + "' not found!"
    
    comp_list.append( sender_comp )
    task = sender_comp, comp_list, sync_message.strip().lower()
    tasks.append( task )
    if sender_comp not in listeners:
      listeners.append( sender_comp )
      message_prop = sender_comp.getProperty('SyncMessage')
      message_prop.OnChanged = trigger_it    

Sometimes the Works Process Component also Sync up with a different Works Process Component with a similar but wrong name.

I think this can happen if you use any of the delimiter characters in the component names that Works uses internally. For sync tasks these seem to include “<>”, “,” and whitespace. Note that Works seems to also handle the sync message in case-insensitive manner.

Thanks for the detailed reply. The piece of code has already helped me a ton and will definitely help me so much more in the future.

This could have happened accidently when i intended to type “.” I will keep this tip in mind aswell. Thanks again!