The bridge layer between OCCTSwift (B-Rep modeling kernel) and OCCTSwiftViewport (Metal viewport).
Part of the OCCTSwift ecosystem — see the ecosystem map for how this package fits with the kernel, viewport, and sibling layers.
Status: v1.2.0. SemVer-stable from v1.0.0; versioning follows the cohort SemVer policy. See docs/CHANGELOG.md and SPEC.md.
import OCCTSwift
import OCCTSwiftTools
let box = Shape.box(width: 10, height: 5, depth: 3)!
let body = ViewportBody.from(box)! // ← this lives herePlus one-shot file loaders:
let bodies = try CADFile.loadSTEP(at: stepURL)
let mesh = try CADFile.loadSTL(at: stlURL)OCCTSwiftAIS (selection / manipulator / dimensions; sibling repo)
↑
OCCTSwiftTools ← this repo
↑ ↑
OCCTSwift OCCTSwiftViewport
(B-Rep) (Metal renderer)
OCCTSwiftTools is the only repo that depends on both sibling kernels. OCCTSwiftAIS depends on this; the two kernels stay decoupled from each other.
Per-domain helpers that turn an OCCT-or-raw input into a ViewportBody:
| Helper | Input | Output body shape |
|---|---|---|
CADFileLoader.shapeToBodyAndMetadata |
OCCTSwift.Shape |
Triangulated mesh + picking metadata |
CurveConverter.curve2DToBody / curve3DToBody |
Curve2D / Curve3D |
Edge polyline (no mesh) |
SurfaceConverter |
Surface |
Triangulated surface mesh |
WireConverter.wireToBody |
Wire |
Edge polyline |
PointConverter.pointsToBody |
[SIMD3<Float>] |
Point list (no mesh, no edges) |
Note on
PointConverter: produces aViewportBodywithprimitiveKind == .point, drawn by the point-cloud rendering pipeline added in OCCTSwiftViewport v1.0.2 (issue #28).pointRadiusandperPointColorsare now carried through to the body'spointRadiusandvertexColorsfields; consumers (e.g. OCCTMCP'sadd_scene_primitive(pointCloud)) can lift their previous sphere-compound caps and render tens of thousands of points cleanly.
.package(url: "https://github.com/gsdali/OCCTSwiftTools.git", from: "0.1.0"),| Platform | Status |
|---|---|
| macOS 15+ arm64 | Supported |
| iOS 18+ device + simulator arm64 | Supported |
| visionOS 1+ device + simulator arm64 | Supported |
| tvOS 18+ device + simulator arm64 | Supported |
The platform floor is the higher of OCCTSwift's (12.0 / 15.0) and OCCTSwiftViewport's (15.0 / 18.0).
Active. Requires OCCTSwift ≥ v0.168.0 (for ImportProgress) and OCCTSwiftViewport ≥ v0.55.0 (for the GPU edge/vertex pick fields populated by shapeToBodyAndMetadata). See docs/CHANGELOG.md for release history and SPEC.md for the public API surface and roadmap.
LGPL 2.1 (matching OCCT). See LICENSE.