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.

Drawings

Forge can attach a native SolidCraft technical drawing to a completed design. Drawing intent is presentation state: keep it out of reusable component definitions and add it only when the part or assembly you want to document is complete.

Add a drawing to one component

@component
class SamplePlate:
    def build(self):
        return Box(80, 50, 8, anchor=Anchor.BOTTOM)

part = SamplePlate().with_drawing(name="Sample Plate Drawing")

with_drawing() uses SolidCraft’s native iso-a4-part template by default and sets its first sheet to landscape. SolidCraft owns the paper, title block, standard front/top/right/isometric view layout and fitted scale. Forge binds the native drawing, component, occurrence, source, sheet and view identities returned by SolidCraft rather than predicting browser ids.

A4 by default, A3 when you ask for it

part.with_drawing(
    name="Large assembly detail",
    template="iso-a3-part",
)

A4 landscape is the normal part-drawing default. Select A3 explicitly when the design needs more sheet area; the chosen native paper size is preserved and the sheet remains landscape. Forge does not silently switch an A3 request back to A4.

Use the native compact title block for small parts

part.with_drawing(
    name="Wall Hook Drawing",
    title_block_style="compact",
    properties={
        "part_number": "WH-001",
        "organization": "Example Engineering",
    },
    title_block={
        "title": "Wall Hook",
        "identification_number": "WH-001",
    },
)

title_block_style="compact" keeps the normal native SolidCraft sheet and selects SolidCraft’s compact 49 mm title block. Forge does not redraw or emulate the block. The normal template title block remains the default when the option is omitted.

The compact SolidCraft block intentionally has fewer cells than the full built-in block: it omits scale, document type, document status, language, revision and department cells. Use only title-block fields present in the compact block; keep richer revision/status presentation on the normal built-in title block when those cells are required.

Document one component from an assembly

assembly = left + right
assembly = assembly.with_drawing(
    left,
    name="Left bracket",
)

The selected occurrence must already belong to the completed Assembly. Projected views inherit the selected native occurrence subtree. Drawing intent does not alter normal occurrence placement or duplicate the reusable component definition.

Author a real engineering sheet

The same public API can author view layout, dimensions, notes, drawing properties, title-block values and one revision row. These remain native SolidCraft drawing objects; Forge does not draw substitute SVG/PDF graphics.

part.with_drawing(
    name="Bracket drawing",
    scale="1:1",
    views={
        "front": DrawingView(at=(62, 128)),
        "top": DrawingView(at=(62, 62)),
        "right": DrawingView(at=(137, 128)),
        "iso": DrawingView(
            at=(220, 128),
            scale="1:1",
            visual_style="shaded",
        ),
    },
    properties={
        "part_number": "BRK-001",
        "revision": "A",
        "author": "Forge",
        "organization": "Example Engineering",
        "description": "Wall bracket",
    },
    title_block={
        "title": "Wall bracket",
        "identification_number": "BRK-001",
        "material": "PETG",
        "document_status": "Released",
    },
    revision=DrawingRevision(
        revision="A",
        description="Initial drawing",
        designer="Forge",
        checker="CI",
        date="2026-11-25",
    ),
    notes=(
        DrawingNote(
            "NOTES\n1. ALL DIMENSIONS IN MM.\n2. BREAK SHARP EDGES.",
            at=(156, 88),
            cap_mm=2.5,
        ),
    ),
    dimensions=(
        DrawingDimension.faces(
            "front",
            (-20, 0, 5),
            (20, 0, 5),
            direction="horizontal",
            offset_mm=12,
            decimals=0,
        ),
        DrawingDimension.radial(
            "front",
            (0, 4, 10),
            diameter=True,
            override_text="2× {value} THRU",
            line_through_mm=(92, 88),
            decimals=1,
        ),
    ),
)

DrawingView.at uses paper millimetres. DrawingView(visual_style="shaded") is the qualified native pictorial override, useful for an isometric view while orthographic views keep their normal line presentation. DrawingDimension.faces() is the preferred overall-size form when fillets remove geometric corners. DrawingDimension.radial() resolves a circular model edge; avoid selecting the seam point of a circular edge. Invalid topology picks fail in SolidCraft rather than being silently approximated.

The pinned SolidCraft 0.49 command set does not expose native centre-mark or centre-line authoring. Forge therefore does not fake them. Balloons and parts lists are also outside the qualified slice.

Drawing intent versus published artifacts

Forge stores the native drawing in model.sc. The SCPF builder keeps the final native drawing.inspect result as structural JSON, then reopens that saved design and uses SolidCraft’s native drawing.export command for a vector PDF and a 144 dpi PNG of the replay-bound sheet. Forge model code does not embed repository or build-root paths.

build/<scope>/models/sample-plate-drawing/scpf/
  model.sc
  drawings/
    Sample-Plate-Drawing.pdf
    Sample-Plate-Drawing.png
    Sample-Plate-Drawing.json

Pages loads only the static PNG preview and exposes explicit Open PDF / Download PDF actions. It does not embed the PDF viewer on page load and copies neither generated artifact into gh-pages. See the Sample Plate Drawing example for the complete source, generated SolidCraft sequence, native model and drawing PDF.

Qualified drawing scope

The qualified slice covers native landscape A4/A3 part sheets, explicit standard-view placement/scale, linear/face/radial dimensions, notes, drawing properties, title-block overrides, one revision row, vector PDF publication, native static PNG evidence and retained native inspection JSON. The Forge-owned Sample Plate Drawing exercises this API as a consumer simulation before the same contract is used by downstream CAD models.

Centre marks/centre lines, balloons and parts lists remain outside this release because the pinned SolidCraft backend does not yet expose all required native authoring commands. They are not emulated with page graphics.