Python Command: Inspection

The Inspection commands in Python let you modify a running inspection. These commands only function while a Formula test is running in a sub-inspection.

See Special Variables for Python variables that apply to Inspections.

See Python commands for other commands you can use with GainSeeker.

 

Contents  [Hide]

 

Commands

Syntax

Example

Description/Remarks

New or changed in GainSeeker version

inspect.cursubi.addfile(label, path)

inspect.cursubi.addfile("item label", "C:\\Users\\myfile.txt")

Deprecated - use inspect.sidepanel.addfile instead.

Adds a file or image to the side panel after the Python script completes.

 

inspect.cursubi.addwebpage(label, url)

inspect.cursubi.addwebpage("item label", "www.google.com")

Deprecated - use inspect.sidepanel.addwebpage instead.

Adds a webpage to the side panel after the Python script completes.

 

inspect.cursubi.anchorpoint

inspect.cursubi.anchorpoint = True

Marks all SPC records on the current sub-inspection as an anchor point.

Gets or sets whether all SPC records on the current sub-inspection will be marked as an anchor point.

This property is initialized to False ("not an anchor point") when a sub-inspection is loaded and after a sub-inspection is submitted.

If this property is True, it sets the Anchor Point for the sub-inspection and overrides all test-specific settings for Anchor Point.

 

inspect.cursubi.cancel()

inspect.cursubi.cancel()

Cancels the current sub-inspection.

This is equivalent to clicking the Cancel button except that GainSeeker will not display the warning message about unsaved data being lost.

The inspection will advance properly based on the inspect.setnextsubi or inspect.setnextinspection commands.

8.8

inspect.cursubi.checkbox(idx).enabled

where idx is the TestID property of the test.

inspect.cursubi.checkbox(0).enabled = False

You can disable or enable a checkbox test in a running inspection. The value of the test can be set through Python code, regardless of whether it is enabled or disabled.

If the test is required, but disabled, and there is no value, the sub-inspection information cannot be submitted. The default is True.

 

inspect.cursubi.checkbox(idx).eventdms

where idx is the TestID property of the test.

inspect.cursubi.checkbox(0).eventdms = "New raw material lot"

Gets/Sets the DMS Event field for this test only.

When setting this field, you must specify the DMS Event description, not the 1-digit short code for the DMS Event. The value must already exist in the DMS Event list or it is ignored.

For this test, this DMS Event overrides a DMS Event test on the sub-inspection.

9.1

inspect.cursubi.checkbox(idx).gettrace(index)

where idx is the TestID property of the test

and index is the traceability field number.

inspect.cursubi.checkbox(0).gettrace(3)

Gets the value of traceability field 3 that was set for this test only by executing the inspect.cursubi.checkbox(0).settrace(3, value) command or by setting the TestSpecificTrace property for this test.

Gets the value of a traceability field that was set for this test only by executing the corresponding inspect.cursubi.checkbox(idx).settrace command or by setting the TestSpecificTrace property for this test.

8.7

inspect.cursubi.checkbox(idx).required

where idx is the TestID property of the test.

inspect.cursubi.checkbox(0).required = True

Sets the EntryRequired Checkbox test property to true.

Gets or sets the value of the EntryRequired Checkbox test property.

8.7

inspect.cursubi.checkbox(idx).settrace(index, value)

where idx is the TestID property of the test

and index is the traceability field number.

inspect.cursubi.checkbox(0).settrace(3, "E1403")

Sets traceability field 3 to "E1403" for this test only.

Sets the value of a traceability field for this test only.

Takes precedence over all other methods that might set this traceability value (e.g., value pre-filled by inspection or planned inspection, value entered by user, value set by other Python commands, test-specific properties that might set this traceability value, etc.).

Value is automatically cleared from the current traceability buffer after the sub-inspection is submitted or cancelled.

8.7

inspect.cursubi.checkbox(idx).value

where idx is the TestID property of the test.

inspect.cursubi.checkbox(0).value = True

Sets the checkbox test status to checked.

Gets or sets the check status of the test. True is checked, False is unchecked.

 

inspect.cursubi.checkbox(idx).verticalsize

where idx is the TestID property of the test.

inspect.cursubi.checkbox(0).verticalsize = 1

This sets the display height of the Checkbox test to Short.

Gets or sets the display height of the test.

Valid options are 0 (Regular) and 1 (Short).

9.1

inspect.cursubi.checkbox(idx).visible

where idx is the TestID property of the test.

inspect.cursubi.checkbox(0).visible = False

This sets the Checkbox test to 'not visible'.

Gets or sets whether the Checkbox test will be visible.

Valid options are True (visible) and False (not visible).

If not visible, it cannot be interacted with, and no data will be stored for this test.

9.1

inspect.cursubi.clearsidepanel

inspect.cursubi.clearsidepanel = True

This clears the side panel in PC Collect.

Deprecated - use inspect.sidepanel.clear() instead.

When set to True, clears any side panel items that existed before the Python script was launched. (Side panel items are actually cleared when the Python script finishes.)

 

inspect.cursubi.datetime(idx).datetime

where idx is the TestID property of the test.

inspect.cursubi.datetime(0).datetime = 20180101165959333

This sets the Date Time test to display January 1, 2018 at 4:59 PM. (Display formatting my vary based on the Region settings for the workstation.)

Gets or sets the date/time displayed for this test.

Return value is a 17-digit integer. To convert that value to a readable dat/time string, use the hsidate.formatdbdate command.

To set this value, specify a 17-digit integer that represents the desired date/time stamp. To convert a readable date/time string to this integer format, use the hsidate.format_to_db command.

 

inspect.cursubi.datetime(idx).enabled

where idx is the TestID property of the test.

inspect.cursubi.datetime(0).enabled = False

You can disable or enable a Date Time test in a running inspection. The value of the test can be set through Python code, regardless of whether it is enabled or disabled.

If the test is required, but disabled, and there is no value, the sub-inspection information cannot be submitted. The default is True.

 

inspect.cursubi.datetime(idx).visible

where idx is the TestID property of the test.

inspect.cursubi.datetime(0).visible = False

This sets the Date/Time test to 'not visible'.

Gets or sets whether the Date/Time test will be visible.

Valid options are True (visible) and False (not visible).

If not visible, this test cannot be interacted with, and its value will not be stored with the data.

9.1

inspect.cursubi.defectlist(idx).defects

where idx is the TestID property of the test.

inspect.cursubi.defectlist(0).defects = ["Broken", "Burned"]

Sets the available defects in the Defect List to "Broken" and "Burned".

Gets or sets defect names in the Defect List.

Any defect names that do not exist in GainSeeker will be ignored.

 

inspect.cursubi.defectlist(idx).enabled

where idx is the TestID property of the test.

inspect.cursubi.defectlist(0).enabled = False

You can disable or enable a Defect List test in a running inspection. The value of the test can be set through Python code, regardless of whether it is enabled or disabled.

If the test is required, but disabled, and there is no value, the sub-inspection information cannot be submitted. The default is True.

 

inspect.cursubi.defectlist(idx).eventdms

where idx is the TestID property of the test.

inspect.cursubi.defectlist(0).eventdms = "New raw material lot"

Gets/Sets the DMS Event field for this test only.

When setting this field, you must specify the DMS Event description, not the 1-digit short code for the DMS Event. The value must already exist in the DMS Event list or it is ignored.

For this test, this DMS Event overrides a DMS Event test on the sub-inspection.

9.1

inspect.cursubi.defectlist(idx).getforcenote()

where idx is the TestID property of the test.

inspect.cursubi.defectlist(idx).getforcenote()

Gets the ForceNote property for this test.

Gets the ForceNote property for this test.

This property determines whether to require entry of notes and/or corrective actions when a defect is present on this test.

Return value is a list in the format [ecat, note].

ecat will be one of these:

note will be either True (require Note entry) or False (do not require Note entry). If ecat is -1 (use the sub-inspection ForceNote property), this reflects the setting from the sub-inspection.

9.1

inspect.cursubi.defectlist(idx).gettrace(index)

where idx is the TestID property of the test

and index is the traceability field number.

inspect.cursubi.defectlist(0).gettrace(3)

Gets the value of traceability field 3 that was set for this test only by executing the inspect.cursubi.defectlist(0).settrace(3, value) command or by setting the TestSpecificTrace property for this test.

Gets the value of a traceability field that was set for this test only by executing the corresponding inspect.cursubi.defectlist(idx).settrace command or by setting the TestSpecificTrace property for this test.

8.7

inspect.cursubi.defectlist(idx).getvalue(index)

where idx is the TestID property of the test and where index is the index of the defect in the list of defects for the test.

print inspect.cursubi.defectlist(0).getvalue(0)

Prints the count of the first defect in the Defect List.

Returns the count of the defect at the specified index, with 0 being the first defect in the Defect List.

 

inspect.cursubi.defectlist(idx).ncu

where idx is the TestID property of the test.

inspect.cursubi.defectlist(0).ncu = 2

Sets the number of non-conforming units of the test to 2.

Gets or sets the non-conforming units of the Defect List.

 

inspect.cursubi.defectlist(idx).note

where idx is the TestID property of the test.

inspect.cursubi.defectlist(0).note = "My note"

Sets the note for this test.

Gets or sets the note for this Defect List test.

 

inspect.cursubi.defectlist(idx).overrideprocess

where idx is the TestID property of the test.

inspect.cursubi.defectlist(0).overrideprocess = "B-Mixing"

Sets the Defects property to use the process "B-Mixing" for displaying defects and storing data for this test.

Gets or sets the portion of the Defects property that uses a specific Process for displaying defects and storing data for this Defect List test - regardless of the Process set for the Inspection (or Planned Inspection).

 

inspect.cursubi.defectlist(idx).samplesize

where idx is the TestID property of the test.

inspect.cursubi.defectlist(0).samplesize = 5

Sets the sample size of the test to 5.

Gets or sets the sample size of the Defect List.

 

inspect.cursubi.defectlist(idx).setforcenote(ecat, note)

where idx is the TestID property of the test.

inspect.cursubi.defectlist(0).setforcenote(-1)

Sets this test to use the sub-inspection ForceNote property.

inspect.cursubi.defectlist(0).setforcenote(1, True)

Inspector will be required to enter an Event and a Note when a defect is present for this test.

Sets the ForceNote property for this test.

This property determines whether to require entry of notes and/or corrective actions when a defect is present on this test.

ecat must be one of these:

For the note parameter:

  • If ecat is -1 (use the sub-inspection ForceNote property), the note is ignored and can be omitted.

  • If ecat is anything else:

    • To require Note entry, specify True for this parameter.

    • To specify that Note entry is not required, you can omit this parameter or specify False .

9.1

inspect.cursubi.defectlist(idx).settrace(index, value)

where idx is the TestID property of the test

and index is the traceability field number.

inspect.cursubi.defectlist(0).settrace(3, "E1403")

Sets traceability field 3 to "E1403" for this test only.

Sets the value of a traceability field for this test only.

Takes precedence over all other methods that might set this traceability value (e.g., value pre-filled by inspection or planned inspection, value entered by user, value set by other Python commands, test-specific properties that might set this traceability value, etc.).

Value is automatically cleared from the current traceability buffer after the sub-inspection is submitted or cancelled.

8.7

inspect.cursubi.defectlist(idx).setvalue(index, value)

where idx is the TestID property of the test and where index is the index of the defect in the list of defects for the test.

inspect.cursubi.defectlist(0).setvalue(0, 5)

Sets the count of the first defect to 5 in the Defect List.

Sets the count of the defect at the specified index to the count of value, with 0 being the index of the first defect.

The defect count can be set to a value greater than 1, even when the test's ButtonMode property is SingleSelect or MultiSelect.

 

inspect.cursubi.dmspart(idx).enabled

where idx is the TestID property of the test.

inspect.cursubi.dmspart(0).enabled = False

You can disable or enable a DMS Standard test in a running inspection. The value of the test can be set through Python code, regardless of whether it is enabled or disabled.

If the test is required, but disabled, and there is no value, the sub-inspection information cannot be submitted. The default is True.

 

inspect.cursubi.dmspart(idx).partnumber

where idx is the TestID property of the test.

inspect.cursubi.dmspart(0).partnumber = "A-50 INSERT"

Gets or sets the DMS part number displayed on this test. This property has the same behavior as interactively setting a value in this test.

To clear any existing value from this test, set this to None.

8.7

inspect.cursubi.getforcenote()

inspect.cursubi.getforcenote()

Gets the sub-inspection ForceNote property.

Gets the ForceNote property for the sub-inspection.

This property determines whether to require entry of notes and/or corrective actions when there is a defect or real-time failure on the sub-inspection. (Individual tests also have their own ForceNote properties which can override portions of this setting.)

Return value is a list in the format [ecat, note].

ecat will be one of these:

  • 0 - No corrective actions are required.

  • The sum of the individual corrective actions required:

    • 1 - Event

    • 2 - Cause

    • 4 - Action Taken

    • For example, when both Cause and Action Taken are required, ecat will be 6 (2 for Cause + 4 for Action Taken)

  • 8 - At least one of Event, Cause, or Action Taken is required.

note will be either True (require Note entry) or False (do not require Note entry).

9.1

inspect.cursubi.gettesttype(idx)

where idx is the TestID property of the test.

print inspect.cursubi.gettesttype("machine")

Finds the test where TestID = "machine" and returns the corresponding type of test (such as "TRACEABILITY").

Returns the type of test that corresponds to the specified TestID.

For a test type that cannot be modified by Python commands (such as Formula or Line Break), this will return None.

Otherwise, this command returns one of the following strings:

"NUMERICINPUT"

"DATETIME"

"TRACEABILITY"

"PASSFAIL"

"CHECKBOX"

"DEFECTLIST"

"DMSSTANDARD"

"TEXT"

"TIMER"

"RATING"

See also:

inspect.cursubi.testidlist

inspect.cursubi.ni(idx).rtfvalue

8.9

inspect.cursubi.name

print inspect.cursubi.name

Returns the name of the current sub-inspection.

 

inspect.cursubi.ni(idx).actiontaken

where idx is the TestID property of the test.

inspect.cursubi.ni(0).actiontaken = "Replaced Fill Hose"

Gets/Sets the Action Taken field for this test only.

When setting this field, you must specify the Long Description for the Action Taken, not the Short Description. The value must already exist in the Action Taken list or it is ignored.

For this test, this Action Taken overrides an Action Taken test on the sub-inspection.

9.1

inspect.cursubi.ni(idx).anchorpoint

where idx is the TestID property of the test.

inspect.cursubi.ni(0).anchorpoint = True

Gets/Sets the Anchor Point field for this test only.

Valid options are True (test is marked as an Anchor Point) or False (test is not an Anchor Point).

If inspect.cursubi.anchorpoint is True, that sets the Anchor Point for the sub-inspection and overrides this test-specific setting.

9.1

inspect.cursubi.ni(idx).cause

where idx is the TestID property of the test.

inspect.cursubi.ni(0).cause = "Fill Hose Plugged"

Gets/Sets the Cause field for this test only.

When setting this field, you must specify the Long Description for the Cause, not the Short Description. The value must already exist in the Cause list or it is ignored.

For this test, this Cause overrides a Cause test on the sub-inspection.

9.1

inspect.cursubi.ni(idx).celllabels

where idx is the TestID property of the test.

inspect.cursubi.ni(idx).celllabels = ["Cavity 1", "Cavity 2", "Cavity 3"]

Gets/Sets the list of labels to display for individual data cells in the Numeric Input test, such as the default list ["Data 1", "Data2", etc.] or a custom list like ["Cavity 1", "Cavity 2", etc.] .

8.8

inspect.cursubi.ni(idx).deviceprofile

where idx is the TestID property of the test.

inspect.cursubi.ni(0).deviceprofile = "Acme Caliper on Com Port 3"

Gets/Sets the device profile currently associated with the numeric input test, None if keyboard entry.

 

inspect.cursubi.ni(idx).enabled

where idx is the TestID property of the test.

inspect.cursubi.ni(0).enabled = False

You can disable or enable a Numeric Input test in a running inspection. The value of the test can be set through Python code, regardless of whether it is enabled or disabled.

If the test is required, but disabled, and there is no value, the sub-inspection information cannot be submitted. The default is True.

 

inspect.cursubi.ni(idx).eventspc

where idx is the TestID property of the test.

inspect.cursubi.ni(0).eventspc = "Changeover"

Gets/Sets the SPC Event field for this test only.

When setting this field, you must specify the Long Description for the SPC Event, not the Short Description. The value must already exist in the SPC Event list or it is ignored.

For this test, this SPC Event overrides an SPC Event test on the sub-inspection.

9.1

inspect.cursubi.ni(idx).getforcenote()

where idx is the TestID property of the test.

inspect.cursubi.ni(idx).getforcenote()

Gets the ForceNote property for this test.

Gets the ForceNote property for this test.

This property determines whether to require entry of notes and/or corrective actions when there is a real-time failure on this test.

Return value is a list in the format [ecat, note].

ecat will be one of these:

  • -1 - Use the sub-inspection ForceNote property.

  • 0 - No corrective actions are required.

  • The sum of the individual corrective actions required:

    • 1 - Event

    • 2 - Cause

    • 4 - Action Taken

    • For example, when both Cause and Action Taken are required, ecat will be 6 (2 for Cause + 4 for Action Taken)

  • 8 - At least one of Event, Cause, or Action Taken is required.

note will be either True (require Note entry) or False (do not require Note entry). If ecat is -1 (use the sub-inspection ForceNote property), this reflects the setting from the sub-inspection.

9.1

inspect.cursubi.ni(idx).gettrace(index)

where idx is the TestID property of the test

and index is the traceability field number.

inspect.cursubi.ni(0).gettrace(3)

Gets the value of traceability field 3 that was set for this test only by executing the inspect.cursubi.ni(0).settrace(3, value) command or by setting the TestSpecificTrace property for this test.

Gets the value of a traceability field that was set for this test only by executing the corresponding inspect.cursubi.ni(idx).settrace command or by setting the TestSpecificTrace property for this test.

8.7

inspect.cursubi.ni(idx).label

where idx is the TestID property of the test.

inspect.cursubi.ni("length").label = "Enter Length data"

inspect.cursubi.ni("weight").label = None

Gets or sets the Label property of this Numeric Input test.

Use None for a blank Label property.

 

inspect.cursubi.ni(idx).labelabovecell

where idx is the TestID property of the test.

inspect.cursubi.ni("weight").labelabovecell = True

If set to True, turns on the display of cell labels (Data 1, Data 2, etc., or custom labels set by inspect.cursubi.ni(idx).celllabels) above every cell. The larger Subgroup message will still be displayed above these cell labels.

Defaults to False.

8.8

inspect.cursubi.ni(idx).note

where idx is the TestID property of the test.

inspect.cursubi.ni(0).note = "My note"

Sets the note associated with this test.

Gets or sets the note associated with this numeric input test.

 

inspect.cursubi.ni(idx).novaluemode

where idx is the TestID property of the test.

inspect.cursubi.ni("length").novaluemode = 2

Set the "No Value Mode" for this test to "DoNotStore".

Gets or sets the NoValue property for this numeric input test.

0 = RequireEntry, 1 = StoreSentinel, and 2 = DoNotStore.

 

inspect.cursubi.ni(idx).partno

where idx is the TestID property of the test.

inspect.cursubi.ni(0).partno = "Temp 1250"

Sets the part number associated with this test.

Gets or sets the part number associated with this numeric input test.

 

inspect.cursubi.ni(idx).rtfvalue

where idx is the TestID property of the test.

x = inspect.cursubi.ni(7).rtfvalue & 1024

if x == 1024:

print "Data above spec"

Prints a message if the Numeric Input test with TestID 7 failed the Upper Spec Limit.

Returns a number representing the combined real-time failures for the specified Numeric Input test.

For a reference of the failures represented by the returned number, see Real-time Failure codes.

See also:

inspect.cursubi.gettesttype(idx)

inspect.cursubi.testidlist

 

inspect.cursubi.ni(idx).search

where idx is the TestID property of the test.

inspect.cursubi.ni(0).search = "Temp"

Sets the SPCStandardSearchString Numeric Input test property associated with this test.

Gets or sets the SPCStandardSearchString associated with this numeric input test.

 

inspect.cursubi.ni(idx).setforcenote(ecat, note)

where idx is the TestID property of the test.

inspect.cursubi.ni(0).setforcenote(-1)

Sets this test to use the sub-inspection ForceNote property.

 

inspect.cursubi.ni(0).setforcenote(8, True)

Sets the ForceNote property for this test.

    • Inspector will be required to enter at least one of Event, Cause, or Action Taken.

    • Inspector will be required to enter a Note.

Sets the ForceNote property for this test.

This property determines whether to require entry of notes and/or corrective actions when there is a real-time failure on this test.

ecat must be one of these:

  • -1 - Use the sub-inspection ForceNote property.

  • 0 - No corrective actions are required.

  • The sum of the individual corrective actions you want to require:

    • 1 - Event

    • 2 - Cause

    • 4 - Action Taken

    • For example, to require both Cause and Action Taken, specify an ecat of 6 (2 for Cause + 4 for Action Taken)

  • 8 - Require at least one of Event, Cause, or Action Taken.

For the note parameter:

  • If ecat is -1 (use the sub-inspection ForceNote property), the note is ignored and can be omitted.

  • If ecat is anything else:

    • To require Note entry, specify True for this parameter.

    • To specify that Note entry is not required, you can omit this parameter or specify False .

9.1

inspect.cursubi.ni(idx).settrace(index, value)

where idx is the TestID property of the test

and index is the traceability field number.

inspect.cursubi.ni(0).settrace(3, "E1403")

Sets traceability field 3 to "E1403" for this test only.

Sets the value of a traceability field for this test only.

Takes precedence over all other methods that might set this traceability value (e.g., value pre-filled by inspection or planned inspection, value entered by user, value set by other Python commands, test-specific properties that might set this traceability value, etc.).

Value is automatically cleared from the current traceability buffer after the sub-inspection is submitted or cancelled.

8.7

inspect.cursubi.ni(idx).subgroupcomplete

where idx is the TestID property of the test.

inspect.cursubi.ni(idx).subgroupcomplete

Checks whether all fields in the subgroup have been filled with either a number or * (missing data value). Returns True if subgroup is complete and False if any of the fields in the subgroup are empty.

 

inspect.cursubi.ni(idx).subgroupsize

where idx is the TestID property of the test.

print inspect.cursubi.ni(0).subgroupsize

Prints the subgroup size of the test.

Gets the subgroup size associated with this numeric input test.

If the SPCStandardSelection property of the Numeric Input test is set to DoNotStore, you can use this command to set the subgroup size (number of input boxes) for this Numeric Input test. Common practice is to execute this type of command in a Formula test with the FormulaMode property set to Pre.

Selecting the SPC standard ("part number") for the numeric input test will reset the subgroup size to the value in the standard.

 

inspect.cursubi.ni(idx).values

where idx is the TestID property of the test.

inspect.cursubi.ni(0).values = [2.5, 12.4]

Sets the values associated with this test.

Gets or sets the values of each cell of this numeric input test as a list. The list length must match the number of cells in the test. Use None to clear the cell.

 

inspect.cursubi.ni(idx).verticalsize

where idx is the TestID property of the test.

inspect.cursubi.ni(0).verticalsize = 1

This sets the display height of the Numeric Input test to Short.

Gets or sets the display height of the test.

Valid options are 0 (Regular) and 1 (Short).

9.1

inspect.cursubi.ni(idx).visible

where idx is the TestID property of the test.

inspect.cursubi.ni("Length").visible = False

 

if inspect.cursubi.ni(0).visible == True:
  inspect.cursubi.text(4).text = "Begin test."

This command gets or sets the visible status of the specified numeric input test - when running either an inspection or a planned inspection. When the sub-inspection is submitted, no data will be stored for a numeric input test that is hidden.

If a planned inspection sets the numeric input test to be hidden, using this command to make this test visible will not display any charts configured for this test.

If the numeric input test is not hidden by a planned inspection, and the SPC standard has been set by either the inspection or a planned inspection, using this command to hide this test will not hide any charts configured for this test. This is true even if the command is triggered by a Pre script.

 

inspect.cursubi.note

inspect.cursubi.note = "My note"

Gets or sets the current sub-inspection note.

 

inspect.cursubi.passfail(idx).enabled

where idx is the TestID property of the test.

inspect.cursubi.passfail(0).enabled = False

You can disable or enable a Pass/Fail/NA test in a running inspection. The value of the test can be set through Python code, regardless of whether it is enabled or disabled.

If the test is required, but disabled, and there is no value, the sub-inspection information cannot be submitted. The default is True.

 

inspect.cursubi.passfail(idx).eventdms

where idx is the TestID property of the test.

inspect.cursubi.passfail(0).eventdms = "New raw material lot"

Gets/Sets the DMS Event field for this test only.

When setting this field, you must specify the DMS Event description, not the 1-digit short code for the DMS Event. The value must already exist in the DMS Event list or it is ignored.

For this test, this DMS Event overrides a DMS Event test on the sub-inspection.

9.1

inspect.cursubi.passfail(idx).getforcenote()

where idx is the TestID property of the test.

inspect.cursubi.passfail(idx).getforcenote()

Gets the ForceNote property for this test.

Gets the ForceNote property for this test.

This property determines whether to require entry of notes and/or corrective actions when a defect is present on this test.

Return value is a list in the format [ecat, note].

ecat will be one of these:

note will be either True (require Note entry) or False (do not require Note entry). If ecat is -1 (use the sub-inspection ForceNote property), this reflects the setting from the sub-inspection.

9.1

inspect.cursubi.passfail(idx).gettrace(index)

where idx is the TestID property of the test

and index is the traceability field number.

inspect.cursubi.passfail(0).gettrace(3)

Gets the value of traceability field 3 that was set for this test only by executing the inspect.cursubi.passfail(0).settrace(3, value) command or by setting the TestSpecificTrace property for this test.

Gets the value of a traceability field that was set for this test only by executing the corresponding inspect.cursubi.passfail(idx).settrace command or by setting the TestSpecificTrace property for this test.

8.7

inspect.cursubi.passfail(idx).note

where idx is the TestID property of the test.

inspect.cursubi.passfail(0).note = "My note"

Sets the note for the test.

Gets or sets the note for the Pass/Fail/NA test.

 

inspect.cursubi.passfail(idx).setforcenote(ecat, note)

where idx is the TestID property of the test.

inspect.cursubi.passfail(0).setforcenote(-1)

Sets this test to use the sub-inspection ForceNote property.

inspect.cursubi.passfail(0).setforcenote(1, True)

Inspector will be required to enter an Event and a Note when a defect is present for this test.

Sets the ForceNote property for this test.

This property determines whether to require entry of notes and/or corrective actions when a defect is present on this test.

ecat must be one of these:

For the note parameter:

  • If ecat is -1 (use the sub-inspection ForceNote property), the note is ignored and can be omitted.

  • If ecat is anything else:

    • To require Note entry, specify True for this parameter.

    • To specify that Note entry is not required, you can omit this parameter or specify False .

9.1

inspect.cursubi.passfail(idx).settrace(index, value)

where idx is the TestID property of the test

and index is the traceability field number.

inspect.cursubi.passfail(0).settrace(3, "E1403")

Sets traceability field 3 to "E1403" for this test only.

Sets the value of a traceability field for this test only.

Takes precedence over all other methods that might set this traceability value (e.g., value pre-filled by inspection or planned inspection, value entered by user, value set by other Python commands, test-specific properties that might set this traceability value, etc.).

Value is automatically cleared from the current traceability buffer after the sub-inspection is submitted or cancelled.

8.7

inspect.cursubi.passfail(idx).value

where idx is the TestID property of the test.

inspect.cursubi.passfail(0).value = 1

Sets the test to "Fail".

Gets or sets the status of the Pass/Fail/NA test.

Valid options for this status are:

-1 = Not set (no button selected)

0 = Pass button selected

1 = Fail button selected

2 = N/A button selected (only valid if ShowNA = True, otherwise will display an error message)

8.9

inspect.cursubi.passfail(idx).verticalsize

where idx is the TestID property of the test.

inspect.cursubi.passfail(0).verticalsize = 1

This sets the display height of the Pass/Fail/NA test to Short.

Gets or sets the display height of the test.

Valid options are 0 (Regular) and 1 (Short).

9.1

inspect.cursubi.passfail(idx).visible

where idx is the TestID property of the test.

inspect.cursubi.passfail(0).visible = False

This sets the Pass/Fail/NA test to 'not visible'.

Gets or sets whether the Pass/Fail/NA test will be visible.

Valid options are True (visible) and False (not visible).

If not visible, it cannot be interacted with, and no data will be stored for this test.

9.1

inspect.cursubi.rating(idx).actiontaken

where idx is the TestID property of the test.

inspect.cursubi.rating(0).actiontaken = "Replaced Fill Hose"

Gets/Sets the Action Taken field for this test only.

When setting this field, you must specify the Long Description for the Action Taken, not the Short Description. The value must already exist in the Action Taken list or it is ignored.

For this test, this Action Taken overrides an Action Taken test on the sub-inspection.

9.1

inspect.cursubi.rating(idx).anchorpoint

where idx is the TestID property of the test.

inspect.cursubi.rating(0).anchorpoint = True

Gets/Sets the Anchor Point field for this test only.

Valid options are True (test is marked as an Anchor Point) or False (test is not an Anchor Point).

If inspect.cursubi.anchorpoint is True, that sets the Anchor Point for the sub-inspection and overrides this test-specific setting.

9.1

inspect.cursubi.rating(idx).cause

where idx is the TestID property of the test.

inspect.cursubi.rating(0).cause = "Fill Hose Plugged"

Gets/Sets the Cause field for this test only.

When setting this field, you must specify the Long Description for the Cause, not the Short Description. The value must already exist in the Cause list or it is ignored.

For this test, this Cause overrides a Cause test on the sub-inspection.

9.1

inspect.cursubi.rating(idx).datastorage

where idx is the TestID property of the test.

inspect.cursubi.rating(0).datastorage = 3

Sets this Rating test to store both SPC and DMS data.

 

myvar = inspect.cursubi.rating(0).datastorage

Sets the myvar variable to the value of the test's DataStorage property.

Gets or sets the DataStorage property for this test, which determines what type(s) of data will be stored.

Must be one of the following numbers:

0 = DoNotStore

1 = SPC

2 = DMS

3 = Both

9.1

inspect.cursubi.rating(idx).enabled

where idx is the TestID property of the test.

inspect.cursubi.rating(0).enabled = False

You can disable or enable a Rating test in a running inspection. The value of the test can be set through Python code, regardless of whether it is enabled or disabled.

If the test is required, but disabled, and there is no value, the sub-inspection information cannot be submitted. The default is True.

9.1

inspect.cursubi.rating(idx).eventdms

where idx is the TestID property of the test.

inspect.cursubi.rating(0).eventdms = "New raw material lot"

Gets/Sets the DMS Event field for this test only.

When setting this field, you must specify the DMS Event description, not the 1-digit short code for the DMS Event. The value must already exist in the DMS Event list or it is ignored.

For this test, this DMS Event overrides a DMS Event test on the sub-inspection.

9.1

inspect.cursubi.rating(idx).eventspc

where idx is the TestID property of the test.

inspect.cursubi.rating(0).eventspc = "Changeover"

Gets/Sets the SPC Event field for this test only.

When setting this field, you must specify the Long Description for the SPC Event, not the Short Description. The value must already exist in the SPC Event list or it is ignored.

For this test, this SPC Event overrides an SPC Event test on the sub-inspection.

9.1

inspect.cursubi.rating(idx).getcolor(value)

where idx is the TestID property of the test.

myvar = inspect.cursubi.rating(0).getcolor(5)

Sets the myvar variable to the color of the button with value 5.

For one Rating button, this returns the color that will be displayed when that button is selected.

value determines which button you are working with. Valid options are:

  • numeric value of the button: an integer from inspect.cursubi.rating(idx).min to inspect.cursubi.rating(idx).max

  • 10 = N/A button selected (only valid if inspect.cursubi.rating(idx).showna is True)

Options for the return value are:

  • If the button uses the default color, this returns None.

  • If the button color was set by editing the ButtonSettings on the property grid, this returns the color's rgb (hex) value.

  • If the button color was set by inspect.cursubi.rating(idx).setcolor, this will return that value as it was set - either the color's rgb (hex) value or its colorname.

9.1

inspect.cursubi.rating(idx).getdefect(value)

where idx is the TestID property of the test.

myvar = inspect.cursubi.rating(0).getdefect(5)

Sets the myvar variable to the name of the defect that is set for the button with value 5.

For one Rating button, this returns the name of the DMS defect that will be stored if that button is selected.

value determines which button you are working with. Valid options are:

  • numeric value of the button: an integer from inspect.cursubi.rating(idx).min to inspect.cursubi.rating(idx).max

  • 10 = N/A button selected (only valid if inspect.cursubi.rating(idx).showna is True)

If the return value is None, then the button is not configured with a defect.

9.1

inspect.cursubi.rating(idx).getforcenote()

where idx is the TestID property of the test.

inspect.cursubi.rating(idx).getforcenote()

Gets the ForceNote property for this test.

Gets the ForceNote property for this test.

This property determines whether to require entry of notes and/or corrective actions when a defect is present on this test.

Return value is a list in the format [ecat, note].

ecat will be one of these:

note will be either True (require Note entry) or False (do not require Note entry). If ecat is -1 (use the sub-inspection ForceNote property), this reflects the setting from the sub-inspection.

9.1

inspect.cursubi.rating(idx).getlabel(value)

where idx is the TestID property of the test.

myvar = inspect.cursubi.rating(0).getlabel(5)

Sets the myvar variable to the label on the button with value 5.

For one Rating button, this returns that button's label.

value determines which button you are working with. Valid options are:

  • numeric value of the button: an integer from inspect.cursubi.rating(idx).min to inspect.cursubi.rating(idx).max

  • 10 = N/A button selected (only valid if inspect.cursubi.rating(idx).showna is True)

9.1

inspect.cursubi.rating(idx).gettrace

where idx is the TestID property of the test.

inspect.cursubi.rating(0).gettrace(3)

Gets the value of traceability field 3 that was set for this test only by executing the inspect.cursubi.rating(0).settrace(3, value) command or by setting the TestSpecificTrace property for this test.

Gets the value of a traceability field that was set for this test only by executing the corresponding inspect.cursubi.rating(idx).settrace command or by setting the TestSpecificTrace property for this test.

9.1

inspect.cursubi.rating(idx).label

where idx is the TestID property of the test.

inspect.cursubi.rating(0).label = "Crispiness Rating"

Sets the label displayed above the Rating test to "Crispiness Rating".

Gets or sets the text label displayed at the top of the test.

For a blank label, use None.

9.1

inspect.cursubi.rating(idx).max

where idx is the TestID property of the test.

inspect.cursubi.rating(0).max = 7

Sets the maximum Rating value to 7.

 

myvar = inspect.cursubi.rating(0).max

Sets the myvar variable to the test's maximum Rating value.

Gets or sets the Maximum property (maximum Rating value) for this test.

  • Must be an integer from 1 to 9.

  • Must be greater than inspect.cursubi.rating(idx).min

When setting this property, the display will update after the Python script completes.

9.1

inspect.cursubi.rating(idx).min

where idx is the TestID property of the test.

inspect.cursubi.rating(0).min = 1

Sets the minimum Rating value to 1.

 

myvar = inspect.cursubi.rating(0).min

Sets the myvar variable to the test's minimum Rating value.

Gets or sets the Minimum property (minimum Rating value) for this test.

  • Must be an integer from 0 to 8.

  • Must be less than inspect.cursubi.rating(idx).max

When setting this property, the display will update after the Python script completes.

9.1

inspect.cursubi.rating(idx).note

where idx is the TestID property of the test.

inspect.cursubi.rating(0).note = "My note"

Sets the note for the test.

Gets or sets the note for the Rating test.

9.1

inspect.cursubi.rating(idx).partno

where idx is the TestID property of the test.

inspect.cursubi.rating(0).partno = "Temp 1250"

If the SPC standard "Temp 1250" exists, this sets the SPC standard for this test to "Temp 1250".

 

myvar = inspect.cursubi.rating(0).partno

Sets the myvar variable to the name of the test's SPC standard.

Gets or sets the StandardSPC property for this Rating test.

When setting the SPC standard, that standard must already exist in GainSeeker.

9.1

inspect.cursubi.rating(idx).samplesize

where idx is the TestID property of the test.

inspect.cursubi.rating(0).samplesize = 5

Sets the sample size of the Rating test to 5.

Gets or sets the SampleSize property for this Rating test.

Sample size must be a number greater than or equal to 0. (The default sample size for a new Rating test is 1.)

9.1

inspect.cursubi.rating(idx).secondrowbeginswith

where idx is the TestID property of the test.

inspect.cursubi.rating(0).secondrowbeginswith = 4

Configures this test to display a second row of buttons, starting with the button with value "4".

 

myvar = inspect.cursubi.rating(0).secondrowbeginswith

Sets the myvar variable to the value of the SecondRowBeginsWith property for this test.

Gets or sets the SecondRowBeginsWith property for this test.

Must be one of the following integers:

  • numeric value of the button: an integer from (inspect.cursubi.rating(idx).min + 1) to inspect.cursubi.rating(idx).max

  • -1 = All On First Row

  • 10 = N/A button selected (only valid if inspect.cursubi.rating(idx).showna is True)

When setting this property, the display will update after the Python script completes.

9.1

inspect.cursubi.rating(idx).setcolor(value, newColor)

where idx is the TestID property of the test.

inspect.cursubi.rating(0).setcolor(5, "red")

When the button with value 5 is selected, it will be colored red.

For one Rating button, this sets the color that will be displayed when that button is selected.

value determines which button you are working with. Valid options are:

  • numeric value of the button: an integer from inspect.cursubi.rating(idx).min to inspect.cursubi.rating(idx).max

  • 10 = N/A button selected (only valid if inspect.cursubi.rating(idx).showna is True)

newColor is the string for the new color. You may specify the color's rgb (hex) value or its colorname. (For a full list of colornames - such as "red", "orange", "yellow", "green", "blue", "white", and many more - see https://www.colorcodehex.com/html-color-names.html or http://cng.seas.rochester.edu/CNG/docs/x11color.html.) The text color is always black, so best practice is to avoid a dark color for the button.

To clear the button color, specify a newColor of None.

9.1

inspect.cursubi.rating(idx).setdefect(value, newDefect)

where idx is the TestID property of the test.

inspect.cursubi.rating(0).setdefect(5, "Burn")

When the button with value 5 is selected, any DMS record saved for this test will have the defect "Burn".

For one Rating button, this sets the DMS defect that will be stored if that button is selected.

value determines which button you are working with. Valid options are:

  • numeric value of the button: an integer from inspect.cursubi.rating(idx).min to inspect.cursubi.rating(idx).max

  • 10 = N/A button selected (only valid if inspect.cursubi.rating(idx).showna is True)

newDefect is the defect name. This defect must already exist in GainSeeker.

To clear any defects from the button, specify a newDefect of None.

9.1

inspect.cursubi.rating(idx).setforcenote(ecat, note)

where idx is the TestID property of the test.

inspect.cursubi.rating(0).setforcenote(-1)

Sets this test to use the sub-inspection ForceNote property.

inspect.cursubi.rating(0).setforcenote(1, True)

Inspector will be required to enter an Event and a Note when a defect is present for this test.

Sets the ForceNote property for this test.

This property determines whether to require entry of notes and/or corrective actions when a defect is present on this test.

ecat must be one of these:

For the note parameter:

  • If ecat is -1 (use the sub-inspection ForceNote property), the note is ignored and can be omitted.

  • If ecat is anything else:

    • To require Note entry, specify True for this parameter.

    • To specify that Note entry is not required, you can omit this parameter or specify False .

9.1

inspect.cursubi.rating(idx).setlabel(value, newlabel)

where idx is the TestID property of the test.

inspect.cursubi.rating(0).setlabel(5, "5: Burned")

Configures the label for button value 5 to display "5: Burned".

For one Rating button, this sets the label that will be displayed.

value determines which button you are working with. Valid options are:

  • numeric value of the button: an integer from inspect.cursubi.rating(idx).min to inspect.cursubi.rating(idx).max

  • 10 = N/A button selected (only valid if inspect.cursubi.rating(idx).showna is True)

newlabel is the string for the new label. To use the default label for that button's value (such as '1: ' for button value 1), use a blank string ('').

9.1

inspect.cursubi.rating(idx).setncu

where idx is the TestID property of the test.

inspect.cursubi.rating(0).setncu = True

Configures this Rating test so that selecting a Rating with a defect sets NCU=1 in the DMS data record.

 

myvar = inspect.cursubi.rating(0).setncu

Sets the myvar variable to the value of the SetNCU property for the Rating test.

Gets or sets the value of the SetNCU property for the Rating test.

This property determines whether selecting a Rating with a defect will set the NCU (nonconforming units) field in the DMS data record for the Rating test.

Valid options are True (selecting a Rating with a defect sets NCU=1) or False (selecting a Rating with a defect does not affect NCU).

9.1

inspect.cursubi.rating(idx).settrace

where idx is the TestID property of the test.

inspect.cursubi.rating(0).settrace(3, "E1403")

Sets traceability field 3 to "E1403" for this test only.

Sets the value of a traceability field for this test only.

Takes precedence over all other methods that might set this traceability value (e.g., value pre-filled by inspection or planned inspection, value entered by user, value set by other Python commands, test-specific properties that might set this traceability value, etc.).

Value is automatically cleared from the current traceability buffer after the sub-inspection is submitted or cancelled.

9.1

inspect.cursubi.rating(idx).showna

where idx is the TestID property of the test.

inspect.cursubi.rating(0).showna = True

Configures this Rating test so that an "N/A" button is added to the end of the Rating scale.

 

myvar = inspect.cursubi.rating(0).showna

Sets the myvar variable to the value of the ShowNA property for the Rating test.

Gets or sets the value of the ShowNA property for the Rating test.

Valid options are True (display an "N/A" button at the end of the Rating scale) or False (do not add an "NA" button).

9.1

inspect.cursubi.rating(idx).trace

where idx is the TestID property of the test.

inspect.cursubi.rating(0).trace = 6

Configures this Rating test to store the label of the selected Rating button in traceability field 6.

 

myvar = inspect.cursubi.rating(0).trace

Sets the myvar variable to the traceability field number where the label of the selected Rating button will be stored.

Gets or sets the TraceField property for this test - the traceability field number where the label of the selected Rating button will be stored.

Must be either a valid traceability field number (1 - 48) or 0 to clear the traceability field.

9.1

inspect.cursubi.rating(idx).valuelabel

where idx is the TestID property of the test.

myvar = inspect.cursubi.rating(0).valuelabel

Sets the myvar variable to the label of the currently selected Rating button.

Returns the label for the currently selected Rating button.

If no rating has been selected, this returns None.

9.1

inspect.cursubi.rating(idx).valuenumber

where idx is the TestID property of the test.

inspect.cursubi.rating(0).valuenumber = 3

Selects the Rating button with the value of 3.

 

myvar = inspect.cursubi.rating(0).valuenumber

Sets the myvar variable to the numeric value of the currently selected Rating button.

Sets a Rating or returns the selected Rating for this test. Setting the Rating is equivalent to the inspector selecting a Rating button.

Must be one of the following integers:

  • numeric value of the button: an integer from inspect.cursubi.rating(idx).min to inspect.cursubi.rating(idx).max

  • -1 = no Rating button selected

  • 10 = N/A button selected (only valid if inspect.cursubi.rating(idx).showna is True)

When setting this property, the display will update after the Python script completes.

9.1

inspect.cursubi.rating(idx).verticalsize

where idx is the TestID property of the test.

inspect.cursubi.rating(0).verticalsize = 1

This sets the display height of the Rating test to Short.

Gets or sets the display height of the test.

Valid options are 0 (Regular) and 1 (Short).

9.1

inspect.cursubi.rating(idx).visible

where idx is the TestID property of the test.

inspect.cursubi.rating(0).visible = False

This sets the Rating test to 'not visible'.

Gets or sets whether the Rating test will be visible.

Valid options are True (visible) and False (not visible).

If not visible, it cannot be interacted with, and no data will be stored for this test.

9.1

inspect.cursubi.selectsidepanelitem(item)

inspect.cursubi.selectsidepanelitem("Flowchart")

Displays the side panel tab labeled "Flowchart".

 

inspect.cursubi.selectsidepanelitem(1)

Displays whatever side panel tab is second from the right.

Deprecated - use inspect.sidepanel.selectitem instead.

Displays the specified side panel tab.

item must be one of these:

  • A string containing the text label for the desired side panel tab - for example, the label for an image, thumbnail text for a document, or chart name for GainSeeker data.

  • A number that corresponds to the order in which items are displayed on the side panel, counting from right (index 0) to left.

    For example: on a side panel with four tabs, the right-most tab is number 0, the next is number 1, the next is number 2, and the left-most tab is number 3.

 

inspect.cursubi.setforcenote(ecat, note)

inspect.cursubi.setforcenote(8, True)

Sets the sub-inspection ForceNote property.

    • Inspector will be required to enter at least one of Event, Cause, or Action Taken.

    • Inspector will be required to enter a Note.

 

inspect.cursubi.setforcenote(0, False)

Sets the sub-inspection ForceNote property to "None". No notes or corrective actions are required.

Sets the ForceNote property for the sub-inspection.

This determines whether to require entry of notes and/or corrective actions when there is a defect or real-time failure on the sub-inspection. (Individual tests also have their own ForceNote properties which can override portions of this setting.)

ecat must be one of these:

  • 0 - No corrective actions are required.

  • The sum of the individual corrective actions you want to require:

    • 1 - Event

    • 2 - Cause

    • 4 - Action Taken

    • For example, to require both Cause and Action Taken, specify an ecat of 6 (2 for Cause + 4 for Action Taken)

  • 8 - Require at least one of Event, Cause, or Action Taken.

note must be either True (require Note entry) or False (do not require Note entry).

After the sub-inspection closes, this returns to the setting stored in the inspection.

9.1

inspect.cursubi.submit()

inspect.cursubi.submit()

This is equivalent to the user pressing the submit button, which triggers upon completing the current Python script. Submission fails if there are errors within the current sub-inspection.

 

inspect.cursubi.testidlist

inspect.cursubi.testidlist

Returns an unordered list of the TestIDs for the tests in the current sub-inspection.

See also:

inspect.cursubi.gettesttype(idx)  

inspect.cursubi.ni(idx).rtfvalue

 

inspect.cursubi.text(idx).text

where idx is the TestID property of the test.

inspect.cursubi.text(0).text = "Please follow instructions."

Gets or sets the text for the Text test.

 

inspect.cursubi.text(idx).verticalsize

where idx is the TestID property of the test.

inspect.cursubi.text(0).verticalsize = 1

This sets the display height of the Text test to Short.

Gets or sets the display height of the test.

Valid options are 0 (Regular) and 1 (Short).

9.1

inspect.cursubi.text(idx).visible

where idx is the TestID property of the test.

inspect.cursubi.text(0).visible = False

This sets the Text test to 'not visible'.

Gets or sets whether the Text test will be visible.

Valid options are True (visible) and False (not visible).

If not visible, it cannot be interacted with.

9.1

inspect.cursubi.timer(idx).actiontaken

where idx is the TestID property of the test.

inspect.cursubi.timer(0).actiontaken = "Replaced Fill Hose"

Gets/Sets the Action Taken field for this test only.

When setting this field, you must specify the Long Description for the Action Taken, not the Short Description. The value must already exist in the Action Taken list or it is ignored.

For this test, this Action Taken overrides an Action Taken test on the sub-inspection.

9.1

inspect.cursubi.timer(idx).anchorpoint

where idx is the TestID property of the test.

inspect.cursubi.timer(0).anchorpoint = True

Gets/Sets the Anchor Point field for this test only.

Valid options are True (test is marked as an Anchor Point) or False (test is not an Anchor Point).

If inspect.cursubi.anchorpoint is True, that sets the Anchor Point for the sub-inspection and overrides this test-specific setting.

9.1

inspect.cursubi.timer(idx).cause

where idx is the TestID property of the test.

inspect.cursubi.timer(0).cause = "Fill Hose Plugged"

Gets/Sets the Cause field for this test only.

When setting this field, you must specify the Long Description for the Cause, not the Short Description. The value must already exist in the Cause list or it is ignored.

For this test, this Cause overrides a Cause test on the sub-inspection.

9.1

inspect.cursubi.timer(idx).eventspc

where idx is the TestID property of the test.

inspect.cursubi.timer(0).eventspc = "Changeover"

Gets/Sets the SPC Event field for this test only.

When setting this field, you must specify the Long Description for the SPC Event, not the Short Description. The value must already exist in the SPC Event list or it is ignored.

For this test, this SPC Event overrides an SPC Event test on the sub-inspection.

9.1

inspect.cursubi.timer(idx).gettrace(index)

where idx is the TestID property of the test

and index is the traceability field number.

inspect.cursubi.timer(0).gettrace(3)

Gets the value of traceability field 3 that was set for this test only by executing the inspect.cursubi.timer(0).settrace(3, value) command or by setting the TestSpecificTrace property for this test.

Gets the value of a traceability field that was set for this test only by executing the corresponding inspect.cursubi.timer(idx).settrace command or by setting the TestSpecificTrace property for this test.

8.9

inspect.cursubi.timer(idx).settrace(index, value)

where idx is the TestID property of the test

and index is the traceability field number.

inspect.cursubi.passfail(0).settrace(3, "E1403")

Sets traceability field 3 to "E1403" for this test only.

Sets the value of a traceability field for this test only.

Takes precedence over all other methods that might set this traceability value (e.g., value pre-filled by inspection or planned inspection, value entered by user, value set by other Python commands, test-specific properties that might set this traceability value, etc.).

Value is automatically cleared from the current traceability buffer after the sub-inspection is submitted or cancelled.

8.9

inspect.cursubi.timer(idx).value

where idx is the TestID property of the test.

inspect.cursubi.timer(0).value

Gets the current value of the Timer test.

8.8

inspect.cursubi.timer(idx).verticalsize

where idx is the TestID property of the test.

inspect.cursubi.timer(0).verticalsize = 1

This sets the display height of the Timer test to Short.

Gets or sets the display height of the test.

Valid options are 0 (Regular) and 1 (Short).

9.1

inspect.cursubi.timer(idx).visible

where idx is the TestID property of the test.

inspect.cursubi.timer(0).visible = False

This sets the Timer test to 'not visible'.

Gets or sets whether the Timer test will be visible.

Valid options are True (visible) and False (not visible).

If not visible, it cannot be interacted with, and no data will be stored for this test.

9.1

inspect.cursubi.trace(idx).enabled

where idx is the TestID property of the test.

inspect.cursubi.trace(0).enabled = False

You can disable or enable a Traceability test in a running inspection. The value of the test can be set through Python code, regardless of whether it is enabled or disabled.

If the test is required, but disabled, and there is no value, the sub-inspection information cannot be submitted. The default is True.

 

inspect.cursubi.trace(idx).label

where idx is the TestID property of the test.

inspect.cursubi.trace(0).label = "Enter your 4-digit employee number:"

Gets or sets the label displayed to the user for a Traceability test.

 

inspect.cursubi.trace(idx).list

where idx is the TestID property of the test.

inspect.cursubi.trace(0).list = ["Machine 1", "Machine 2", "Machine3"]

Sets three values that can be selected by the operator.

inspect.cursubi.trace("SKUs").list = traceability.getprioritylist(6)

Changes the drop-down list for a traceability test with the Test ID "SKUs" to the priority list set up for traceability field 6 for the current GainSeeker user.

Gets or sets the list of items the operator can select for the Traceability test.

 

inspect.cursubi.trace(idx).required

where idx is the TestID property of the test.

inspect.cursubi.trace(0).required = True

Sets the EntryRequired test property to true.

Gets or sets the value of the EntryRequired Traceability test property.

 

inspect.cursubi.trace(idx).value

where idx is the TestID property of the test.

inspect.cursubi.trace(0).value = "Machine 1"

This sets the value of the traceability to "Machine 1"

Gets or sets the value of the Traceability test.

 

inspect.cursubi.trace(idx).verticalsize

where idx is the TestID property of the test.

inspect.cursubi.trace(0).verticalsize = 1

This sets the display height of the Traceability test to Short.

Gets or sets the display height of the test.

Valid options are 0 (Regular) and 1 (Short).

When the test is set to the DMS Event, SPC Event, SPC Cause or SPC Action Taken, changes to this setting are ignored.

9.1

inspect.cursubi.trace(idx).visible

where idx is the TestID property of the test.

inspect.cursubi.trace(0).visible = False

This sets the Traceability test to 'not visible'.

Gets or sets whether the Traceability test will be visible.

Valid options are True (visible) and False (not visible).

If not visible:

  • this test cannot be interacted with, and its value will not be stored with the data.

  • this test will not set or change any traceability value shared with another inspection or sub-inspection.

9.1

inspect.datetime

inspect.datetime = "3/4/2015 13:45"

print inspect.datetime

Gets or sets the datetime for the inspection. This does not affect a Date/Time test on the current sub-inspection.

 

inspect.dmspartnumber

inspect.dmspartnumber = "My part"

print inspect.dmspartnumber

Gets or sets the DMS standard for the inspection.

For any sub-inspection, this is the equivalent of a DMS standard that was set by a DMS Standard test on a previous sub-inspection.

If the current sub-inspection has a DMS Standard test, use inspect.cursubi.dmspart(idx).partnumber to change the DMS standard instead of inspect.dmspartnumber.

Side panel charts for the sub-inspection will not reflect the new DMS standard until the inspector triggers a chart update by submitting data, changing the value of a Traceability test, or changing the value of a DMS Standard test.

 

inspect.gettracevalue(index)

print inspect.gettracevalue(2)

Prints the traceability value for trace 2.

Returns the value of the specified traceability.

 

inspect.messagearea.color

inspect.messagearea.color = "Red"

Sets the sub-inspection message area background color to Red.

 

inspect.messagearea.color = "#00FF00"

Sets the sub-inspection message area background color to Lime.

Gets or sets the background color for the sub-inspection message area.

The sub-inspection message area is the blank space next to the Cancel button at the bottom of the sub-inspection. (This area is larger if the PictureMode and VideoMode properties for the sub-inspection are both Off.)

You may specify the color's rgb (hex) value or its colorname. (For a full list of colornames - such as "red", "orange", "yellow", "green", "blue", "white", and many more - see https://www.colorcodehex.com/html-color-names.html or http://cng.seas.rochester.edu/CNG/docs/x11color.html.) The text color is always black, so best practice is to avoid a dark color for the background.

This will persist across sub-inspections and inspections until the list of sub-inspections or inspections is displayed.

To clear the background color, set this to None or a blank string.

8.8

inspect.messagearea.script

inspect.messagearea.script = "my script 3"

Converts the sub-inspection message area into a clickable button that runs the existing script named "my script 3".

Gets or sets the Python script that is run when the message area is clicked.

The sub-inspection message area is the blank space next to the Cancel button at the bottom of the sub-inspection. (This area is larger if the PictureMode and VideoMode properties for the sub-inspection are both Off.)

To convert the message area into a clickable button, set this to the name of a GainSeeker Python script. The script being called must exist in the GainSeeker Inspections module.

This will persist across sub-inspections and inspections until the list of sub-inspections or inspections is displayed.

When the inspector clicks this message area button, the testid variable is set to "[MESSAGEAREA]".

To turn off the clickable button, set this to None or a blank string.

9.1

inspect.messagearea.text

inspect.messagearea.text = "Sample passed all tests"

Displays the specified text string in the sub-inspection message area.

Gets or sets the text string for display in the sub-inspection message area.

The sub-inspection message area is the blank space next to the Cancel button at the bottom of the sub-inspection. (This area is larger if the PictureMode and VideoMode properties for the sub-inspection are both Off.)

GainSeeker will dynamically size the font so that the entire text string is displayed.

This will persist across sub-inspections and inspections until the list of sub-inspections or inspections is displayed.

To clear the text string, set this to None or a blank string.

8.8

inspect.name

print inspect.name

Returns the name of the inspection.

 

inspect.persist["mykey"]

This first line of code is executed in one inspection:

inspect.persist["name"] = "Bob"

This second line of code is executed in another inspection:

print inspect.persist["name"]

The value printed on the second line should be "Bob"

Stores values between inspections. Variables are normally kept for the lifetime of a running inspection, so any information that must be passed between inspections may be stored using inspect.persist.

"mykey" must be a string and is case-sensitive.

For any "mykey", you can set its persistent value to a string or number.

Note: any data stored is not saved after the Inspection Viewer window closes.

 

inspect.process

print inspect.process

Returns the Process property for the inspection.

8.8

inspect.setnextinspection(name, isPlannedInspection)

inspect.setnextinspection("Final Inspection")

After the inspector submits or cancels the current sub-inspection, PC Collect automatically opens the specified inspection ("Final Inspection").

inspect.setnextinspection("SKU 1400 Final Inspection", True)

After the inspector submits or cancels the current sub-inspection, PC Collect automatically opens the specified inspection planned inspection ("SKU 1400 Final Inspection").

inspect.setnextinspection(None)

After the inspector submits or cancels the current sub-inspection, PC Collect automatically displays the list of inspections.

 

inspect.setnextinspection(None, True)

After the inspector submits or cancels the current sub-inspection, PC Collect automatically displays the list of planned inspections.

Determines the inspection or planned inspection to open after the inspector submits or cancels the current sub-inspection.

name is the name of the Inspection or Planned Inspection to open. To display a list of Inspections or Planned Inspections, set this to None .

When isPlannedInspection is set to False, this command refers to Inspections. When set to True, it refers to Planned Inspections.

Overrides the CancelButtonBehavior sub-inspection property and inspect.setnextsubi command (below).

 

inspect.setnextsubi(name)

inspect.setnextsubi("sub-inspection name")

After the inspector submits or cancels the current sub-inspection, PC Collect automatically opens the specified sub-inspection.

 

inspect.setnextsubi(None)

After the inspector submits or cancels the current sub-inspection, PC Collect automatically displays the list of sub-inspections for the current inspection.

Determines the sub-inspection to open after the inspector submits or cancels the current sub-inspection.

Set to None to navigate back to the list of sub-inspections.

Overrides the AutoAdvance inspection property, CancelButtonBehavior sub-inspection property, and inspect.setnextinspection command (above).

 

inspect.setprocess(process, partno=None)

inspect.setprocess("P-MOLDING")

Sets the Inspection process to "P-MOLDING".


newproc = "M-CUT OFF"

newpart = "A-50 INSERT"

# setprocess sets part and proc regardless of if they exist or not

if not inspect.setprocess(newproc, newpart):

    # part/proc combo does not exist, create it

    stddms.partno = newpart

    stddms.process = newproc

    # set any other properties here

    stddms.storestd()

 

Sets the Inspection process to "M-CUT OFF" and the Inspection part number to "A-50 INSERT". If a standard does not exist for this combination, create the standard. If this process does not exist, create the process.


newproc = "M-CUT OFF"

newpart = "A-50 INSERT"

# set process

inspect.setprocess(newproc)

# update DMS Standard test; set part number for this subi and rest of inspection

inspect.cursubi.dmspart("part").partnumber = newpart

# update list of defects and sample size for Defect List test

stddms.loadstd(newpart, newproc)

inspect.cursubi.defectlist("defects").defects = stddms.getalldefectlabelsforproc()

inspect.cursubi.defectlist("defects").samplesize = stddms.samplesize

 

Sets the Inspection process to "M-CUT OFF".

Sets the DMS Standard test on this sub-inspection to the combination of Part Number "A-50 INSERT" and the new process.

Sets the Defect List test on this sub-inspection to display the defect list from the new process and the sample size from the new standard.

Sets the process - and optionally, the part number - for the inspection. The value(s) set by this command will be stored in the UniqueID.

Parameters:

process cannot be blank or None.

If you specify a partno, GainSeeker updates the current DMS standard with the new process and the new partno. You can specify a blank string to clear the partno.
If you do not specify a partno, GainSeeker only updates the process portion of the current DMS standard.

Return value:

This command always sets the DMS standard for the inspection - even if no DMS standard exists for this combination of partno and process. It returns True if a DMS standard exists for the resulting combination of partno and process. It returns False if there is no DMS standard for this combination of partno and process.

You should check this return value and use the stddms commands to create the standard and the process if they do not exist.

Notes:

This is easiest to implement by using an initial sub-inspection to run this command and set the process and part number, with no DMS Standard tests or tests that store DMS Data on the sub-inspection.

  • These values will be detected and used by all the other sub-inspections where you run all of your tests.

  • A DMS Standard test in a later sub-inspection will clear the original standard if it does not exist for the Part Number configured in the Inspection and the new Process set by this command.

If you must run this command on a sub-inspection that contains other tests, you must be aware of issues such as the following:

  • If the current sub-inspection has a DMS Standard test, this command will not change the Part Number shown on that test or the process used to display a list of DMS standards. If you use this command to change the partno, you should also use inspect.cursubi.dmspart(idx).partnumber to update the DMS Standard test. Please note that when the sub-inspection is submitted, any Part Number displayed on the DMS Standard test will override a Part Number set by this command - so best practice is to either set them to the same value or remove the DMS Standard test from the sub-inspection.

  • If the current sub-inspection has a Defect List test that displays the defects for the current process, this command will not update the defect buttons to reflect the new process. If desired, you can use the inspect.cursubi.defectlist(idx).defectlist command to do this. Similarly, you can use the inspect.cursubi.defectlist(idx).samplesize command to update the sample size to match the new standard.

  • Side panel charts for the sub-inspection will not reflect the new DMS standard until the inspector triggers a chart update by submitting data, changing the value of a Traceability test, or changing the value of a DMS Standard test.

9.1

inspect.settracevalue(index, value)

inspect.settracevalue(5, "Machine 345")

This sets traceability 5 to "Machine 345".

Sets the value of the specified traceability. This does not affect any Traceability tests on the current sub-inspection.

 

inspect.shutdown()

inspect.shutdown()

Closes the PC Collect module and immediately stops execution of the script.

If executed by a Formula test with the FormulaMode property set to Post - which executes the formula after the data for the sub-inspection is submitted - the data will be submitted before the PC Collect module is closed.

8.7

inspect.sidepanel.addfile(label, path)

inspect.sidepanel.addfile("Comments", "C:\\Users\\myfile.txt")

Adds the specified file to a side panel tab labeled "Comments".

Adds a file or image to the side panel.

label specifies how this item's side panel tab will be labeled.

path specifies the file or image to add.

Changes to the side panel are displayed after the Python script completes.

8.9

inspect.sidepanel.addwebpage(label, url)

inspect.sidepanel.addwebpage("Search", "www.google.com")

Adds the specified URL to a side panel tab labeled "Search".

Adds a webpage to the side panel.

label specifies how this item's side panel tab will be labeled.

url specifies the webpage to add.

Changes to the side panel are displayed after the Python script completes.

8.9

inspect.sidepanel.clear()

inspect.sidepanel.clear()

Clears all items from the side panel.

Clears all items from the side panel.

Changes to the side panel are displayed after the Python script completes.

Note: If the script also changes one of the following, the charts will be redrawn after all the items have been cleared:

  • Traceability value

  • DMS Process

  • DMS Standard

  • SPC Standard (for a Numeric Input test)

8.9

inspect.sidepanel.count

panelcount = inspect.sidepanel.count

Sets the value of a panelcount variable to the current number of side panel tabs.

Gets the number of current side panel tabs.

8.9

inspect.sidepanel.frontonrefresh

inspect.sidepanel.frontonrefresh = False

Prevents side panel charts from automatically moving to the left-most position when the sub-inspection is submitted.

Determines what happens to existing side panel tabs when submitting a sub-inspection will refresh a chart.

  • When set to True (the default):

    Submitting the sub-inspection will automatically move the tab for that chart to the left-most position and display the updated chart to the inspector.

  • When set to False:

    Submitting the sub-inspection will not move any tabs on the side panel. However, it will still display the left-most tab to the inspector.

This will persist across sub-inspections and inspections until the list of sub-inspections or inspections is displayed.

8.9

inspect.sidepanel.itemtofront(item)

inspect.sidepanel.itemtofront("Flowchart")

Moves the tab labeled "Flowchart" to the left-most position on the side panel, and displays this item (after the Python script completes).

 

inspect.sidepanel.itemtofront(1)

Moves the tab that is currently in the second-from-the-right position on the side panel to the left-most position, and displays this item (after the Python script completes).

 

inspect.sidepanel.itemtofront("Control Plan")

inspect.sidepanel.itemtofront("Flowchart")

inspect.sidepanel.itemtofront("Overview")

This script moves 3 items in sequence to the left-most position on the side panel.

The result is a side panel where the first three tabs (from left to right) are "Overview", "Flowchart", and "Control Plan".

The "Overview" tab is displayed because it was the most recent item to be moved.

Moves the specified side panel tab to the front (left-most) position and displays that item to the inspector. Changes to the side panel are displayed after the Python script completes.

item must be one of these:

  • A string containing the text label for the desired side panel tab - for example, the label for an image, thumbnail text for a document, or chart name for GainSeeker data. (If two or more tabs use the same label, you may get unexpected results.)

  • A number that corresponds to the order in which items are displayed on the side panel, counting from right (index 0) to left.

    For example: on a side panel with four tabs, the right-most tab is number 0, the next is number 1, the next is number 2, and the left-most tab is number 3.

Using this command to re-order the tabs on the side panel will also re-order the labels returned by the inspect.sidepanel.labels command (below).

To control what happens to existing side panel tabs when submitting a sub-inspection will refresh a chart, see inspect.sidepanel.frontonrefresh.

8.9

inspect.sidepanel.labels

tablist = inspect.sidepanel.labels

Sets the value of a tablist variable to the current list of side panel tab labels.

Gets the list of current side panel tab labels, in order.

8.9

inspect.sidepanel.selectitem(item)

inspect.sidepanel.selectitem("Flowchart")

Displays the side panel tab labeled "Flowchart".

 

inspect.sidepanel.selectitem(1)

Displays whatever side panel tab is second from the right.

Displays the specified side panel tab (after the Python script completes).

item must be one of these:

  • A string containing the text label for the desired side panel tab - for example, the label for an image, thumbnail text for a document, or chart name for GainSeeker data. (If two or more tabs use the same label, you may get unexpected results.)

  • A number that corresponds to the order in which items are displayed on the side panel, counting from right (index 0) to left.

    For example: on a side panel with four tabs, the right-most tab is number 0, the next is number 1, the next is number 2, and the left-most tab is number 3.

To control what happens to existing side panel tabs when submitting a sub-inspection will refresh a chart, see inspect.sidepanel.frontonrefresh.

8.9

inspect.storerecords

inspect.storerecords = False

Disables automatic storage of data records when the user Submits the current sub-inspection.

Disables or enables automatic storage of data records when the user Submits the current sub-inspection.

Set to False to disable automatic storage or True to (re-)enable automatic storage. Opening each sub-inspection automatically resets this to True.

This lets you create a sub-inspection where the user enters information on the sub-inspection, but you read the data they entered and then use other Python commands to create and store whatever records you need.

See also: datadms, dataspc

 

inspect.subinspectionlist

mysubinspections = inspect.subinspectionlist

Returns the list of sub-inspection names in the order in which they appear (top to bottom) for the current inspection.

8.9

inspect.uniqueid

print inspect.uniqueid

Returns the unique ID for this inspection.

You can configure GainSeeker to automatically clear unique IDs based on their age. However, if you want to delete the current unique ID immediately - for example, after the inspector indicates the inspection has been completed for this unique ID - see How to delete the current Unique ID.

 

inspect.update()

inspect.update()

A Python script that is programmed to change any part of the displayed inspection window will not actually update the display until the script completes.

You can use this command to force an update of the displayed inspection window during script execution.

 

How to delete the current Unique ID

When using the Unique ID to keep inspection settings such as traceability values entered, status of sub-inspections, etc., GainSeeker updates the Unique ID table with this inspection's latest information after the inspection closes. This means that you cannot use a Python script in the current inspection to delete that inspection's Unique ID. However, you can use the following technique to achieve the same result:

Step 1 - Set up a "Remove UniqueID" inspection

    1. Create a new Inspection and name it Remove UniqueID .

    2. On the first sub-inspection, set the AutoLoadSubInspection property to True .

    3. Add a Formula test to the first sub-inspection and configure its properties as follows:

    4. Save and publish this new inspection.

Step 2 - Add a formula to your data collection inspection

This formula asks the inspector to confirm that the inspection is complete for the current Unique ID. If complete, it runs the "Remove UniqueID" inspection.

    1. Edit the actual inspection whose Unique ID you want to delete when finished.

    2. Add a Formula test to the last sub-inspection and configure its properties as follows:

    3. Save and publish this inspection.