gsdali/occtswifttools
The bridge layer between OCCTSwift (B-Rep modeling kernel) and OCCTSwiftViewport (Metal viewport).
What it does
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)Architecture position
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.
Converters
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.
Installation
.package(url: "https://github.com/gsdali/OCCTSwiftTools.git", from: "0.1.0"),Supported platforms
| 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).
Status
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.
License
LGPL 2.1 (matching OCCT). See LICENSE.
Package Metadata
Repository: gsdali/occtswifttools
Default branch: main
README: README.md