Python scripting - Auxiliary commands callbacks

ProgramProcessGeometries

 

The callback ProgramProcessGeometries(CENPyOlpProgramProcessGeometryOperator) is called manually by user on the active program or automatically (Predefined auto execute script names).

 

The callback is defined in cenpyDefProgram.py file.

 

ProgramProcessGeometries

 

[Example]

from centypes import *

from cenpylib import *

 

def GetCommandName():

  return "ProgramPG"

 

def GetCommandUuId():

  return "A2BN5471-TAB7-4AF1-98E1-U87AQD13E73D"

 

def GetIconName():

  return "COM_ScriptsRun"

 

def ProgramProcessGeometries(Operator):

  logging = Operator.GetLoggerOperator()

  pgs = Operator.GetSelectedProcessGeometries(PROCGEO_CONTOUR)

  for counter, pg in enumerate(pgs, 1):

     logging.LogInfo(f"PG <{counter}> name = {pg.GetProcessGeometryName()} length = {pg.GetContourLength()}.")

 

  controller = Operator.GetController()

  startStates = Operator.GetStartStateNames()

  for counter, startState in enumerate(startStates, 1):

     logging.LogInfo(f"Start state <{counter}> name = {startState}.")

     program = controller.CreateProgram(startState, startState, False)

 

  program = Operator.GetActiveProgram()

  isSuccessful = program.ProgramProcessGeometries(pgs, 3, 1)

  if isSuccessful:

     logging.LogInfo("Process geometry was successfully programmed.")

  else:

     logging.LogError("Failed to program process geometry.")

 


ProgramProcessGeometries_Ex

 


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