Python scripting - Common operators

CENPyOlpAttribSetter

 

The object of the CENPyOlpAttribSetter class may be used to assign values to the attributes.

 

[Example 1]

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

 

def PostTechInitAttributes(techAttribInitOperator):  

attribSetter = techAttribInitOperator.GetAttribSetter()

 

def PostInitManufacturingGeometry(techMfGeoInitOperator):

attribSetter = techMfGeoInitOperator.GetAttribSetter()

 

[Example 2]

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

 

def PostWmInitAttributes(wmAttribInitOperator):  

attribSetter = wmAttribInitOperator.GetAttribSetter()

 

 

Methods

 

SetInteger(attributeName: string, value: int, overrideMode: AttribOverrideMode)

 

o

attributeName

The name of the attribute

 

o

value

The value to be set

 

o

overrideMode

Attribute override mode is an optional parameter and may remain undefined. In this case the default value will be used: ATTRIBOVERRIDEMODE_DEFAULT. If AttribOverrideMode set as ATTRIBOVERRIDEMODE_OPERATIONLEVEL, the attribute will be found in the group or program and overridden it in the operation.

 

[Example]

   attribSetter.SetInteger('MyIntAttribute', 15)

 


 

SetDouble(attributeName: string, value: float, overrideMode: AttribOverrideMode)

 

o

attributeName

The name of the attribute

 

o

value

The value to be set

 

o

overrideMode

Attribute override mode is an optional parameter and may remain undefined. In this case the default value will be used: ATTRIBOVERRIDEMODE_DEFAULT. If AttribOverrideMode set as ATTRIBOVERRIDEMODE_OPERATIONLEVEL, the attribute will be found in the group or program and overridden it in the operation.

 

[Example]

   attribSetter.SetDouble('MyDoubleAttribute', 15.8)

 


 

SetString(attributeName: string, value: string, overrideMode: AttribOverrideMode)

 

o

attributeName

The name of the attribute

 

o

value

The string to be set

 

o

overrideMode

Attribute override mode is an optional parameter and may remain undefined. In this case the default value will be used: ATTRIBOVERRIDEMODE_DEFAULT. If AttribOverrideMode set as ATTRIBOVERRIDEMODE_OPERATIONLEVEL, the attribute will be found in the group or program and overridden it in the operation.

 

[Example]

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

 


 

SetBool(attributeName: string, value: bool, overrideMode: AttribOverrideMode)

 

o

attributeName

The name of the attribute

 

o

value

The value to be set. 0 or 1

 

o

overrideMode

Attribute override mode is an optional parameter and may remain undefined. In this case the default value will be used: ATTRIBOVERRIDEMODE_DEFAULT. If AttribOverrideMode set as ATTRIBOVERRIDEMODE_OPERATIONLEVEL, the attribute will be found in the group or program and overridden it in the operation.

 

[Example]

   attribSetter.SetBool('MyBoolAttribute', False)

 


 

SetEnumIndex(attributeName: string, index: int, overrideMode: AttribOverrideMode)

 

o

attributeName

The name of the attribute

 

o

value

The enum index to select the active literal. The index is zero based and must be in range of literals size

 

o

overrideMode

Attribute override mode is an optional parameter and may remain undefined. In this case the default value will be used: ATTRIBOVERRIDEMODE_DEFAULT. If AttribOverrideMode set as ATTRIBOVERRIDEMODE_OPERATIONLEVEL, the attribute will be found in the group or program and overridden it in the operation.

 

[Example]

   attribSetter.SetEnumIndex('MyEnumAttribute', 4)

 


 

GetSystemAttribSetter(): CENPyOlpSystemAttribSetter

 

 

o

return

CENPyOlpSystemAttribSetter object

 

[Example]

   sysAttribSetter = attribSetter.GetSystemAttribSetter()

 


 

 


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