Skip to content
Development version. Forge is under active development and testing. APIs, behaviour, coverage and verification results may be incomplete or change without notice; published PASS results are not a support guarantee or production-readiness claim.

Verification

Imported @assembly subassembly

An imported assembly returns reusable native component occurrences

Verified scpf Two 10 × 10 × 20 mm posts centered at X=-15 mm and X=15 mm

What this verifies

An imported PostPair assembly creates two occurrences of one Post definition without adding an extra geometry layer.

Expected setup

Imported @assembly subassembly expected setup diagram

Published scpf baseline: declared expected body envelopes. Conceptual projection, not verification output.

scpf source

Complete primary source from the site branch; built revision below.

scpf/model.py
"""Qualification: an imported @assembly compiles as a native subassembly."""

from subassembly import PostPair


class ImportedAssembly:
    def build(self):
        return PostPair()


ImportedAssembly()

Engineering explanation

Imported @assembly subassembly

Documentation provenance: the engineering text below is copied verbatim from the last canonical qualification/cases.py source before its removal, commit be40b09e7454a90e87d83768a9e7453c52ba5d76. Machine verification lives in verification/solidcraft.py.

Legacy group: components

Goal

Verify the public @assembly decorator on an imported reusable subassembly, independently of anchor or feature complexity.

Forge API

@component class Post; @assembly class PostPair; root model imports and returns PostPair()

Forge model

One reusable Post component definition plus two occurrences produced inside an imported @assembly factory. The root model treats the returned subassembly as ordinary assembly geometry.

How Forge builds it in SolidCraft

The Python-only @assembly wrapper disappears during lowering: Forge emits one Post component definition and one copied occurrence placed directly by occurrence.copy; no occurrence.move is needed.

SolidCraft result

Two identical 10 x 10 x 20 mm posts remain at X=-15 and X=+15 while the imported @assembly result builds from a replay-safe component/copy command plan.

Saved-design test

No saved-design mutation in this fixture; it isolates imported @assembly construction and native lowering.

Geometry evidence

Geometry-rationale provenance: copied verbatim from qualification/geometry_contracts.py at commit be40b09e7454a90e87d83768a9e7453c52ba5d76.

Bounds sufficient: true

This case adds reusable assembly construction around two rectangular posts; the geometry contribution is completely described by their bounds.

Reference notes

  • PythonSCAD — The public Python object/decorator layer should remain natural while still producing reusable native CAD structure.
  • SolidCraft — The resulting assembly must lower to native component/occurrence commands and build without special runtime handling.
Generated command sequence — scpf (4)

Open published command JSON

  1. component.create

    {
      "bind": {
        "$left": "occurrence"
      },
      "command": "component.create",
      "params": {
        "grounded": true,
        "name": "Post"
      }
    }
  2. solid.box

    {
      "command": "solid.box",
      "params": {
        "body_name": "Post",
        "corner": [
          -20.0,
          -5.0,
          0.0
        ],
        "height": 20,
        "length": 10,
        "operation": "new",
        "width": 10
      }
    }
  3. component.activate

    {
      "command": "component.activate",
      "params": {
        "component": "root"
      }
    }
  4. occurrence.copy

    {
      "bind": {
        "$right": "occurrence"
      },
      "command": "occurrence.copy",
      "params": {
        "component": "Post",
        "translate": [
          30.0,
          0.0,
          0.0
        ]
      }
    }

Reference code

cadquery source · pass

cadquery/model.py
"""CadQuery assembly reference for the reusable PostPair geometry."""

import cadquery as cq


post = cq.Solid.makeBox(
    10,
    10,
    20,
    cq.Vector(-5, -5, 0),
)

model = cq.Assembly()
model.add(post, name="left", loc=cq.Location((-15, 0, 0)))
model.add(post, name="right", loc=cq.Location((15, 0, 0)))
Published reference result

Independent implementation result.

build123d source · pass

build123d/model.py
"""build123d reference: two posts built from one reusable shape."""
from build123d import Align, Box, BuildPart, Locations

bottom = (Align.CENTER, Align.CENTER, Align.MIN)

with BuildPart() as model:
    with Locations((-15, 0, 0), (15, 0, 0)):
        Box(10, 10, 20, align=bottom)
Published reference result

Independent implementation result.

pythonscad source · pass

pythonscad/model.py
"""PythonSCAD geometry reference for the imported PostPair subassembly."""

from pythonscad import *

post = cube([10, 10, 20], center=True).up(10)
pair = post.left(15) | post.right(15)
model = pair
Published reference result

Independent implementation result.

pybosl2 source · pass

pybosl2/model.py
"""pyBOSL2 geometry reference for the PostPair subassembly."""

from pybosl2 import cuboid

post = cuboid([10, 10, 20]).up(10)
pair = post.left(15) | post.right(15)
model = pair
Published reference result

Independent implementation result.

Current visual verification — scpf

Each model-owned view is evaluated independently. Actual is the current native result; Goal is the declared expected profile; Overlay combines both; Diff compares the approved regression baseline.

front

pass

Regression: pass · expected shape: pass

Imported @assembly subassembly Actual visual verification
Actual
Imported @assembly subassembly Goal visual verification
Goal
Imported @assembly subassembly Overlay visual verification
Overlay
Imported @assembly subassembly Diff visual verification
Diff

right

pass

Regression: pass · expected shape: pass

Imported @assembly subassembly Actual visual verification
Actual
Imported @assembly subassembly Goal visual verification
Goal
Imported @assembly subassembly Overlay visual verification
Overlay
Imported @assembly subassembly Diff visual verification
Diff

iso

pass

Regression: pass · expected shape: pass

Imported @assembly subassembly Actual visual verification
Actual
Imported @assembly subassembly Goal visual verification
Goal
Imported @assembly subassembly Overlay visual verification
Overlay
Imported @assembly subassembly Diff visual verification
Diff

Image overview

Only images present in the published build are displayed. Presentation previews are not visual verification results.

Verification checks

scpf — pass

geometry / geometrypass
MeasurementExpectedMeasuredCheck
Bounds / max20 × 5 × 2020 × 5 × 20pass
Bounds / min-20 × -5 × 0-20 × -5 × 0pass
native / baselinepass
MeasurementExpectedMeasuredCheck
SolidCraft body count22pass
Body envelopes / count22pass
Body 1 / min [mm]-20 × -5 × 0-20 × -5 × 0—
Body 1 / max [mm]-10 × 5 × 20-10 × 5 × 20—
Body 2 / min [mm]10 × -5 × 010 × -5 × 0—
Body 2 / max [mm]20 × 5 × 2020 × 5 × 20—
visual / frontpass
visual / rightpass
visual / isopass

cadquery — pass

geometry / geometrypass
MeasurementExpectedMeasuredCheck
Bounds / max20 × 5 × 2020 × 5 × 20pass
Bounds / min-20 × -5 × 0-20 × -5 × 0pass

build123d — pass

geometry / geometrypass
MeasurementExpectedMeasuredCheck
Bounds / max20 × 5 × 2020 × 5 × 20pass
Bounds / min-20 × -5 × 0-20 × -5 × 0pass

pythonscad — pass

geometry / geometrypass
MeasurementExpectedMeasuredCheck
Bounds / max20 × 5 × 2020 × 5 × 20pass
Bounds / min-20 × -5 × 0-20 × -5 × 0pass

pybosl2 — pass

geometry / geometrypass
MeasurementExpectedMeasuredCheck
Bounds / max20 × 5 × 2020 × 5 × 20pass
Bounds / min-20 × -5 × 0-20 × -5 × 0pass

Model stages

  1. Import the reusable PostPair assembly
  2. Create one native Post component definition
  3. Place the second Post as a translated occurrence copy

Build and verification

  • Primary implementation: scpf
  • Build source: 1dead221b9ea2c31901da9a19a8c205d25272ec3
  • Durable scope: main

Implementations

  • build123d — builder-build123d: build=pass, verification=pass · STL · Preview · verification · result
    • geometry: status=pass, adapter=mesh-geometry, runtime=ghcr.io/brainboxemb/cad-reference:v0.3.6 · verification
  • cadquery — builder-cadquery: build=pass, verification=pass · STL · Preview · verification · result
    • geometry: status=pass, adapter=mesh-geometry, runtime=ghcr.io/brainboxemb/cad-reference:v0.3.6 · verification
  • pybosl2 — builder-pybosl2: build=pass, verification=pass · STL · Preview · verification · result
    • geometry: status=pass, adapter=mesh-geometry, runtime=ghcr.io/brainboxemb/cad-reference:v0.3.6 · verification
  • pythonscad — builder-pythonscad: build=pass, verification=pass · STL · Preview · verification · result
    • geometry: status=pass, adapter=mesh-geometry, runtime=ghcr.io/brainboxemb/cad-reference:v0.3.6 · verification
  • scpf — builder-scpf: build=pass, verification=pass · STL · SC · Preview · commands · verification · result
    • geometry: status=pass, adapter=mesh-geometry, runtime=ghcr.io/brainboxemb/cad-reference:v0.3.6 · verification
    • native: status=pass, adapter=solidcraft-model, runtime=ghcr.io/brainboxemb/cad-solidcraft:v0.3.6 · verification
    • visual: status=pass, adapter=solidcraft-visual, runtime=ghcr.io/brainboxemb/cad-solidcraft:v0.3.6 · verification

scpf

geometry — expected versus measured evidence

Open published verification report

verification.json
{
  "checks": [
    {
      "artifacts": [],
      "error": null,
      "evidence": {
        "bounds": {
          "actual_max": [
            20.0,
            5.0,
            20.0
          ],
          "actual_min": [
            -20.0,
            -5.0,
            0.0
          ],
          "expected_max": [
            20.0,
            5.0,
            20.0
          ],
          "expected_min": [
            -20.0,
            -5.0,
            0.0
          ],
          "max_delta_mm": 0.0,
          "pass": true,
          "tolerance_mm": 0.5
        }
      },
      "id": "geometry",
      "reason": null,
      "status": "pass"
    }
  ],
  "input": "/output/models/assembly-decorator/scpf/model.stl",
  "metadata": {},
  "schema": "cad-verification",
  "schema_version": 1,
  "status": "pass",
  "verification_id": "assembly-decorator-scpf-geometry"
}
native — expected versus measured evidence

Open published verification report

verification.json
{
  "checks": [
    {
      "artifacts": [
        {
          "kind": "file",
          "path": "baseline/measurements.json",
          "sha256": "75ce14b7d919671d57bc98fb4c503002d2884f9a9e7aeac8d6e244059f22caed",
          "size": 1921
        }
      ],
      "error": null,
      "evidence": {
        "body_count": {
          "actual": 2,
          "expected": 2,
          "label": "SolidCraft body count",
          "pass": true
        },
        "body_envelopes": {
          "actual_count": 2,
          "expected_count": 2,
          "kind": "body_envelopes",
          "matched_pairs": [
            {
              "actual": {
                "label": "Post",
                "max": [
                  -10.0,
                  5.0,
                  20.0
                ],
                "min": [
                  -20.0,
                  -5.0,
                  0.0
                ]
              },
              "expected": {
                "label": null,
                "max": [
                  -10.0,
                  5.0,
                  20.0
                ],
                "min": [
                  -20.0,
                  -5.0,
                  0.0
                ]
              },
              "max_delta": 0.0
            },
            {
              "actual": {
                "label": "Post (Post:2)",
                "max": [
                  20.0,
                  5.0,
                  20.0
                ],
                "min": [
                  10.0,
                  -5.0,
                  0.0
                ]
              },
              "expected": {
                "label": null,
                "max": [
                  20.0,
                  5.0,
                  20.0
                ],
                "min": [
                  10.0,
                  -5.0,
                  0.0
                ]
              },
              "max_delta": 0.0
            }
          ],
          "pass": true,
          "tolerance": 0.0,
          "unmatched_actual": [],
          "unmatched_expected": []
        }
      },
      "id": "baseline",
      "reason": null,
      "status": "pass"
    }
  ],
  "input": "/output/models/assembly-decorator/scpf/model.sc",
  "metadata": {},
  "schema": "cad-verification",
  "schema_version": 1,
  "status": "pass",
  "verification_id": "assembly-decorator"
}
visual — expected versus measured evidence

Open published verification report

verification.json
{
  "checks": [
    {
      "artifacts": [
        {
          "kind": "file",
          "path": "visual/front/camera.json",
          "sha256": "489566c9416136e975127f411fdec9fa00769f0181f585bf8d96445da54596e1",
          "size": 128
        },
        {
          "kind": "file",
          "path": "visual/front/actual.png",
          "sha256": "3ef6410b2b3c8b8e1d90fbc614855fbcd97cf35be243d53bc69719e73085dbeb",
          "size": 10544
        },
        {
          "kind": "file",
          "path": "visual/front/goal.png",
          "sha256": "64fc12ead61750d9691fb4620292cb613c78094b2b3238f3f5c4e069df973b9e",
          "size": 1995
        },
        {
          "kind": "file",
          "path": "visual/front/overlay.png",
          "sha256": "fc365c8a0f1bbf96b803f90ac6016d9017e237f93efb7c3aa497e333507944aa",
          "size": 3520
        },
        {
          "kind": "file",
          "path": "visual/front/diff.png",
          "sha256": "1dca71813c9e5c6beae8c1dcee1e77d4632aa86f7851c8599fa836b235618f83",
          "size": 775
        }
      ],
      "error": null,
      "evidence": {
        "actual_image": "visual/front/actual.png",
        "baseline": "baselines/front.json",
        "baseline_status": "pass",
        "camera": "visual/front/camera.json",
        "diff_image": "visual/front/diff.png",
        "expected_shape_required": true,
        "expected_shape_status": "pass",
        "goal_image": "visual/front/goal.png",
        "overlay_image": "visual/front/overlay.png",
        "regression": {
          "changed_pixel_fraction": 0.0,
          "changed_pixel_threshold": 12,
          "max_changed_fraction": 0.08,
          "max_mean_difference": 6.0,
          "mean_absolute_difference": 0.011863,
          "pass": true
        },
        "regression_required": true,
        "view": "front"
      },
      "id": "front",
      "reason": null,
      "status": "pass"
    },
    {
      "artifacts": [
        {
          "kind": "file",
          "path": "visual/right/camera.json",
          "sha256": "32d05c2f0a61fbbdd1f9d4fe33f0d6cadb3279c4a1874b9d269795dd2cddd4ba",
          "size": 144
        },
        {
          "kind": "file",
          "path": "visual/right/actual.png",
          "sha256": "b62f5b83cdb7bbdcab127e7c18097e840245e45085ede67ad9d289addcd7532c",
          "size": 9560
        },
        {
          "kind": "file",
          "path": "visual/right/goal.png",
          "sha256": "914da0fb3f6d787443ae5baa46433c61d9d6c0b9ad7c17b26fa0e60f31889b1a",
          "size": 1986
        },
        {
          "kind": "file",
          "path": "visual/right/overlay.png",
          "sha256": "6c4e341f6ddb1b4451457984931970e355bd905911f971a2622bfb620057f3bf",
          "size": 2712
        },
        {
          "kind": "file",
          "path": "visual/right/diff.png",
          "sha256": "a811abd9fff7f20352c7401240533c97a11a21b5e0ed5aafe55968097c4a5b66",
          "size": 513
        }
      ],
      "error": null,
      "evidence": {
        "actual_image": "visual/right/actual.png",
        "baseline": "baselines/right.json",
        "baseline_status": "pass",
        "camera": "visual/right/camera.json",
        "diff_image": "visual/right/diff.png",
        "expected_shape_required": true,
        "expected_shape_status": "pass",
        "goal_image": "visual/right/goal.png",
        "overlay_image": "visual/right/overlay.png",
        "regression": {
          "changed_pixel_fraction": 0.0,
          "changed_pixel_threshold": 12,
          "max_changed_fraction": 0.08,
          "max_mean_difference": 6.0,
          "mean_absolute_difference": 0.005787,
          "pass": true
        },
        "regression_required": true,
        "view": "right"
      },
      "id": "right",
      "reason": null,
      "status": "pass"
    },
    {
      "artifacts": [
        {
          "kind": "file",
          "path": "visual/iso/camera.json",
          "sha256": "df5adefd824b54fa60c40e01654bcc7a7bfd271ab3e1e6b68a9618f963f67102",
          "size": 159
        },
        {
          "kind": "file",
          "path": "visual/iso/actual.png",
          "sha256": "4f6fa72b217d9b6e6b84b94de998aae5db549282d8dcfbd6c2f28b0164953689",
          "size": 23394
        },
        {
          "kind": "file",
          "path": "visual/iso/goal.png",
          "sha256": "377998c1e9ca8ee29e69d294206887b4763ff8bc14140d3d19e6caccb9818276",
          "size": 3432
        },
        {
          "kind": "file",
          "path": "visual/iso/overlay.png",
          "sha256": "f748b7340cdeee27f10705e3894ecde5e5678b2d9343f4685c2b0dafe83cbcfb",
          "size": 14709
        },
        {
          "kind": "file",
          "path": "visual/iso/diff.png",
          "sha256": "ac5b430500cc317bd0f88b27bf4afd8d6d57c10b33bbefddd676732511910841",
          "size": 2268
        }
      ],
      "error": null,
      "evidence": {
        "actual_image": "visual/iso/actual.png",
        "baseline": "baselines/iso.json",
        "baseline_status": "pass",
        "camera": "visual/iso/camera.json",
        "diff_image": "visual/iso/diff.png",
        "expected_shape_required": true,
        "expected_shape_status": "pass",
        "goal_image": "visual/iso/goal.png",
        "overlay_image": "visual/iso/overlay.png",
        "regression": {
          "changed_pixel_fraction": 0.0,
          "changed_pixel_threshold": 12,
          "max_changed_fraction": 0.08,
          "max_mean_difference": 6.0,
          "mean_absolute_difference": 0.010127,
          "pass": true
        },
        "regression_required": true,
        "view": "iso"
      },
      "id": "iso",
      "reason": null,
      "status": "pass"
    }
  ],
  "input": "/output/models/assembly-decorator/scpf/model.sc",
  "metadata": {
    "baseline_provenance": {
      "approval": "approved",
      "historical_manifest_solidcraft_version": "0.30.1",
      "migrated_from": "qualification/visual_baselines.json",
      "migrated_without_reencoding": true,
      "source_commit": "4d938fb011d3f9a9aa4b88a7b0d3e36664a1c8e4",
      "verified_during_solidcraft_0_42_0_qualification": true
    },
    "kind": "solidcraft-visual",
    "measurements": "measurements.json",
    "visual_report": "visual.json"
  },
  "schema": "cad-verification",
  "schema_version": 1,
  "status": "pass",
  "verification_id": "assembly-decorator-scpf-visual"
}

cadquery

geometry — expected versus measured evidence

Open published verification report

verification.json
{
  "checks": [
    {
      "artifacts": [],
      "error": null,
      "evidence": {
        "bounds": {
          "actual_max": [
            20.0,
            5.0,
            20.0
          ],
          "actual_min": [
            -20.0,
            -5.0,
            0.0
          ],
          "expected_max": [
            20.0,
            5.0,
            20.0
          ],
          "expected_min": [
            -20.0,
            -5.0,
            0.0
          ],
          "max_delta_mm": 0.0,
          "pass": true,
          "tolerance_mm": 0.5
        }
      },
      "id": "geometry",
      "reason": null,
      "status": "pass"
    }
  ],
  "input": "/output/models/assembly-decorator/cadquery/model.stl",
  "metadata": {},
  "schema": "cad-verification",
  "schema_version": 1,
  "status": "pass",
  "verification_id": "assembly-decorator-cadquery-geometry"
}

build123d

geometry — expected versus measured evidence

Open published verification report

verification.json
{
  "checks": [
    {
      "artifacts": [],
      "error": null,
      "evidence": {
        "bounds": {
          "actual_max": [
            20.0,
            5.0,
            20.0
          ],
          "actual_min": [
            -20.0,
            -5.0,
            0.0
          ],
          "expected_max": [
            20.0,
            5.0,
            20.0
          ],
          "expected_min": [
            -20.0,
            -5.0,
            0.0
          ],
          "max_delta_mm": 0.0,
          "pass": true,
          "tolerance_mm": 0.5
        }
      },
      "id": "geometry",
      "reason": null,
      "status": "pass"
    }
  ],
  "input": "/output/models/assembly-decorator/build123d/model.stl",
  "metadata": {},
  "schema": "cad-verification",
  "schema_version": 1,
  "status": "pass",
  "verification_id": "assembly-decorator-build123d-geometry"
}

pythonscad

geometry — expected versus measured evidence

Open published verification report

verification.json
{
  "checks": [
    {
      "artifacts": [],
      "error": null,
      "evidence": {
        "bounds": {
          "actual_max": [
            20.0,
            5.0,
            20.0
          ],
          "actual_min": [
            -20.0,
            -5.0,
            0.0
          ],
          "expected_max": [
            20.0,
            5.0,
            20.0
          ],
          "expected_min": [
            -20.0,
            -5.0,
            0.0
          ],
          "max_delta_mm": 0.0,
          "pass": true,
          "tolerance_mm": 0.5
        }
      },
      "id": "geometry",
      "reason": null,
      "status": "pass"
    }
  ],
  "input": "/output/models/assembly-decorator/pythonscad/model.stl",
  "metadata": {},
  "schema": "cad-verification",
  "schema_version": 1,
  "status": "pass",
  "verification_id": "assembly-decorator-pythonscad-geometry"
}

pybosl2

geometry — expected versus measured evidence

Open published verification report

verification.json
{
  "checks": [
    {
      "artifacts": [],
      "error": null,
      "evidence": {
        "bounds": {
          "actual_max": [
            20.0,
            5.0,
            20.0
          ],
          "actual_min": [
            -20.0,
            -5.0,
            0.0
          ],
          "expected_max": [
            20.0,
            5.0,
            20.0
          ],
          "expected_min": [
            -20.0,
            -5.0,
            0.0
          ],
          "max_delta_mm": 0.0,
          "pass": true,
          "tolerance_mm": 0.5
        }
      },
      "id": "geometry",
      "reason": null,
      "status": "pass"
    }
  ],
  "input": "/output/models/assembly-decorator/pybosl2/model.stl",
  "metadata": {},
  "schema": "cad-verification",
  "schema_version": 1,
  "status": "pass",
  "verification_id": "assembly-decorator-pybosl2-geometry"
}

Published files