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.

Features and references

A feature changes an existing body

A native feature is different from subtracting arbitrary CSG geometry. SCPF can retain named sketches and operations in SolidCraft history. For exact results, supported body types and selection constraints matter.

Holes

from scpf import Box, Hole, Depth, Faces

plate = Box(100, 60, 10)
hole = Hole(d=8, depth=Depth.THROUGH_ALL)
plate = plate + hole.on(plate, face=Faces.TOP)

A Hole is a native hole feature: adding it to the shape means adding the operation that removes material. Faces.TOP selects its entry face. Simple feature placement uses on(); assembly attachment uses explicit anchors.

Native feature patterns

Pattern an already-applied native feature when the copies should remain one editable SolidCraft history operation. Rectangular and circular patterns share the same source-feature rules: pass the same Forge Shape object that was applied to the body. Forge resolves that object to its native history feature; callers never manage SolidCraft timeline-name strings. Direct native Hole-family and primitive features are supported alongside the existing Sketch.extrude() path, and a direct count Parameter remains editable in the saved design.

from scpf import Anchor, Axis, Box, Hole

plate = Box(100, 80, 6, anchor=Anchor.BOTTOM)
bolt_hole = Hole(
    d=8,
    direction=(0, 0, -1),
).at(30, 0, 6)
plate = plate + bolt_hole

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

circular_pattern() omits angle by default so SolidCraft uses its native 360-degree full-circle behaviour. Supply a fixed degree value or direct Parameter for a partial arc. origin=(x, y, z) moves a fixed axis; a fixed non-zero XYZ vector can be used instead of Axis.X/Y/Z. Construction-axis and geometry-axis selectors are not yet exposed by Forge.

grid = plate.rectangular_pattern(
    bolt_hole,
    count=4,
    spacing=20,
    direction=Axis.X,
    count2=3,
    spacing2=18,
    direction2=Axis.Y,
)

rectangular_pattern() and circular_pattern() both emit one native feature-pattern command rather than expanding independent copies in Python.

Fillets and chamfers

from scpf import FRONT, LEFT, Box, Edges, Faces

body = Box(80, 50, 15)
top_perimeter = body.chamfer(
    1.5,
    edges=Edges.from_faces(Faces.TOP),
)
rounded = body.fillet(3, edges=Edges.VERTICAL)
one_edge = body.chamfer(3, edges=FRONT + LEFT)
asymmetric = body.chamfer(
    0.18,
    distance2=0.65,
    edges=FRONT + LEFT,
)

chamfer(distance) keeps the equal-distance behavior. distance2= authors one native SolidCraft two-distance chamfer. Use flip=True when the primary/secondary distances must apply to the opposite adjacent-face ordering; Forge does not replace the operation with cutter geometry.

fillet() and chamfer() use the same edge-selection forms. Prefer Edges.from_faces(...) when the intent is the complete boundary of named planar faces. Forge queries SolidCraft for those faces and their current edges during replay, then passes native {body,index} edge references to the modify feature; callers do not provide XYZ picks or predict topology ids.

with Sketch(plane="XZ") as profile:
    Polygon2D([(-20, 0), (20, 0), (20, 30), (-20, 30)],
              plane="XZ", world=True)

hook = profile.extrude(15, sym=True)
hook = hook.chamfer(
    1.5,
    edges=Edges.from_faces(Faces.FRONT, Faces.BACK),
)

Cardinal faces use world axes: TOP/BOTTOM are +/-Z, LEFT/RIGHT are -/+X, and FRONT/BACK are -/+Y. An XZ profile extrudes along Y, so its broad end faces are FRONT and BACK. Existing Edges.VERTICAL, two-direction Box selectors, Edges.from_profile(...), Edges.from_vertices(...) and explicit XYZ picks remain available for their existing contracts.

Shells

from scpf import Box, Faces
case = Box(80, 50, 30).shell(2, open=Faces.TOP)

Faces.TOP chooses the face to open and is the same surface-selection vocabulary used by feature.on(...) and Edges.from_faces(...). Shell resolves the requested cardinal face through native SolidCraft topology before calling the native shell feature. Anchor is reserved for explicit component attachment in assemblies. See the source and regression tests for supported feature chains.

Feature placement without hard-coded global offsets

from scpf import X, Y, Boss, Anchor

boss = Boss(d=7, h=12, hole_d=2.5).attach(
    case, parent=Anchor.INNER_BOTTOM,
    offset=(X.MIN + 10, Y.MAX - 10),
)

X.MIN and Y.MAX refer to the parent bounds and are not rotation-axis constants. Anchoring support currently focuses on rectangular bases and a documented set of faces. Do not assume every curved or lofted surface supports it.

Display appearance

Use with_appearance() when a model should open with a specific visual color but its engineering material, density and BOM semantics must stay unchanged.

body = Box(40, 30, 10).with_appearance("#FFD21A")

The color is stored as a native SolidCraft body appearance. Apply it after the body geometry is complete. Use with_material() instead when physical material properties are actually part of the model intent.