It is possible to visualize a tool ONLY when an object is located?

Yes – this can be done in tool eventhandlers. Modify the endExecute event.

def endExecute(self): # use self.name to get this tool instance # Return 1 for OK, 0 for error t=GetTool(self.name) t.visible = (t.getIntValue('Count') >= GetIntValue('Setup.PelletsLimit')) return 1

The tool visible property is True if the Count is high.

Is there a PointInPolygon function?

The is a STC – Scorpion Tool Component.

Are there sample profiles for .Net and Scorpion?

There are numerous examples for using .Net with Scorpion in Scorpion Online Help

Information on how to convert a .Net 1.1 sample to .Net 2.0.

Can Scorpion be extended by the .Net Framework?

.Net with Scorpion opens up Scorpion to the large .Net Framework and the possibility to easily integrate your own .Net object expanding the capabilities of Scorpion Vision Software. The main new features are:

  • Add custom status information to Scorpion tab-pages
  • Add custom dialog and status windows to Scorpion
  • Implement project specific GUI
  • Add high performance – high priority image aquisition and custom interfaces to external devices

The use of .Net with Scorpion is based on Python for .Net (http://www.zope.org/Members/Brian/PythonNet).  The “readme” page here is an important source for information regarding the use of .NET components from python scripts.

Python for .NET is a near-seamless integration of the Python runtime with the .NET Common Language Runtime (CLR). It lets you script and build applications in Python, using CLR services and components written in any language that targets the CLR

  • Scorpion Vision 4.2 to 7.3 supports .Net Framework version 1.1
  • Scorpion Vision 8.0 support .Net Framework 2.0

Read more in Scorpion Online Help.

Remote Scripting with Scorpion

Using the built-in tcp/ip communication protocol this is easy. The following python method makes it even easier:

def RemoteScript(destination,script):
  ExecuteCmd('ImCmd',
     'destination='+destination+':'+'Script;Name='+script)

Usage:
  RemoteScript('localhost:8701','Start()')

How does Scorpion benefit from Python?

Python is the glue between vision tools and the system states. It provides a unique flexibility – when configuring Scorpion any business logic can be defined. From Python one can for example access the Draw API providing overlay graphics or the kernel API giving access to all the image processing results.

Python examples in Scorpion Online Help.

It is possible to run an Excel macro from within Scorpion?

Yes this is possible to do. To do this install Python and the Win32 python extensions on the PC. The following function will then run a macro in Excel:

from win32com.client import Dispatch
 def RunExcelMacro(name):
   myExcel = Dispatch('Excel.Application')
   myExcel.Visible = 0
   myExcel.Workbooks.Add('c:Termoetiketter1_2.xls')
   myExcel.Run(name)
   myExcel.DisplayAlerts = 0
   myExcel.Quit()

What is Python good for?

Python is used in many situations where a great deal of dynamism, ease of use, power, and flexibility are required. In the area of basic text manipulation core Python (without any non-core extensions) is easier to use and is roughly as fast as just about any language, and this makes Python good for many system administration type tasks and for CGI programming and other application areas that manipulate text and strings and such.

What is Python?

Python is an interpreted, interactive, object-oriented programming language. It incorporates modules, exceptions, dynamic typing, very high level dynamic data types, and classes. Python combines remarkable power with very clear syntax. It has interfaces to many system calls and libraries, as well as to various window systems, and is extensible in C or C.

Python is also usable as an extension language for applications that need a programmable interface. Finally, Python is portable: it runs on many brands of UNIX, on the Mac, and on PCs under MS-DOS, Windows, Windows NT, and OS/2.

Where can I find more information about Python?

Visit the official python web site. The python faq contains valuable information.

Do you need help to start scripting – use the non programmer’s tutorial. The latest python versions are found at the Python Download. Sourceforge.Net contains large resources of modules and programs.

On the Scorpion CD a directory contains the latest Python versions. How to install Python?