Skip to Content
Python APIRappelsIOlpTechnologyPostTechOnFrameChanged

PostTechOnFrameChanged

The callback PostTechOnFrameChanged (CENPyOlpFrameChangedOperator) is called from the kernel when the tool or base frame was been changed at the operation level.

Il peut être utilisé pour :

  • obtenir des valeurs d’attribut

  • Définir les valeurs des attributs

  • sortie au journal

  • accéder à OlpController

  • accéder à l’analyseur SCV

  • Obtenir le chemin complet vers le fichier de la table technologique

  • Obtenez le nom de la trame, l’index, le type, la matrice et la matrice du monde nouvellement modifiés

Le rappel peut retourner une valeur booléenne. Il n’est pas nécessaire de retourner Faux, car la valeur par défaut est de toute façon Faux :

  • Vrai : s’il est nécessaire d’effectuer une opération, recalculer (ENTERSTATE_STARTWITHRULEEVENTS) après la fin du rappel

  • Faux : pas de recalcul

The callback is defined in the %TechnologyName%.py file that is located in the scripts folder of the plugin.

def PostTechOnFrameChanged(Operator): attribGetter = Operator.GetAttribGetter() attribSetter = Operator.GetAttribSetter() olpController = Operator.GetController() toolIndex = olpController.GetActiveToolFrameIndex() baseIndex = olpController.GetActiveBaseFrameIndex() csvParser = Operator.GetCsvParserOperator() iRet = csvParser.LoadCsvFile(" ..\\TechTabs\\WeldingAttrib.csv") filePath = Operator.GetTechTabFolder("WeldingAttrib.csv") logging.LogInfo("TechTab path: " + str(filePath)) changedFrameName = Operator.GetChangedFrameName() logging.LogInfo("Newly changed frame name: " + str(changedFrameName)) changedFrameIndex = Operator.GetChangedFrameIndex() logging.LogInfo("Newly changed frame index: " + str(changedFrameIndex)) changedFrameType = Operator.GetChangedFrameType() if changedFrameType == FRAMETYPE_BASE: logging.LogInfo("Newly changed frame type: Base") if changedFrameType == FRAMETYPE_TOOL: logging.LogInfo("Newly changed frame type: Tool") matrix = Operator.GetChangedFrameMatrix() if matrix.IsValid(): logging.LogInfo("Matrix position: " + str(matrix.GetPosition().GetXYZ())) logging.LogInfo("Matrix rotation: " + str(matrix.GetRotation())) else: logging.LogInfo("Matrix is not valid!") worldMatrix = Operator.GetChangedFrameWorldMatrix() if worldMatrix.IsValid(): logging.LogInfo("World matrix position: " + str(worldMatrix.GetPosition().GetXYZ())) logging.LogInfo("World matrix rotation: " + str(worldMatrix.GetRotation())) else: logging.LogInfo("World matrix is not valid!") # Set to True when a recompute is required requestStartWithRuleEventsRecompute = True return requestStartWithRuleEventsRecompute
Was this page helpful?