Accessing the Filter Property of ReserveProduct Statement via Python API in VC 4.10

Hello there,

I’m encountering an issue while trying to access the Filter of a vcStatement in VC 4.10. Has anyone faced the same problem?

Setup, Actions, and Results

[Process Node Setup]

  • A filter is activated on a ReserveProduct statement.
  • Another filter is activated on a TransportIn statement.

[Python Console Actions]

  • Accessing the statements of the corresponding process using .Requirements.Statements and .Statements.
  • Attempting to access the Filter of each statement using .Filter.

[Output Issue]

  • I cannot retrieve the filter from the ReserveProduct statement. :angry:
  • An error message indicates that there is no such attribute or method available.

[Code Snippet]

comp = app.findComponent("Feeder Process") ### get the Feeder Process Component
for behaviour in comp.Behaviours:
  if behaviour.Type == VC_PROCESSEXECUTOR: ### get process executor behavior
    for process in behaviour.Processes[1:]: ### access the second process only
      print process.Name ### "FeedNope" on output panel
      
      # Requirement Section
      print "\tRequirement:" ### "Requirement" on output panel
      for statement in process.Requirements.Statements:
        try:
          print '\t\t', statement.Type ### "ReserveProduct" on output panel
          print '\t\t\t{} [type: {}]'.format(statement.Filter.Name, statement.Filter.Type) ### error here!!
        except Exception as e:
          print '\t\t\t{}'.format(e) ### "找不到屬性或方法 'Filter'" on output panel

      # Statement Section
      print "\tStatement:" ### "Statement" on output panel
      for statement in process.Statements:
        try:
          print '\t\t', statement.Type ### "TransportIn" on output panel
          print '\t\t\t{} [type: {}]'.format(statement.Filter.Name, statement.Filter.Type) ### "statement filter [type: 5]" on output panel
        except Exception as e:
          print '\t\t\t{}'.format(e) ### doesn't reach here

[Question]
Has anyone encountered this issue before? Is there a workaround or a way to properly access the Filter attribute in ReserveProduct statements?

Any help would be greatly appreciated! :pray:

Thanks in advance! :blush:

1 Like