Up | CameraError | ImageComplete | LoadTools | SaveTools | ToolApply | ToolVariantChange | DataInputApply | Query Events | UpdateResultPanel | UpdateIndicatorPanel | ContextChange | Mouse Events | Timer | LogMsg

 

  

 
ContextChange
Changes in the system parameter System.Context causes two system events, just prior to the change and just after. This enables the user to execute different tasks, as setting up image folders, notifying external systems etc.

On a Context change Scorpion will by default load a new external toolbox located in the external configuration file <Context>.spb, enabling different toolboxes for different products. By returning 1 from this event Scorpion will not replace teh toolbox.

def Handle_System_BeforeContextChange(PrevContext,Context):
  #
  # PrevContext = VT_BSTR
  # Context = VT_BSTR
  #
  # Return 1 if handled by script
  # Return 0 if default handling
  #

  if PrevContext=='V1' and Context=='V2' or PrevContext=='V2' and Context=='V1' :
    return 1 #same toolbox for product V1 and V2, return 1 for no toolbox change

  return 0

def Handle_System_AfterContextChange(Context):
  #
  # Context = VT_BSTR
  #
  #set path of simulation images
  imgs=GetCameraImages()
  imgs.path=imgs.defaultPath+'\\'+Context

  #set defalt path when string images
  ib=GetImageBuffer()
  ib.path=GetValue('System.Profile')+'\\Images\\'+Context

  #signal external system that context/product changed
  ExecuteCmd('imcmd','Product=%s' % Context)


Scorpion Vision Version XII : Build 646 - Date: 20170225
Scorpion Vision Software® is a registered trademark of Tordivel AS.
Copyright © 2000 - 2017 Tordivel AS.