OCCTSwift API Reference
A detailed, per-type function reference for the OCCTSwift Swift API — modelled on OCCT’s own Doxygen class reference (dev.opencascade.org, indexed on context7 as /open-cascade-sas/occt). One page per public Swift type, every public method documented: signature, behaviour, parameters, return, the OCCT class/method it wraps, a runnable example, and gotchas.
This complements the other docs — it’s the exhaustive surface, vs:
API_REFERENCE.md— the compact Swift→OCCT mapping table.guides/cookbook/— task-oriented example pages.
Generation. These pages are produced by subagents (see
/document-api), one per source file, each reading the Swift source + theOCCTBridgemapping + the upstream OCCT docs. Built over time; see Status for coverage.
Page layout
One file docs/reference/<Type>.md per public Swift type (matching Sources/OCCTSwift/<Type>.swift). Large types are split by their // MARK: sections into <Type>-<Area>.md (see Status).
Each page:
---
title: <Type>
parent: API Reference
---
# <Type>
<1–3 sentences: what the type represents, its OCCT analog(s), and how you obtain one.>
## Topics
- [<Group A>](#group-a) · [<Group B>](#group-b) · …
---
## <Group> ← one ## per source `// MARK:` section, in source order
### `Type.method(label:)` ← `###` per public member, in source order
<one-line summary — what it does.>
```swift
public func method(label: Type) -> ReturnType
```
<optional 1–2 sentences of detail / when to use.>
- **Parameters:** `label` — meaning. *(omit if none)*
- **Returns:** what comes back; **state nil/throws conditions** for optionals/throwing calls.
- **OCCT:** `Upstream_Class::Method` — the wrapped C++ API. *(omit only if pure-Swift)*
- **Example:**
```swift
let r = Type.method(label: …)
```
- **Note:** gotchas / edge cases. *(omit if none)*
Entry rules (the template contract)
- Signature is verbatim from the source — copy the full public declaration, including defaults.
- Every public
func/var/static func/initof the type gets a###entry, in source order, grouped under its// MARK:section. - OCCT mapping is required wherever the method calls a bridge function — name the upstream class (
BRepBuilderAPI_MakeWire,Geom_BSplineCurve, …). Find it from the bridge.mmimplementation or the cross-reference index inOCCTBridge.h. Omit only for pure-Swift helpers. - Examples must be signature-faithful and runnable. Reuse a snippet from a cookbook page or a test where one exists (these are compile-checked); otherwise write a minimal, type-correct one. Fallible APIs unwrap with
guard/if let, never force-unwrap. - No invention. Behaviour comes from the source doc comment, the bridge, and the OCCT docs — not guessed. If a method’s purpose is unclear, say so briefly rather than fabricate.
- Concise. Reference, not prose — one tight summary line, parameters/returns as bullets.
Rollout
- Unit of work: one source file = one subagent job. Run a batch per session;
/document-api <Type>for a single page. - Order: core types first (Shape, Wire, Surface, Curve3D, Curve2D, Edge, Face, Mesh), then I/O & documents (Exporter, Document), then the long tail (drawing, annotation, measurement, etc.).
- Giants (
Document~1865,Shape~993,BRepGraph,Surface,Curve2D,Curve3D): split by// MARK:section into<Type>-<Area>.md, one subagent per chunk, linked from the type’s index page.
Status
Coverage tracker — update as pages land. (Counts = public decls in the source file.)
| Type | decls | page | status |
|---|---|---|---|
| Wire | 61 | Wire.md | ✅ done |
| Shape | 867 | Shape.md + 8 (Features, Healing, Measurement, Builders I/II, HLR-Geom, Recognition, Completions) | ✅ done |
| Surface | 234 | Surface.md + 4 (Analytic Types, BSpline & Bezier, Analysis, Advanced) | ✅ done |
| Curve3D | 177 | Curve3D.md + 3 (Analytic Types, Analysis, Construction) | ✅ done |
| Curve2D | 205 | Curve2D.md + 3 (Analytic Types, Analysis, Constraint Solvers) | ✅ done |
| Edge | 36 | Edge.md | ✅ done |
| Face | 32 | Face.md | ✅ done |
| Mesh | 34 | Mesh.md | ✅ done |
| Exporter | 39 | Exporter.md | ✅ done |
| Document | 1735 | Document.md + 12 (Persistence-IO, XCAF-Notes, OCAF-Attributes, Math-Bounds, Analysis-Builders, Geometry-Constructors, BSpline-Extrema, Math-Solvers, Mesh-Fixing, Transforms, Builders-Fillet, Completions) | ✅ done |
| TopologyGraph (BRepGraph) | 375 | TopologyGraph.md + 4 (Detail-History, Builders, Editor-Identity, Attributes) | ✅ done |
| ThreadFeatures | 30 | ThreadFeatures.md | ✅ done |
| DrawingAnnotation | 100 | DrawingAnnotation.md | ✅ done |
| Drawing & Sheets (Drawing, DrawingSheet, DrawingStyle, DisplayDrawer) | 94 | Drawing.md | ✅ done |
| Drawing Automation (Composition, AutoCenterlines/Dimensions, ThreadAnnotation, Symbols, HatchPattern) | 39 | Drawing-Automation.md | ✅ done |
| Annotation & GD&T (Annotation, GDTWrite) | 75 | Annotation.md | ✅ done |
| Construction & Sketching (ConstructionContext/Layer/Entity, Sketch, Section2D) | 91 | Construction.md | ✅ done |
| 2D Geometry Primitives (Point2D, Transform2D, ShapeAxis, AxisPlacement2D) | 52 | Geometry2D.md | ✅ done |
| FeatureReconstructor | 67 | FeatureReconstructor.md | ✅ done |
| Feature Recognition & Medial Axis (FeatureRecognition, MedialAxis) | 63 | FeatureRecognition.md | ✅ done |
| Vector & Raster Export (PDF, SVG, DXF, PixMap) | 72 | Export-Vector.md | ✅ done |
| Color & Material (Color, Material) | 76 | Color-Material.md | ✅ done |
| Display & Presentation (ZLayerSettings, ClipPlane, Camera, PresentationMesh, FontManager) | 77 | Display.md | ✅ done |
| Measurement (MeasurementHelpers, ShapeMeasurements) | 32 | Measurement.md | ✅ done |
| Sheet Metal (SheetMetal, SheetLayout) | 39 | SheetMetal.md | ✅ done |
| Bill of Materials & Selection (BillOfMaterials, Selector, Selection) | 48 | Selection.md | ✅ done |
| Date & Period (Date, Period) | 33 | DateTime.md | ✅ done |
| Curve Adaptors & Wire Ordering (WireCurve, EdgeCurve, WireOrder) | 31 | CurveAdaptors.md | ✅ done |
| Geometry Solvers & Builders (BSplineApproxInterp, PlateSolver, FillingSurface, LawFunction, PolynomialSolver, KDTree) | 59 | GeometrySolvers.md | ✅ done |
| Concurrency & Progress (OCCTSerial, ImportProgress) | 6 | Concurrency.md | ✅ done |
Table of contents
- 2D Geometry Primitives
- Annotation & GD&T
- Bill of Materials & Selection
- Color & Material
- Concurrency & Progress
- Construction & Sketching
- Curve Adaptors & Wire Ordering
- Curve2D
- Curve2D — Analysis
- Curve2D — Analytic Types
- Curve2D — Constraint Solvers
- Curve3D
- Curve3D — Analysis
- Curve3D — Analytic Types
- Curve3D — Construction
- Date & Period
- Display & Presentation
- Document
- Document — BSpline/Bezier Methods & Extrema
- Document — Builders, Fillet/Chamfer & glTF
- Document — Coordinate Systems, Transforms & Completions
- Document — Geometry Constructors & Pipe Shells
- Document — Math Solvers & Local Properties
- Document — Math, Bounds, OSD & Conversions
- Document — Mesh I/O, Projection & Shape Fixing
- Document — OCAF Attributes, Naming & Elementary Geometry
- Document — Persistence, I/O & XDE Tools
- Document — Shape Analysis, OSD & Geometry Builders
- Document — XCAF & API Completions
- Document — XCAF Notes, Views & Materials
- Drawing & Sheets
- Drawing Automation & Helpers
- DrawingAnnotation
- Edge
- Exporter
- Face
- Feature Recognition & Medial Axis
- FeatureReconstructor
- Geometry Solvers & Builders
- Measurement
- Mesh
- Shape
- Shape — Advanced Sweeps & API Completions
- Shape — Builders & Boolean Internals I
- Shape — Builders & Boolean Internals II
- Shape — Features, Sweeps & Surface Building
- Shape — Geometry Recognition & Polygon/Triangulation Data
- Shape — HLR, Intervals, Mesh Props & Geom Primitives
- Shape — Healing, Recognition & Feature Ops
- Shape — Measurement, Sub-Shapes & Local Operations
- Sheet Metal
- Surface
- Surface — Advanced Construction
- Surface — Analysis
- Surface — Analytic Types
- Surface — BSpline & Bezier
- ThreadFeatures
- TopologyGraph
- TopologyGraph — Attributes, Snapshots & References
- TopologyGraph — Builders & Editor Mutation
- TopologyGraph — Editor Geometry, Sampling & Durable Identity
- TopologyGraph — Topology Detail, History & Mesh
- Vector & Raster Export
- Wire