Python scripting - Introduction

Change log

 

Change log of the Python interface

 

Release 2023-1

 

Action

From / To

Subject

Comment

Updated

CENPyOlpTpElement

GetCollisionStatus

Updated an existing function to include both cost evaluation and simulation results.

Added

CENPyOlpTpElement

GetSimulationCollisionStatus

GetTurnUserString

Get the simulation collision status.

Get the turn user string of the underlying toolpath element.

 

Release 2022-3-1

 

Action

From / To

Subject

Comment

Updated

PostTechOnFrameChanged

PostWmOnFrameChanged

CENPyOlpFrameChangedOperator

Add a return value to PostTechOnFrameChanged and PostWmOnFrameChanged callbacks.

Added

CENPyOlpController

GetLastGeneratedFilePathsFromDownload

GetLastSelectedFilePathsFromUpload

DownloadProgramByName

Get the absolute file paths from the last upload or download.

Download the controller program specified by its name.

cenpylib

FileUtility

The paths to the Cenit and E2 logos are available in cenpylib.

CENPyOlpWM_SyncPgAttribOperator

GetController

Get parent controller.

CENPyOlpEvent_PEOperator

GetController

Get parent controller.

 

Release 2022-3

 

Action

From / To

Subject

Comment

 

 

 

Added

Python Code Style Guide

Style Guide for Python Code

General CENIT style recommendations

General guidelines for CENIT code style.

Python libraries

cenpylib

Python package, developed by CENIT AG, contains IntelliSense and all the utilities implemented for easy scripting.

Visual Studio Code configurations

Recommended VS Code extensions

IntelliSense settings

Recommended Visual Studio Code configurations.

AuxiliaryCommandsCallbacks

ProgramProcessGeometries callback

ProcessGeometry auxiliary command entries

First implementation of the ProgramProcessGeometries auxiliary commands.

CENPyOlpProgramProcessGeometryOperator

GetLoggerOperator

GetCsvParserOperator

GetController

GetActiveProgram

GetSelectedProcessGeometries

GetStartStateNames

New operator with its functions.

CENPyOlpProcessGeometryOperator

GetContourLength

Get the curve length of the contour process geometry.

CENPyOlpTech_RecipeOperator

GetSelectedProcessGeometries

Replaces the GetActiveProcessGeometries function.

CENPyOlpProgram

ProgramProcessGeometries

IsMain

Function to program selected process geometries.

Get if the program has the "main" flag or is a subprogram.

CENPyOlpOperationGroup

GetParentProgramName

Get the name of the parent program.

CENPyOlpTpElement

SetName

Set the new name of the toolpath element.

CENPyOlpController

CreateProgram

GetAttributeByName

GetAttributeIntegerByName

GetAttributeFloatByName

GetAttributeStringByName

GetAttributeBoolByName

GetOutputDirectory

Functions to create a new controller program.

 

Functions to get user-defined attribute objects by the given name and an output directory path.

AutoExecute auxiliary command entries

PostProgramDownload

PostProgramDownloadOnsite

PostProgramUpload

PostProgramUploadOnsite

PrevProgramDownloadOnsite

PrevProgramUpload

PrevProgramUploadOnsite

New AutoExecute auxiliary script entries.

CENPyOlpTech_RuleInitOperator

OverrideEventRuleInsertPosition

New functions to override the default insert position for an event rule.

CENPyOlpTech_RuleUpdateOperator

OverrideEventRuleInsertPosition

CENPyOlpWM_RuleInitOperator

OverrideEventRuleInsertPosition

CENPyOlpWM_RuleUpdateOperator

OverrideEventRuleInsertPosition

 

Release 2022-2-4

 

Action

From / To

Subject

Comment

Added

CENPyOlpEvent_PEOperator

IsEventCreatedAutomatically

Get if the reference event was created by a rule, another event, or inserted manually.

CENPyOlpEvent_EventComputeOperator

IsEventCreatedAutomatically

CENPyOlpEvent_AttribChangedOperator

IsEventCreatedAutomatically

 

Release 2022-2-3

 

 

Release 2022-2-1

 

Action

From / To

Subject

Comment

Added

CENPyOlpWM_SyncPgAttribOperator

GetCurrentToolFrameIndex

GetCurrentBaseFrameIndex

GetCurrentToolFrameMatrix

GetCurrentBaseFrameMatrix

Methods return the current tool and base frames of the parent operation.

 

Release 2022-2

 

Action

From / To

Subject

Comment

Added

Python libraries

fpdf2

Added fpdf package for PDF document generation.

 

Release 2022-1

 

Action

From / To

Subject

Comment

 

 

 

 

Added

AutoExecute auxiliary command entries

PostProgramProcessGeometries

PrevProgramDownload

The first implementation of the AutoExecute auxiliary script entries.

AuxiliaryCommandsCallbacks

ModifyActiveProgram callback

OlpProgram auxiliary command entries

First implementation of the ModifyActiveProgram auxiliary commands.

CENPyOlpProgramModifyOperator

GetAttribGetter

GetAttribSetter

GetLoggerOperator

GetController

GetCsvParserOperator

GetActiveProgram

GetComputeHandler

GetTeachHandler

GetEventHandler

GetProgramTpElementsByName

This operator is called withing the scope of the ModifyActiveProgram callback.

CENPyOlpPosition

X

Y

Z

RX

RY

RZ

GetCoordinates

SetCoordinates

GetViaPointCoordinates

SetViaPointCoordinates

GetOrientation

SetOrientation

GetRefTpElement

SetRefTpElement

GetPositionRelation

SetPositionRelation

GetMatrix

GetViaPointMatrix

TranslatePosition

TranslateViaPointPosition

RotatePosition

GetViaPointName

GetJointValues

SetJointValues

GetExternalJointValues

SetExternalJointValues

Handles all modifications and translations of a toolpath element using simplified functions and working with Cartesian coordinates.

CENPyOlpProgram

GetName

GetAttribGetter

GetAttribSetter

GetOperationGroups

GetlOperations

GetLastCreatedOperations

GetTpElements

GetTpElementsWithEvent

Provides access to the program level.

CENPyOlpComputeHandler

EnableAutoRecompute

DisableAutoRecompute

TriggerRecompute

It is available only in ModifyActiveProgram callback.

CENPyOlpTeachHandler

GetTpElementPosition

ModifyTpElement

InsertNewTpElement

RemoveTpElement

Applies all modifications of the CENPyOlpPosition to the toolpath element.

CENPyOlpEventHandler

GetEventsByName

GetRuleBasedEventsByName

GetBuiltInEventsByType

AddEventByName

AddBuiltInEventByType

RemoveEvent

RemoveBuiltInEvent

Handles all event modifications.

CENPyOlpTpElement

GetName

GetProcessType

GetMotionType

New methods to get the toolpath element information.

CENPyOlpOperationGroup

GetName

OverrideAttribute

GetOperations

GetTpElements

GetTpElementsWithEvent

New methods to access operation group data.

CENPyOlpOperation

GetName

OverrideAttribute

GetProcessGeometryIdentifier

GetTpElements

GetTpElementsWithEvent

New methods to access operation data.

CENPyOlpController

GetProgramNames

GetLogicPortByName

New methods to get the program names and logic ports.

CENPyOlpResource

GetAttributeByName

GetValueOfIntegerAttributeByName

GetValueOfFloatAttributeByName

GetValueOfStringAttributeByName

GetValueOfBoolAttributeByName

New methods to get the resource attributes or directly the values of the resource attributes.

Constants

BuiltInEventTypes

ReComputeEnterStates

ComputeStateMatrix

AttribOverrideMode

MotionType

PosRelation

TpProcessType

New types have been added and old ones have been expanded.

Python libraries

tkinter

Added tkinter GUI package

 

Release 2021-6

 

Action

From / To

Subject

Comment

Added

PostTechOnFrameChanged

PostWmOnFrameChanged

CENPyOlpFrameChangedOperator

The callback PostTechOnFrameChanged and PostWmOnFrameChanged is called from kernel when the tool or base frame was changed at the operation level.

CENPyOlpBuiltInEvent

SetOutputTarget

GetOutputTarget

Methods to set/get target output for event.

CENPyOlpTech_UpdateOperator

GetAttribGetter

GetAttribSetter

GetAttribCreator

GetLoggerOperator

GetController

GetOlpProgram

RemoveAttribute

SetAttribOwner

GetTechEventRuleUpdateOperator

GetWmEventRuleUpdateOperator

GetCycleExplodeStatus

GetLastSavedPythonTechnologyVersion

Methods to get/set/create/remove attributes, to get program components, controller, logger operator, cycle explode status, last saved python technology version, to set owner of attribute, to update

CENPyOlpProgramComponent

GetType

GetParentComponent

GetChildComponents

GetCreatorName

Methods to get rule and active event names, add a new event or set an active event for the current event rule.

CENPyOlpTech_RuleUpdateOperator

AddEvent

GetRuleName

GetActiveEventName

SetActiveEvent

Methods to get rule and active event names, add a new event or set an active event for the current event rule.

CENPyOlpWM_RuleUpdateOperator

AddEvent

GetRuleName

GetActiveEventName

SetActiveEvent

Methods to get rule name and to add an event.

PostTechUpdate

CENPyOlpTech_UpdateOperator

The callback to update of program if the technology script was changed and the technology script version was increased.

CENPyOlpAttribCreator

AddInteger

AddInteger() replaces the old AddInt() method. AddInt() is still supported.

Updated

CENPyOlpCsvParserOperator

LoadCsvFile

Updated example of how to get the path to CSV file from TechTabs folder.

Debugging Python with Visual Studio Code

Debugging steps

Review the necessary debugging steps.

Added

CENPyOlpController

IsTeamController

GetTeamController

GetControllers

Add access to the Team controller and its resources.

CENPyOlpTpElement

GetMatrixToActiveBaseFrame

GetMatrixToBaseFrame

GetGlobalTransformedMatrix

GetGlobalTransformedMatrixUnaligned

GetInitialPathMatrixTranslatedInBaseFrame

Methods to get a matrix of the current toolpath element.

Updated

CENPyOlpMatrix

GetRotation

Existing method changed: return rotation angles in radians by default and in degrees if input parameter (True) is specified.

 

 

Release 2021-5

 

Action

From / To

Subject

Comment

Added

CENPyOlpController

GetActiveToolFrameIndex()

GetActiveBaseFrameIndex()

GetActiveToolFrameMatrix()

GetActiveBaseFrameMatrix()

Methods return the active base frame defined in the unit setup.

CENPyOlpEvent_PEOperator

CENPyOlpEvent_PEOperatorUpload

CENPyOlpEvent_EventComputeOperator

GetCurrentToolFrameIndex()

GetCurrentBaseFrameIndex()

GetCurrentToolFrameMatrix()

GetCurrentBaseFrameMatrix()

Methods return the current base frame for a specific toolpath element, defined on the operation level.

CENPyOlpMatrix

IsValid()

Method that checks whether a matrix is valid or just a null object.

AttribOverrideMode

CENPyOlpAttribSetter

CENPyOlpSystemAttribSetter

AttribSetter operator was extended with the new AttribOverrideMode parameter, thereby all methods in CENPyOlpAttribSetter and CENPyOlpSystemAttribSetter were updated too.

 

 

Release 2021-4

 

Action

From / To

Subject

Comment

Added

CENPyOlpWaitForResourcePortEvent

AddResourcePortInt16

AddResourcePortByte

New Byte and Int16 resource port events in the CENPyOlpResourcePortEvent class

CENPyOlpSetResourcePortEvent

AddResourcePortInt16

AddResourcePortByte

 

 

Release 2021-3


Action

From / To

Subject

Comment

Added

CENPyOlpTech_AttribChangedOperator

CENPyOlpWM_AttribChangedOperator

CENPyOlpSeries_AttribChangedOperator

CENPyOlpEvent_AttribChangedOperator

GetChangedAttributeName()

Method to get the name of changed attribute, which triggered "*OnAttribChanged" callback

Deprecated

CENPyOlpTech_AttribChangedOperator

CENPyOlpWM_AttribChangedOperator

CENPyOlpSeries_AttribChangedOperator

GetChangedAttribute()

Please use GetChangedAttributeName() instead


 

Release 2021-2


Action

From / To

Subject

Comment

Added

CENPyOlpSystemAttribSetter

SetProcessFlowDirection

Enabled the SetProcessFlowDirection method for python API


 

Release 2020-5


Action

From / To

Subject

Comment

Added

OlpEvent

isEnabled

Specifies if the event should be shown in the event panel.

 


Release 2020-4

 

Action

From / To

Subject

Comment

Added

OlpEvent

CENPyOlpEvent_PEOperatorUpload

see PostProcessAttributesUpload



Release 2020-2

 

Action

From / To

Subject

Comment

Added

 

IOlpSeries callbacks

GetRegShapeStyle

+ Added support for ControllerPackage folder structure

CENPyOlpAccelerationEvent

SetUnit(unit: ATTRIBUTE_TYPE)

merged to SP 2019.5.3

IOlpEvent

CENPyOlpEvent_EventComputeOperator

Added method SetTechnologyRequestId

IOlpEventRule

CENPyOlpEventRuleOperator

Added method FindTpeByTechRequestId



Release 2019-6.0


Action

From / To

Subject

Comment

Added

E2

ptvsd 4.3.0

Debug with vsCode / vs2017 / vs2019

IOlpSeries

CENPyOlpSeries_AttribInitOperator

see PostSeriesInitAttributes

CENPyOlpSeries_EventInitOperator

see PostSeriesInitEvents

CENPyOlpSeries_AttribChangedOperator

see PostSeriesOnAttribChanged

CENPyOlpAttribute

IsValid() : bool

new method added to check if attribute exists in OLP

Deprecated

E2

ptvsd_v2.2.6 

Debug with vs2015 (still possible, but the library \Lib\site-packages\ptvsd should be downgraded manually)

 


Release 2019-5.0


Action

From / To

Subject

Comment

Added

Objects

CENPyOlpResource

Resource now accessible, can be used to retrieve Ports

CENPyOlpPort

Ports used to send signals during simulation

CENPyOlpSetResourcePortEvent

New event to work with Resource Ports

CENPyOlpWaitForResourcePortEvent

New event to work with Resource Ports

CENPyOlpEventOperator

AddSetResourcePortEvent()

Method to create new event

AddWaitForResourcePortEvent()

Method to create new event

CENPyOlpController

GetResources()

Method to retrieve controlled resources from the controller



Release 2018-2.0


Action

From / To

Subject

Comment

Added

IOlpEventCallbacks

GetCycleRotationAutoFlag

If not specified will call internally GetCycleRotationFlag()

GetCycleRotationManualFlag

If not specified will call internally GetCycleRotationAutoFlag()

GetCycleTranslationAutoFlag

If not specified will call internally GetCycleTranslationFlag()

GetCycleTranslationManualFlag

If not specified will call internally GetCycleTranslationAutoFlag()

Deprecated

IOlpEventCallbacks

GetCycleRotationFlag

Replaced with GetCycleRotationAutoFlag()

GetCycleTranslationFlag

Replaced with GetCycleTranslationAutoFlag()

centypes.py

from centypes import *

No need to call "from centypes import *" from customization script anumore. It is done internally.

Fixed

Customization script files

Python callback execution from wrong script

https://dfstrac.de.cenit-group.com/CENSEM207/ticket/9100


 

Release 2018-1.4


Action

From / To

Subject

Comment

Added

IOlpEvent

GetCycleReferenceBehavior

def GetCycleReferenceBehavior():

   return  CYCLEREFBEHAVIOR_NORMAL



Release 2018-1.3 (05.07.2018)


Action

From / To

Subject

Comment

Added

CENPyOlpEvent_EventComputeOperator

GetEventOperator

See. CENPyOlpEventOperator

IOlpEventRule

PostExecute


Constants

ReComputeEnterStates


Constants

TPINSERTPOS_INHERIT

See. TPINSERTPOSITION

CENPyOlpTech_MfGeoInitOperator

GetCurrentProcessGeometryOperator

See. CENPyOlpProcessGeometryOperator

PostWmSyncPgAttributes

CENPyOlpWM_SyncPgAttribOperator


CENPyOlpTech_AttribInitOperator

GetCsvParserOperator

See. CENPyOlpCsvParserOperator

CENPyOlpWM_POAttribOperator

GetGeometryOperator

See. CENPyOlpWM_GeometryOperator

file: WorkMethod.py

PostProcessOperationAttributes

See. CENPyOlpWM_POAttribOperator

file: WorkMethod.py

PostProcessOperationGroupAttributes

See. CENPyOlpTech_POGAttribOperator


CENPyOlpSetBoolSignalEvent

See. CENPyOlpEventOperator

 


CENPyOlpSetFloatSignalEvent


CENPyOlpSetIntSignalEvent


CENPyOlpWaitForBoolSignalEvent


CENPyOlpWaitForFloatSignalEvent


CENPyOlpWaitForIntSignalEvent


CENPyOlpWaitForBoolSensorEvent


CENPyOlpBoolActorEvent


CENPyOlpFloatArrayActorEvent


CENPyOlpAccelerationEvent

PostTechOnAttribChanged

CENPyOlpTech_AttribChangedOperator


PostWmOnAttribChanged

CENPyOlpWm_AttribChangedOperator


CENPyOlpEventOperator

AddAccelerationEvent


Removed

CENPyOlpEvent_EventComputeOperator

AddEvent

Moved to CENPyOlpEventOperator

See. eventComputeOperator.GetEventOperator()

AddActorEvent

AddSensorEvent

AddSetSignalEvent

AddWaitForSignalEvent

AddSpeed

AddToolEvent

AddAccuracyEvent

AddDwellEvent

CENPyEnums

CENPyEnums

All  “from CENPyEnums import *” has to be removed. ReComputeEnterStates constants should be used from now.

 

attrib.SetReComputeEnterState(ENTERSTATE_COMPLETE

 



Deprecated, still supported. 



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