Python scripting - Common operators

CENPyOlpAttribCreator

 

The object of the CENPyOlpAttribCreator class may be used to initialize new attributes.

 

[Example 1]

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

 

def PostTechInitAttributes(techAttribInitOperator):  

attribCreator = techAttribInitOperator.GetAttribCreator()

 

[Example 2]

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

 

def PostWmInitAttributes(wmAttribInitOperator):  

attribCreator = wmAttribInitOperator.GetAttribCreator()

att = attribCreator.AddString("Attrib0", '0', OPERATION_ATTRIBUTE | USER_ATTRIBUTE, "Attrib0")

att.SetReComputeEnterState(ENTERSTATE_COMPLETE)

 

 

Methods

 

AddInteger(attributeName: string, defaultValue: int, minValue: int, maxValue: int, attributeUseLevel: int, nlsName: string) : CENPyOlpAttributeInt

 

o

attributeName

The name of the attribute

 

o

defaultValue

Default value

 

o

minValue

The minimum value of the attribute

 

o

maxValue

The maximum value of the attribute

 

o

attributeUseLevel

Is a bitmask and can be a combination of one ore more levels. (see Attribute use level )

 

o

nlsName

The NLS(National Language Support) string

 

o

return

Object of CENPyOlpAttributeInt class

 

[Example]

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

 


 

AddDouble(attributeName: string, defaultValue: float, minValue: float, maxValue: float, step: float, attributeUseLevel: int, attributeType: int, nlsName: string) : CENPyOlpAttributeDouble

 

o

attributeName

The name of the attribute

 

o

defaultValue

Default value

 

o

minValue

The minimum value of the attribute

 

o

maxValue

The maximum value of the attribute

 

o

step

The step size in panel when click up/down arrow

 

o

attributeUseLevel

Is a bitmask and can be a combination of one ore more levels. (see Attribute use level )

 

o

attributeType

The attribute type. (see Attribute Types )

 

o

nlsName

The NLS(National Language Support) string

 

o

return

Object of CENPyOlpAttributeDouble class

 

[Example]

   attributeDouble = attribCreator.AddDouble('MyDoubleAttribute', 55.5, 0, 100, 0.5, USER_ATTRIBUTE | PROCESS_ATTRIBUTE | GLOBAL_ATTRIBUTE, ATTRIB_STANDARD, 'MyDoubleAttribute')

 


 

AddString(attributeName: string, defaultValue: string, attributeUseLevel: int, nlsName: string) : CENPyOlpAttributeString

 

o

attributeName

The name of the attribute

 

o

defaultValue

Default value

 

o

attributeUseLevel

Is a bitmask and can be a combination of one ore more levels. (see Attribute use level )

 

o

nlsName

The NLS(National Language Support) string

 

o

return

Object of CENPyOlpAttributeString class

 

[Example]

   attributeString = attribCreator.AddString('MyStringAttribute', 'Hello World', USER_ATTRIBUTE | PROCESS_ATTRIBUTE | GLOBAL_ATTRIBUTE, 'MyStringAttribute')

 


 

AddBool(attributeName: string, defaultValue: int, attributeUseLevel: int, nlsName: string) : CENPyOlpAttributeBool

 

o

attributeName

The name of the attribute

 

o

defaultValue

Default value can bee 0 or 1 where 0=False and 1=True

 

o

attributeUseLevel

Is a bitmask and can be a combination of one ore more levels. (see Attribute use level )

 

o

nlsName

The NLS(National Language Support) string

 

o

return

Object of CENPyOlpAttributeBool class

 

[Example]

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

 


 

AddEnum(attributeName: string, literals: list, defaultValue: string,  attributeUseLevel: int, nlsName: string) : CENPyOlpAttributeEnum

 

o

attributeName

The name of the attribute.

 

o

return

Object of CENPyOlpAttributeEnum class

 

[Example]

   myLiterals = ["earth", "revolves", "around"]         # list of three literals

   myLiterals.insert(0,"The")                                # insert a new literal at first list position

   myLiterals.append("sun")                                # append a new literal at last list position

   attributeEnum = attribCreator.AddEnum('MyEnumAttribute', myLiterals, 'earth', USER_ATTRIBUTE | PROCESS_ATTRIBUTE | GLOBAL_ATTRIBUTE, 'MyEnumAttribute') 


 

GetSystemAttribCreator(): CENPyOlpSystemAttribCreator

 

 

o

return

CENPyOlpSystemAttribCreator object

 

[Example] 

from CENPyOlpSystemAttribCreator import *  # import is required to use object of CENPyOlpSystemAttribCreator class

 

def PostTechInitAttributes(techAttribInitOperator):

   attribCreator = techAttribInitOperator.GetAttribCreator()

   sysAttribCreator = attribCreator.GetSystemAttribCreator()

 


 

 


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