New code should depend on OCCTSwiftInteraction, which vends
OCCTSwiftAISas one of its three targets, alongside the other two packages this one used to sit beside. The module name is unchanged, soimport OCCTSwiftAISstill works: what changes is the package you depend on.-.package(url: "https://github.com/SecondMouseAU/OCCTSwiftAIS.git", from: "..."), +.package(url: "https://github.com/SecondMouseAU/OCCTSwiftInteraction.git", from: "..."), -.product(name: "OCCTSwiftAIS", package: "OCCTSwiftAIS"), +.product(name: "OCCTSwiftAIS", package: "OCCTSwiftInteraction"),You cannot depend on both. They vend targets with the same names, and SwiftPM rejects that at build-graph assembly rather than at resolution, so
swift package resolvesucceeds andswift buildthen fails on a duplicate target name. Migrate the whole graph at once, and seedocs/MIGRATION.md.This repository is not being deleted, and is
status: maintenance: it still builds and still takes dependency repins, so nothing breaks by staying. It takes no new features or fixes, which all go to OCCTSwiftInteraction. Why the three were merged, and what it bought, is in ecosystem#42.
High-level Application Interactive Services for the OCCTSwift / OCCTSwiftViewport stack — selection-from-topology, manipulator widgets, dimension annotations, and standard scene objects, all in pure Swift.
Part of the OCCTSwift ecosystem — see the ecosystem map for how this package fits with the kernel, viewport, and sibling layers.
Current: v1.3.1. SemVer-stable from v1.0.0, re-pinned to OCCTSwiftTools v1.6.0 / OCCTSwift v1.15.0+ (still the OCCT 8.0.0p1 GA cohort). See SPEC.md for the design brief and docs/CHANGELOG.md for per-release notes.
- Selection-from-topology — pick a body / face / edge / vertex; round-trip the GPU pick to a
TopoDS_Face/Edge/Vertexhandle on the sourceShape. Body and face highlights composite via the renderer's per-triangle style buffer (no overlay-mesh flicker). - Manipulator widgets — translate and rotate gizmos with
snapTranslate/snapRotateDeg, on the renderer's overlay layer (always-on-top), with native widget pick filtering. SwiftUI integration via.attachManipulator(_:). - Dimensions —
LinearDimension,AngularDimension,RadialDimension. Topology-aware anchors (vertex / edge midpoint / face bbox center / circular-edge center) feed into OCCTSwiftViewport's existingMeasurementOverlayfor leader lines + billboarded label. - Standard scene objects —
Trihedron,WorkPlane,Axis,PointCloudPresentation. - Durable selection identity —
SubShapecarries aSubShapeRef(the resolvedShapeplus aBRepGraph.GraphUIDwhen a graph was in hand at pick time), not just a render-path ordinal.InteractiveContext.update(_:to:absorbing:operationName:)absorbs a modelling operation's history into the object's livingBRepGraph, andremap(_:using:rebindingTo:)resolves a pre-mutationSelectionforward through it — a face split by the operation expands to all its successors; a deleted one is reported viaisDeleted(_:in:), never silently pointed at a coincidentally-adjacent neighbour. - Topology-aware selection filters —
SurfaceTypeFilter,CurveTypeFilter,ShapeTypeFilter, composed withAllOfFilter/AnyOfFilter/NotFilter/PredicateFilter, installed viaInteractiveContext.addFilter(_:)to restrict what's pickable/hoverable beyondselectionMode. - Rectangle and lasso area selection —
InteractiveContext.selectRectangle(from:to:)/selectPolygon(_:), honouringselectionModeand installed filters;.attachAreaSelection(_:)wires up the drag gesture, a live rubber-band/lasso overlay, and camera-orbit passthrough when not actively marqueeing.
→ Getting started walks through wiring all of this into a SwiftUI app.
.package(url: "https://github.com/SecondMouseAU/OCCTSwiftAIS.git", from: "1.3.0"),OCCTSwiftAIS transitively pulls OCCTSwiftTools, OCCTSwiftViewport, and OCCTSwift.
import SwiftUI
import OCCTSwift
import OCCTSwiftViewport
import OCCTSwiftAIS
@MainActor
struct CADView: View {
@StateObject private var ais = InteractiveContext(viewport: ViewportController())
var body: some View {
MetalViewportView(controller: ais.viewport, bodies: $ais.bodies)
.onAppear {
if let part = Shape.box(width: 10, height: 5, depth: 3) {
ais.display(part)
}
ais.selectionMode = [.face]
}
.onChange(of: ais.selection) { _, sel in
for face in sel.faces {
print("selected face area:", face.area())
}
}
}
}Application
↑
OCCTSwiftAIS ← this repo (selection / manipulator / dimensions)
↑
OCCTSwiftTools ← bridge: Shape ↔ ViewportBody
↑ ↑
OCCTSwift OCCTSwiftViewport
(B-Rep) (Metal)
OCCTSwiftAIS adds scene-management semantics an OCCT-style API expects (selection-on-topology, manipulators, dimensions) as a thin Swift layer on top of OCCTSwiftViewport's native Metal renderer. It is not a port of OCCT's TKV3d / TKService / TKOpenGl toolkits — see OCCTSwift/docs/visualization-research.md for why.
| Platform | Status |
|---|---|
| macOS 15+ arm64 | Supported |
| iOS 18+ device + simulator arm64 | Supported |
| visionOS 1+ device + simulator arm64 | Supported |
| tvOS 18+ device + simulator arm64 | Supported |
Same floor as OCCTSwiftViewport.
- Getting started — selection, manipulators, dimensions, standard objects in one walkthrough.
- SPEC.md — design rationale and the v0.x → v1.0 trajectory.
- docs/CHANGELOG.md — what shipped in each release.
Sibling repos: OCCTSwift (B-Rep kernel), OCCTSwiftViewport (Metal renderer), OCCTSwiftTools (Shape ↔ ViewportBody bridge).
LGPL 2.1 (matching OCCT). See LICENSE.