CadQuery cqgi.NoOutputError: Script did not call show_object

Diagnostic signature

NoOutputError

cadquery.cqgi.NoOutputError is raised when a CadQuery script executed via the CadQuery Gateway Interface (CQGI) completes its execution without invoking show_object() to pass geometry to the environment.

What it means

In CadQuery's gateway interface (CQGI), scripts are executed in an environment where output geometry must be explicitly registered via the show_object() callback. The NoOutputError exception signifies that the parsed script finished executing its Python statements but registered zero geometric shapes with the environment collector.

Why it happens

When CQModel.build() executes a CadQuery script, it provides a ScriptCallback instance that exposes show_object() in the execution namespace. If the script constructs geometry using CadQuery workplanes or shapes but does not pass any final solid or compound to show_object(), the callback's output list remains empty. CQModel.build() checks whether any output shapes were collected; when none are present, it creates and attaches a NoOutputError instance to the BuildResult exception property and marks execution success as False.

Minimal reproduction

import cadquery.cqgi as cqgi

script_code = """
import cadquery as cq

# Geometry is generated but never exported to the CQGI runtime
box = cq.Workplane('XY').box(10, 20, 30)
"""

model = cqgi.parse(script_code)
build_result = model.build()

if not build_result.success:
    raise build_result.exception

How to fix it

Invoke show_object() in the CadQuery script to export the constructed 3D shape or workplane to the CQGI execution environment.

```python
import cadquery.cqgi as cqgi

script_code = """
import cadquery as cq

box = cq.Workplane('XY').box(10, 20, 30)
show_object(box)
"""

model = cqgi.parse(script_code)
build_result = model.build()

if not build_result.success:
    raise build_result.exception

print(f"Built {len(build_result.results)} output shape(s).")

```

Step 1

Step 2

Step 3

Upstream references

cadquery v2.7.0 — cadquery.cqgi.NoOutputError — retrieved 2026-08-11

The CadQuery Gateway Interface