Python™ is an accessible scripting language that gives you access to greater functionality in GainSeeker. It allows you to automate customized data entry and analytics in a readable syntax. People who are familiar working with other programming or scripting languages are encouraged to explore the use of Python with GainSeeker.
See the Python website for more information about this scripting language.
Contents [Hide] |
GainSeeker maintains five separate lists of Python scripts, which you can use for:
Customizing Inspections for data entry in PC Collect, or running as standalone scripts (without Inspections) in PC Collect or in GS Console, or running as blocks of re-usable code (below)
Creating custom statistics
Charting external SPC data, and retrieving external SPC data in Dashboard controls such as dial and bar gages
Charting external DMS data, and retrieving external DMS data in Dashboard controls such as dial and bar gages
Embedding Python controls in Dashboards
This means that a script you create for dashboard controls will not
be displayed when you are working with inspections, for example.
You can also insert Python code into a Device Profile for RS-232 input in an Inspection.
If you find yourself re-creating the same block of code in multiple scripts, you can probably save time and error by creating that code block as a re-usable script! Here's how:
In the GainSeeker Inspections module, use the Manage Python feature to create a script containing only this block of code.
In another Python script, run this "code block" script by calling it with the misc.executescript command. (This command is not available for Custom Statistics or Device Profiles.)
The Python Script Editor is used to edit, debug, and manage your GainSeeker Python scripts. (The exceptions are custom statistics and Device Profiles, which use a different editor.)
The majority of your Python code will be standard Python 2.7x, but several specialized GainSeeker Python commands are also available.
Command |
Description |
Command Line arguments |
Confirm whether an argument exists, get the value of a command line argument, or view the entire argument string. See Command line argument commands |
Corrective Actions |
Perform various actions for corrective action values in the database. See Corrective Action commands |
Dashboard |
Open a dashboard or desktop, or refresh or close the current dashboard. See Dashboard commands |
Data DMS |
Store DMS data records to the database. See Data DMS commands |
Data SPC |
Store SPC data records in the database and optionally store them to the monitor table. See Data SPC commands |
Display |
Place controls on a form to show on the screen. See Display commands |
Sends email. See Email commands |
|
Error |
Access a listing of errors that can occur when running commands within GainSeeker's Python library. See Error commands |
File |
Manipulate Excel, CSV, TAB, and other text file types. See File commands |
HSI Date |
Access and format date and time information. See HSI Date commands |
Inspection |
Modify a running inspection. This command only functions while a Formula test is running in a sub-inspection. See Inspection commands |
Line chart and Bar chart |
Draw a simple line chart or bar chart in a custom dashboard or a Python script in PC Collect. See Line chart and Bar chart commands |
Login |
Retrieve information specific to the current GainSeeker User. See Login commands |
Miscellaneous |
Start and stop other processes not listed in another command group. See Miscellaneous commands |
MTConnect |
Interface with MTConnect agents. See MTConnect commands |
OPC |
Interface with OPC servers. See OPC commands |
Retrieval |
Manipulate the SPC and DMS retrieval as part of an executing Python script. Chart external data or create a scripted retrieval for dashboard controls. See Retrieval commands |
Serial Port |
Pass in functions that gather the data for each cell. See Serial Port commands |
Special Variables |
There are special Python variables that can be used in specific areas of GainSeeker. See Special Variables |
SQL |
Access a variety of SQL functions. See SQL commands |
Standard DMS |
Read and write DMS standards and set various attributes of them. See Standard DMS commands |
Standard SPC |
Read and write SPC standards and set various attributes of them. See Standard SPC commands |
Statistics |
View calculated statistics for an SPC or DMS retrieval. See Statistics commands |
TCP |
Connect to another device using the TCP/IP protocol. See TCP commands |
Traceability |
Retrieve, edit, update, delete, and insert traceability values in the database. See Traceability commands |
Over 550 Python library files are installed with GainSeeker in the PyLib folder. These library files can be imported and used as part of any Python script. They may be updated in future GainSeeker releases, therefore, you should not edit any of these files. If you want to add or change functionality, create new library files, which will not be changed in future GainSeeker releases.
The installation process copies the file TemplatePythonGuide.txt to the PyLib folder in the GainSeeker Installation folder. This file contains a list of all the template commands and the corresponding Python command to achieve the same results. This file is useful as templates are converted to Inspections or stand-alone Python scripts. The file is updated with each new version of the GainSeeker Suite.