PostWmOnFrameChanged
The callback PostWmOnFrameChanged (CENPyOlpFrameChangedOperator) is called from the kernel when the tool or base frame was been changed at the operation level.
Es kann verwendet werden, um:
-
Attributwerte abrufen
-
Attributwerte festlegen
-
Ausgabe in das Protokoll
-
Zugriff auf OlpController
-
Zugriff auf SCV-Parser
-
Holen Sie den vollständigen Pfad zur Technologietabellendatei ab.
-
Ermitteln Sie den neu geänderten Rahmenname, Index, Typ, Matrix und Weltmatrix.
Der Callback kann einen booleschen Wert zurückgeben. Es ist nicht erforderlich, False zurückzugeben, da der Standardwert ohnehin False ist:
-
True: wenn es notwendig ist, nach Beendigung des Callbacks eine Operation recompute (ENTERSTATE_STARTWITHRULEEVENTS) durchzuführen
-
False: keine Neuberechnung
The callback is defined in the %WORKMETHOD_NAME%.py file that is located in the scripts folder of the plugin.
def PostWmOnFrameChanged(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