Python scripting - Technology operators

CENPyOlpTech_UpdateOperator

 

The object of the CENPyOlpTech_UpdateOperator class is passed to the PostTechUpdate callback as a parameter.

It can be used to obtain the required operators within the scope of the PostTechUpdate callback in the %Technology%.py script file.

 

[Example]

File: Samples\JenoptikPluginUpdated\Plugin\TechnologyPackages\LaserCuttingTechnology\Jenoptik\LaserCuttingTechnology.py

 

def PostTechOnAttribChanged(techAttribChangedOperator):

   pass

 

 

Methods

 

GetAttribGetter(prgComponent: CENPyOlpProgramComponent): CENPyOlpAttribGetter

 

o

prgComponent

Object of CENPyOlpProgramComponent class

 

o

return

Object of CENPyOlpAttribGetter class

 

This operator gives the possibility to find attribute of given program component and get their values.

 

[Example]

 

   program = techUpdateOperator.GetOlpProgram()

   componentsList = program.GetChildComponents()

   for component in componentsList:

      componentType = component.GetType()

      parentComponent = component.GetParentComponent()

      componentCreatorName = component.GetCreatorName()

      if componentType is OLPPROGRAMCOMPONENTTYPE_OPERATIONGROUP:

         attribGetter = techUpdateOperator.GetAttribGetter(component)

         attribValue = attribGetter.GetInteger('MyIntAttribute')

 


 

GetAttribSetter(prgComponent: CENPyOlpProgramComponent): CENPyOlpAttribSetter

 

o

prgComponent

Object of CENPyOlpProgramComponent class

 

o

return

Object of CENPyOlpAttribSetter class

 

This operator gives the possibility to change attribute values of given program component.

 

[Example]

   program = techUpdateOperator.GetOlpProgram()

   componentsList = program.GetChildComponents()

   for component in componentsList:

      componentType = component.GetType()

      parentComponent = component.GetParentComponent()

      componentCreatorName = component.GetCreatorName()

      if componentType is OLPPROGRAMCOMPONENTTYPE_OPERATIONGROUP:

         attribSetter = techUpdateOperator.GetAttribSetter(component)

         attribSetter.SetString('MyStringAttribute', 'This is new string')

 


 

GetAttribCreator(prgComponent: CENPyOlpProgramComponent): CENPyOlpAttribCreator

 

o

prgComponent

Object of CENPyOlpProgramComponent class

 

o

return

Object of CENPyOlpAttribCreator class

 

This operator gives the possibility to create an attribute for given program component.

 

[Example]

   program = techUpdateOperator.GetOlpProgram()

   componentsList = program.GetChildComponents()

   for component in componentsList:

      componentType = component.GetType()

      parentComponent = component.GetParentComponent()

      componentCreatorName = component.GetCreatorName()

      if componentType is OLPPROGRAMCOMPONENTTYPE_OPERATIONGROUP:

         attribCreator = techUpdateOperator.GetAttribCreator(component)

         attribCreator.AddBool('MyBoolAttribute', True, USER_ATTRIBUTE | PROCESS_ATTRIBUTE | GLOBAL_ATTRIBUTE, 'MyBoolAttribute')

 


 

RemoveAttribute(prgComponent: CENPyOlpProgramComponent, attributeName: string): bool

 

o

prgComponent

Object of CENPyOlpProgramComponent class

 

o

attributeName

Name of attribute to remove

 

o

return

true - if the attribute was found in the program component and removed, false - otherwise

 

Removes an attribute from given program component.

 

[Example]

   program = techUpdateOperator.GetOlpProgram()

   componentsList = program.GetChildComponents()

   for component in componentsList:

      componentType = component.GetType()

      parentComponent = component.GetParentComponent()

      componentCreatorName = component.GetCreatorName()

      if componentType is OLPPROGRAMCOMPONENTTYPE_OPERATIONGROUP:

         attribCreator = techUpdateOperator.GetAttribCreator(component)

         attribCreator.AddInteger('MyIntAttribute', 0, -100, 100, USER_ATTRIBUTE | PROCESS_ATTRIBUTE | GLOBAL_ATTRIBUTE, 'MyIntAttribute')

         techUpdateOperator.RemoveAttribute(component, 'MyIntAttribute')

 


 

GetLoggerOperator(): CENPyOlpLogOperator

 

o

return

Object of CENPyOlpLogOperator class

 

This operator gives the possibility to log issues resulting by user input.

 

[Example]

   logOperator = techUpdateOperator.GetLoggerOperator()

   controller = techUpdateOperator.GetController()

   toolIndex = controller.GetActiveToolFrameIndex()

   baseIndex = controller.GetActiveBaseFrameIndex()

   logging.LogInfo("Controller active tool index: " + str(toolIndex) + "; base index: " + str(baseIndex))

 


 

GetController(): CENPyOlpController

 

o

return

Object of CENPyOlpController class

 

This method returns the assigned controller.

 

[Example]

   controller = techUpdateOperator.GetController()

 


 

GetOlpProgram(): CENPyOlpProgramComponent

 

o

return

Object of CENPyOlpProgramComponent class

 

This method returns the OLP program.

 

[Example]

   program = techUpdateOperator.GetOlpProgram()

 


 

SetAttribOwner(attribute: CENPyOlpAttribute, attribOwnerName: string)

 

o

attribute

Object of CENPyOlpAttribute class

 

o

attribOwnerName

Name of attribute owner

 

 This method sets owner of attribute.

 

[Example]

   techUpdateOperator.SetAttribOwner(attribute, ownerName)

 


 

GetTechEventRuleUpdateOperator(rule: CENPyOlpProgramComponent): CENPyOlpTech_RuleUpdateOperator

 

o

eventRule

Object of CENPyOlpProgramComponent class

 

o

attributeName

Name of attribute to copy

 

o

return

Object of CENPyOlpTech_RuleUpdateOperator class

 

The method returns event rule update operator of technology.

 

[Example]

   ruleUpdateOperator = techUpdateOperator.GetTechEventRuleUpdateOperator(eventRule)

 


 

GetWmEventRuleUpdateOperator(rule: CENPyOlpProgramComponent): CENPyOlpWM_RuleUpdateOperator

 

o

eventRule

Object of CENPyOlpProgramComponent class

 

o

attributeName

Name of attribute to copy

 

o

return

Object of CENPyOlpWM_RuleUpdateOperator class

 

The method returns event rule update operator of work method.

 

[Example]

   ruleUpdateOperator = techUpdateOperator.GetWmEventRuleUpdateOperator(eventRule)

 


 

GetCycleExplodeStatus(prgComponent: CENPyOlpProgramComponent): CycleExplodeStatus

 

o

prgComponent

Object of CENPyOlpProgramComponent class

 

o

return

CycleExplodeStatus value

 

The method returns cycle explode status and can be called for the program components of type OLPPROGRAMCOMPONENTTYPE_EVENT only.

 

[Example]

   program = techUpdateOperator.GetOlpProgram()

   componentsList = program.GetChildComponents()

   for component in componentsList:

      componentType = component.GetType()

      if componentType is OLPPROGRAMCOMPONENTTYPE_EVENT:

         logging.LogInfo("Component type: EVENT")

         status = techUpdateOperator.GetCycleExplodeStatus(component)

         logging.LogInfo("Cycle explode status: " + str(status))      

 


 

GetLastSavedPythonTechnologyVersion(): int

 

o

return

Integer version value of the saved technology python script

 

The method returns the last saved version value of the technology python script.

 

[Example]

   version = techUpdateOperator.GetLastSavedPythonTechnologyVersion()

 


 


Previous
Page précédente
Chapter
Page principale du chapitre
Next
Page suivante