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.

Cheatsheet

Quick lookup for the public SCPF authoring API.

Model classes

class Example: … build(self)

Write a Python model. No main() or show() is required.

class SimpleBox:
    def build(self):
        return Box(40, 30, 10)

Related model

Model parameters

Numeric model fields become named SolidCraft parameters.

length = 40.0
Box(self.length, 30, 10)

Related model

Shapes and sketches

Box(length, width, height, *, anchor=CENTER)

Native Box centred on XYZ by default; choose anchor=BOTTOM for a bottom-face datum at Z=0.

Box(40, 30, 10)

Related model

Rectangle2D(width, depth)

Planar XY profile authored inside a Sketch.

with Sketch(plane='XY') as sketch:
    Rectangle2D(100, 60)

Related model

Circle2D(d=…)

A round 2D profile authored inside a Sketch.

with Sketch(plane='XY') as sketch:
    Circle2D(d=8)

Polygon2D(points, plane=…)

A closed profile on XY, XZ or YZ.

Polygon2D([(0,0), (40,0), (0,30)], plane='XZ')

Cylinder(d=…, h=…, axis=…, anchor=CENTER)

Native cylinder centred by default; choose an axial anchor such as BOTTOM or LEFT when that end should define the datum.

Cylinder(d=24, h=14, axis=Axis.X, anchor=LEFT)

Sphere(radius, *, anchor=CENTER)

Native sphere centred by default; cardinal anchors select tangent datums.

Sphere(12, anchor=LEFT)

Sheet metal

Sketch.sheet_metal(…)

Create a new native flat sheet body from one closed Sketch and define its shared material rule.

sheet = sketch.sheet_metal(thickness=2, bend_radius=2, k_factor=0.5)

Shape.fold(…)

Fold existing sheet material along one straight line; material values come from the active sheet rule.

sheet = sheet.fold(line=((20,-20,0),(20,20,0)), angle=90, fixed=(-30,0,0))

Shape.flange(…)

Grow a native flange from one or more fixed existing-sheet edge picks.

sheet = sheet.flange(edges=[(40,0,2)], height=20, angle=90)

Shape.contour_flange(…)

Create a new native sheet body from a finished connected open Sketch chain.

sheet = contour.contour_flange(distance=50, thickness=2.5, bend_radius=2.5)

Shape.hem(…)

Fold an existing sheet edge back while inheriting the active material rule.

sheet = sheet.hem(edges=[(40,0,2)], length=12, gap=4)

Shape.path_flange(…)

Add a native flange to an existing edge using a finished line-only open Sketch path.

sheet = sheet.path_flange(edge=(40,0,2), path=path, radius=3)

Shape.perforate(…)

Apply a native whole-sheet manufacturing perforation field without repeated solid hole cuts.

sheet = sheet.perforate(diameter=5, pitch=10, margin=5, pattern='square')

Related model

Features and placement

sketch.extrude(distance)

Extrude an explicitly authored Sketch into editable native solid history.

with Sketch(plane='XY') as sketch:
    Rectangle2D(80, 50)
plate = sketch.extrude(8)

Related model

sketch.extrude(…, profiles=[…])

Extrude or cut only the closed Sketch regions selected by fixed sketch-local points.

cut = sketch.extrude(Depth.THROUGH_ALL, profiles=[(-30, 0), (30, 0)], exact_regions=True)

Sketch.rectangular_pattern(…)

Repeat a profile or earlier Sketch result as a native rectangular sketch pattern.

row = sketch.rectangular_pattern(seed, count=4, spacing=25, direction=Axis.X)

Sketch.mirror(…)

Mirror a profile, pattern result or earlier mirror result over the Sketch X or Y axis.

sketch.mirror(row, axis=Axis.Y)

Hole(d=…, depth=…)

A native hole. THROUGH_ALL follows the target body.

Hole(d=8, depth=Depth.THROUGH_ALL)

Related model

shape.rectangular_pattern(…)

Repeat an already-applied native feature in one or two linear directions.

plate.rectangular_pattern(hole, count=4, spacing=20, direction=Axis.X)

shape.circular_pattern(…)

Repeat an already-applied native feature around a fixed axis.

plate.circular_pattern(hole, count=6, axis=Axis.Z)

shape.at(target, anchor=…, child=…)

Place a direct CSG shape anchor on another shape anchor; CENTER-to-CENTER is supported first.

Cylinder(d=8, h=50, axis=Axis.X).at(body)

Related model

shape.on(target, face=…)

Express feature placement with the shared cardinal Faces vocabulary; TOP/BOTTOM placement is currently qualified.

Hole(d=8, depth=Depth.THROUGH_ALL).on(plate, face=Faces.TOP)

Related model

TOP + LEFT / BOTTOM + RIGHT

Combine cardinal directions to identify one edge of an axis-aligned rectangular solid.

body.fillet(2, edges=[BOTTOM + LEFT, BOTTOM + RIGHT])

Box(…).at(…, anchor=…)

Place a native Box by a face, edge or corner anchor without creating a Sketch.

Box(80, 50, 12).at(0, 0, 0, anchor=FRONT + BOTTOM)

Edges.from_faces(…)

Select the complete native boundary of one or more cardinal Faces without supplying XYZ edge picks.

body.chamfer(1.5, edges=Edges.from_faces(Faces.FRONT, Faces.BACK))

Related model

shape.fillet(…)

Round selected edges of a feature-based body.

body.fillet(2, edges=Edges.VERTICAL)

shape.chamfer(…)

Bevel selected edges; add distance2 for SolidCraft’s native asymmetric two-distance chamfer.

body.chamfer(0.18, distance2=0.65, edges=Edges.VERTICAL)

Related model

shape.shell(…)

Create an open-sided shell (supported feature trees only).

Box(80, 50, 30).shell(2, open=Faces.TOP)

a + b / a - b / a & b

Join, cut or intersect supported shapes; operation support depends on the shape types.

body + Hole(d=8).at(0, 0, 10)

Reusable components

copy(placement=Placement(…))

Create another occurrence of the same component definition at a declared pose.

second = first.copy(placement=Placement(x=40))

Related model

model.attach(…)

Fix one reusable component to another through explicit attachment references.

right = Block().attach(left, parent=Anchor.RIGHT, child=Anchor.LEFT)

Related model

attach(offset=(u, v))

Keep an in-plane attachment offset associative; parameter expressions become native planar-joint values.

part.attach(base, parent=Anchor.FRONT_TOP_LEFT, child=mount, offset=(0, -wall + 12))

Related model

attach(kind=“revolute”, …)

Create a native bounded revolute relationship while reusing the normal attachment-reference model.

moving.attach(fixed, parent="hinge_axis", child="hinge_axis", kind="revolute", value=60, limits=(0, 180), name="Hinge")

Related model

assembly.with_exploded_view(…)

Store a native automatic or explicit exploded presentation without changing normal occurrence placements.

assembly.with_exploded_view('Service', scale=1.25).show_exploded('Service')

Related model

assembly.show_assembled()

Return presentation to the normal assembled occurrence placements.

assembly.show_assembled()

Related model

assembly.with_anchor(…) / anchor(…)

Expose a semantic attachment datum owned by an assembly without adding application-specific anchors to a generic component.

frame = (left + right).with_anchor("front_top_left", left, ref)
parent = frame.anchor("front_top_left")

Related model

corner anchors

Use one of the eight rectangular corner references when attaching components.

marker = Marker().attach(base, parent=Anchor.FRONT_TOP_RIGHT, child=Anchor.BACK_TOP_RIGHT)

Related model

AnchorFrame

Define an oriented local attachment frame. Return it from anchors() when the datum belongs to the reusable component, or pass it directly to attach() when it belongs only to the assembly.

mount = AnchorFrame(origin=(0,0,-12), z=(0,1,0), x=(0,0,-1))
part.attach(base, parent=Anchor.FRONT_TOP_LEFT, child=mount)

AnchorTopology

Keep a named or assembly-local attachment reference on a planar-face edge or one of its endpoints so SolidCraft can follow changing geometry.

def anchors(self):
    return {"mount": AnchorTopology(edge=(0,10,5), on=(0,10,10), corner=(0,0,5))}

Placement(rotation=(axis, degrees))

Give a component occurrence one absolute axis-angle orientation.

second = first.copy(placement=Placement(x=40, rotation=(Z, 180)))

Drawings

model.with_drawing(…)

Attach a native SolidCraft engineering drawing to the completed design; ISO A4 landscape is the default.

part.with_drawing(name='Sample Plate Drawing')

Related model

DrawingView(at=…, scale=…, visual_style=…)

Place one native standard view in paper millimetres; ‘shaded’ is the qualified pictorial override while omission keeps the normal line view.

DrawingView(at=(220, 128), scale='1:1', visual_style='shaded')

Related model

DrawingDimension.faces(…)

Dimension two real planar model faces; prefer this for overall sizes when fillets remove corners.

DrawingDimension.faces('front', (-40,0,4), (40,0,4), direction='horizontal', offset_mm=12)

Related model

DrawingDimension.linear(…)

Create a native linear dimension between two model-space point/corner picks.

DrawingDimension.linear('front', (0,0,0), (20,0,0), direction='horizontal')

Related model

DrawingDimension.radial(…)

Create a native radial/diameter dimension from a circular model-edge pick; override_text may form a hole callout.

DrawingDimension.radial('top', (-25.17,2.83,8), diameter=True, override_text='2× {value} THRU')

Related model

DrawingNote(…)

Add native sheet notes at an explicit paper position.

DrawingNote('NOTES\n1. ALL DIMENSIONS IN MM.', at=(156,88), cap_mm=2.5)

Related model

DrawingRevision(…)

Add one native revision row and drive matching title-block revision fields.

DrawingRevision(revision='A', description='Initial drawing', designer='Forge', checker='CI')

Related model

properties=… / title_block=…

Populate native drawing properties and explicit cells in the selected SolidCraft title-block template.

properties={'part_number':'BRK-001'}, title_block={'title':'Bracket','material':'PETG'}

Related model

template=‘iso-a3-part’

Select native ISO A3 explicitly when the documented part needs more sheet area; Forge keeps it landscape.

part.with_drawing(name='Large part', template='iso-a3-part')

Related model

Native PDF + PNG + inspect JSON

builder-scpf publishes vector PDF, static native sheet PNG and final native drawing.inspect evidence; Pages loads only the PNG.

drawings/Sample-Plate-Drawing.{pdf,png,json}

Related model

Compile and inspect

python -m scpf … –out

Compile a model to SolidCraft command JSON; no SolidCraft app needed.

python -m scpf examples/simple-box/scpf/model.py --out output/box.json

Related model

python -m scpf replay …

Send existing command JSON to an open SolidCraft session; does not recompile.

python -m scpf replay output/box.json

python -m scpf … –connect

Execute a model in an open SolidCraft GUI document.

python -m scpf examples/simple-box/scpf/model.py --connect

Display appearance

shape.with_appearance("#RRGGBB")

Give the finished body a visual color without changing material/BOM semantics.

body.with_appearance("#FFD21A")

Related model

Configuration tables

Configure(design, active=…, columns=…, rows=…)

Author one editable native SolidCraft configuration table.

Configure(design, active="Medium",
    columns=(Param(self.width), Suppress(hole)),
    rows={"Medium": ("80 mm", True),
          "Large": ("100 mm", False)})

Related model

Shape.export_feature(…) + Occurrence.feature(…)

Let a parent configuration suppress one exact authored feature inside a reusable child definition.

@component
class Coupler:
    def build(self):
        body = Box(40, 24, 12, anchor=Anchor.BOTTOM)
        cut = Hole(d=5).at(0, 0, 12).export_feature("panel_pin")
        return body - cut

coupler = Coupler()
Configure(coupler, active="Small",
    columns=(Suppress(coupler.feature("panel_pin")),),
    rows={"Small": (True,), "Large": (False,)})

Related model

ConfigRule(…, condition=Always(), effect=DriveParameter(…))

Keep an Installed/Free physical state independent from Small/Medium/Large rows.

Configure(design, active="Medium",
    columns=(Param(self.width), Param(self.fit_diameter)),
    rows={"Small": ("60 mm", "20.4 mm"),
          "Medium": ("80 mm", "20.4 mm"),
          "Large": ("100 mm", "20.4 mm")},
    rules=(ConfigRule(
        "installed", "Installed",
        condition=Always(),
        effect=DriveParameter(self.fit_diameter, self.tube_d)),))

Related model

Symbolic CAD math

cadmath.min / max / sqrt / abs / round / floor / atan

Keep non-linear and quantized derived dimensions native and configuration-driven.

g = cadmath.min(self.rounding, self.wall / 2 - 0.05)
tip = cadmath.sqrt((self.radius - g) ** 2 - (self.radius - self.wall + g) ** 2)

Related model

Shifted native revolve

AxisLine(direction, origin=…)

Author one shifted/custom native axis with parameter-driven XYZ origin.

axis = AxisLine(Axis.Y, origin=(self.pin_x, 0, self.pin_z))
cut = profile.revolve(axis=axis)

Related model