Tool Name:
|
PythonScript |
Tool
Index: |
3 |
Tool
Category: |
Basic Tools |
|
|
Description:
The PythonScript tool executes the Python script
configured in it.
The PythonScript tool
provides user interface to write Python script,
which gets executed when that PythonScript tool
is processed by the Scorpion Vision Software.
The PythonScript tool adds
great level of flexibility to the Scorpion
Vision Software. It can be used for -
-
Accessing
image buffers, and doing custom
processing, including
mathematical algorithms, image
processing operations
-
Accessing
other tools configured in the
toolbox, and getting / settings
their values. Writing custom
processing logic using the
parameter values exposed from
various tools, at runtime, and
generating results which can be
accessed by other tools.
-
Applying
custom tool execution sequence
by executing different tools
from within the Python script.
-
Accessing
and updating global scripts and
parameters available in the
Scorpion Vision Software
Python script is simple to use and yet very
powerful. More information about
Python Scripts
is available under following topics -
1.
Scorpion Python Kernel
2.
Python Script Examples
3.
Console Window
4.
Debugging Python Script
User Interface:
(A) Tool Configuration dialog box -
Setup Tab
It is a Python script editor which can be used
for writing python script, testing it and
debugging it. Various script editor features are
available to assist in the script writing,
testing and debugging.
A toolbar is
available at the
top, which has
toolbar buttons
as follows -
|
1 |
Cut |
|
Standard 'Cut'
operation which
cuts the
selected text
and puts it on
the clipboard,
so that it is
available for
the 'Paste'
operation |
2 |
Copy |
|
Standard 'Copy'
operation which
puts the
selected text on
the clipboard,
so that it is
available for
the the 'Paste'
operation |
3 |
Paste |
|
Standard 'Paste'
operation which
pastes the text
available on the
clipboard, to
the current
location in the
editor window |
4 |
Undo |
|
Undoes the
previous
operation done
in the editor
window |
5 |
Decrease
Indentation |
|
Decreases
indentation of
the selected
text block |
6 |
Increase
Indentation |
|
Increases
indentation of
the selected
text block |
7 |
Find |
|
Pops up the
'Find Text'
dialog box which
can be used to
find required
text in the
editor window.
Several
filtering
options are
available in the
'Find Text'
dialog box for
quick search.
|
8 |
Find Previous |
|
Finds the
instance of the
text specified
in the 'Find
Text' dialog
box, which is
available before
the current
selection in the
editor window |
9 |
Find Next |
|
Finds the
instance of the
text specified
in the 'Find
Text' dialog
box, which is
available after
the current
selection in the
editor window |
10 |
Replace |
|
Pops up the
'Find and
Replace Text'
dialog box which
can be used to
find required
text in the
editor window
and to replace
it with desired
new text.
Several
filtering
options are
available in the
'Find Text'
dialog box for
quick search
|
11 |
Insert Parameter
as Text |
|
Pops up the
standard
'Select......'
dialog box, used
for parameters
selection. The
left hand side
pane lists all
the accessible
tools. When a
tool from the
left hand side
pane is
selected, all
accessible
parameters
associated with
that tool are
displayed in the
right hand side
pane. User can
select any
parameter and
click on the
'OK' button. The
text indicating
the selected
tool and the
selected
parameter is
pasted at the
current location
in the editor
window. This is
recommended way
of using the
tools and
parameter texts
in the script,
as it eliminates
the possibility
of spelling
mistakes and
typing mistakes
and avoids
debugging
efforts
associated with
such issues.
When a text is
selected which
has a tool name
associated with
it, and 'Insert
Parameter as
Text' toolbar
button is
clicked, it pops
up the
'Select.....'
dialog box in
the context of
the tool
selection, that
is the left hand
side tool
selection pone
is not available
in this case,
only the list of
parameters
associated with
the currently
selected tool is
displayed. |
12 |
Show/Hide Python
Console |
|
Shows / hides
the Python
console window.
Python console
shows the
messages from
the Python
engine and any
messages output
from the
executed Python
script. These
messages are
useful in
checking the
status and
debugging
operations.
Please refer to
the
console-window
topic for more
information
about the
console window
|
13 |
Python Help |
|
Launches the
Python help
window |
14 |
Acquire Image |
|
Acquires new
image from the
image source
configured in
the Scorpion
profile and
displays it in
the image window
on the main
Scorpion window. |
15 |
Inspect Image |
|
Inspects the
currently loaded
image in the
Scorpion. |
The mouse right
click on the
editor window
pops up a menu
bar which
contains
following menus
-
|
1 |
Insert |
Pops up the
standard
'Select......'
dialog box, used
for parameters
selection. The
left hand side
pane lists all
the accessible
tools. When a
tool from the
left hand side
pane is
selected, all
accessible
parameters
associated with
that tool are
displayed in the
right hand side
pane. User can
select any
parameter and
click on the
'OK' button. The
text indicating
the selected
tool and the
selected
parameter is
pasted at the
current location
in the editor
window. This is
recommended way
of using the
tools and
parameter texts
in the script,
as it eliminates
the possibility
of spelling
mistakes and
typing mistakes
and avoids
debugging
efforts
associated with
such issues.
When a text is
selected which
has a tool name
associated with
it, and 'Insert
Parameter as
Text' toolbar
button is
clicked, it pops
up the
'Select.....'
dialog box in
the context of
the tool
selection, that
is the left hand
side tool
selection pone
is not available
in this case,
only the list of
parameters
associated with
the currently
selected tool is
displayed. |
2 |
Undo |
Undoes the
previous
operation done
in the editor
window |
3 |
Cut |
Standard
'Cut' operation
which cuts the
selected text
and puts it on
the clipboard,
so that it is
available for
the 'Paste'
operation |
4 |
Copy |
Standard
'Copy' operation
which puts the
selected text on
the clipboard,
so that it is
available for
the the 'Paste'
operation |
5 |
Paste |
Standard
'Paste'
operation which
pastes the text
available on the
clipboard, to
the current
location in the
editor window |
6 |
Select all |
Selects all text
available in the
editor |
7 |
Comment block |
Comments all
lines from the
selected block
of text |
8 |
Uncomment block |
Uncomments
all lines from
the selected
block of text |
9 |
Font |
Pops up
standard 'Font'
dialog box,
which can be
used to change
the font of the
text displayed
in the editor
window |
10 |
Line numbers |
Shows /
hides the line
number column at
the left hand
side of the
editor window
|
11 |
Console window |
Shows /
hides the Python
console window.
Python console
shows the
messages from
the Python
engine and any
messages output
from the
executed Python
script. These
messages are
useful in
checking the
status and
debugging
operations.
Please refer to
the
console
for more
information
about the
console window |
12 |
Python Help |
Launches the
Python help
window |
The 'Apply' button available on the right hand
side, can be clicked any time to test the
currently written Python script. If there are
any errors in the script execution, those are
displayed in the status bar, in the Console
Window and in the System Log. Please refer to
the
Python Debugging topic to
know more about Python script debugging.
Basic Processing
when the tool is executed:
1. Executes the Python script coded in the
script editor window
Inputs to the
Tool: |
Inputs: |
None.
However the
configured
Python script
may access
several
resources
available in the
Scorpion,
including the
tools and global
variables. |
Uses Reference: |
No. However
the configured
Python script
may access and
use the
available
references
internally. |
Uses Image: |
No. However
the configured
Python script
may access and
use the image(s)
internally. |
|
|
Outputs
from the Tool: |
Outputs: |
1 |
Value: |
Numeric |
A result value which can be set by the configured Python script during script execution. This can be used by other tools as result from the PythonScript tool, for further processing in those tools. |
2 |
Text: |
Text |
A result value which can be set by the configured Python script during script execution. This can be used by other tools as result from the PythonScript tool, for further processing in those tools. |
3 |
StatusText: |
Text |
This is a standard output from all Scorpion tools and describes the processing status |
4 |
Status: |
Numeric |
This is a standard output from all Scorpion tools and indicates error/success of the tool processing. 1 indicates success and 0 indicates error |
5 |
AnalyzeTime: |
Numeric |
This is a standard output from all Scorpion tools and indicates the time taken by the last processing operation of this tool
|
|
Visualizations: |
None |
Reference
outputs: |
None |
|
|
Templates: |
Supports
Templates: |
Yes |
|
|
|