New in Version 2026

Custom checks

Custom checks always refer to a geometric target element, in most cases an actual element. Therefore the name of a check (or inspection) element is typically composed of the target element’s name and an abbreviation indicating the check’s purpose. For example, a radius check on the circle element ‘Circle 1’ could be named ‘Circle1.R’.

Checks can be applied to

  • Scalar element properties – e.g. a circle’s radius

  • Curves – e.g. deviation of a section curve’s points in z-direction

  • Surfaces – e.g. deviation of a surface curve’s points in z-direction

The check element computes the deviation between the reference element’s actual value(s) and its nominal value(s). The deviation value(s) can have a dimension (e.g. length).

Dialog definition

The dialog must contain

Caution

The element name widget object must be set to name in the Dialog Editor.

The dialog can optionally provide

Caution

The tolerances widget’s name must be set to tolerance in the Dialog Editor.

Custom check Python script

All custom elements are based on the Extensions API. More specifically, a custom check class is inherited from the ScriptedInspection base class.

Custom_Scalar_Check.py – Minimal example – Scripted scalar check
 1import gom
 2import gom.api.scripted_checks_util
 3import gom.api.extensions.inspections
 4
 5from gom import apicontribution
 6
 7@apicontribution
 8class MinimalScalarCheck (gom.api.extensions.inspections.Scalar):
 9
10    def __init__ (self):
11        super ().__init__ (
12            id='examples.custom_scalar_check',
13            description='Custom Scalar Check',
14            dimension='length',
15            abbreviation='ScrSca'
16        )
17
18    def dialog (self, context, args):
19        dlg = gom.api.dialog.create (context, '/Custom_Scalar_Check.gdlg')
20        # -------------------------------------------------------------------------
21        dlg.slct_element.filter = gom.api.scripted_checks_util.is_scalar_checkable
22        # -------------------------------------------------------------------------
23        self.initialize_dialog(context, dlg, args)
24
25        # Provide dialog handle in event()
26        self.dlg = dlg
27
28        return self.apply_dialog(dlg, gom.api.dialog.show(context, dlg))
29
30    def event(self, context, event_type, parameters):
31        """
32        Set Custom check's name: <target_element>.<abbreviation>
33        """
34        if event_type == 'dialog::initialized' or event_type == 'dialog::changed':
35            if parameters['values']['slct_element'] is not None:
36                self.dlg.name.value = self.dlg.slct_element.value.name + '.' + 'ScrSca'
37                return True
38
39        return False
40
41    def compute (self, context, values):
42        # ----------------------------------------------------
43        # --- insert your computation here -------------------
44        # ----------------------------------------------------
45        actual_result = 1.0
46        nominal_result = 2.0
47        # ----------------------------------------------------
48        return {
49            "nominal": nominal_result,
50            "actual":  actual_result,
51            "target_element": values['slct_element'],
52            "unit": values['unit']
53        }
54
55gom.run_api ()
line 2…5:

Import custom check specific packages.

line 7…8:

The class MinimalScalarCheck is inherited from gom.api.extensions.inspections.Scalar. The decorator @apicontribution allows to register the class MinimalScalarCheck in the ZEISS INSPECT framework.

line 10…16:

The constructor calls the super class constructor while defining unique contribution ID, (human readable) description, dimension and abbreviation.

line 18…28:

The dialog() method applies an element filter (see Selection element widget) and to copies the dialog handle to the member dlg for using in event().

line 30…39:

The event() method sets the custom check’s element name.

line 41…53:

The compute() method uses constant actual and nominal values for demonstration purposes.

line 55:

gom.run_api() is executed when the script is started as a service.

References