Background
PadCAM generates CNC toolpaths using OCCT geometry. CAM applications require transforming between:
- CAD model coordinates (where the model is defined in OCCT space)
- G-code work coordinates (G54 space, where Z=0 at stock top)
Currently OCCTSwift provides shape-level transformations (translated, rotated, scaled, mirrored) which work well for geometry manipulation.
Feature Request
1. Coordinate System Type (Nice to Have)
A lightweight struct representing a coordinate system for CAM operations:
struct CoordinateSystem {
let origin: SIMD3<Double>
let xAxis: SIMD3<Double> // Unit vector
let yAxis: SIMD3<Double> // Unit vector
let zAxis: SIMD3<Double> // Unit vector (computed: x × y)
/// Transform point from world to this coordinate system
func localPoint(_ worldPoint: SIMD3<Double>) -> SIMD3<Double>
/// Transform point from this coordinate system to world
func worldPoint(_ localPoint: SIMD3<Double>) -> SIMD3<Double>
}
Maps to OCCT's gp_Ax2 class.
2. Transform Composition (Nice to Have)
Ability to compose transformations:
extension Shape {
/// Apply a composed transformation (translation + rotation + scale)
func transformed(
translation: SIMD3<Double>? = nil,
rotationAxis: SIMD3<Double>? = nil,
rotationAngle: Double? = nil,
scale: Double? = nil
) -> Shape
}
Maps to OCCT's gp_Trsf composition.
Priority: Low
These features would be convenient but are not blocking. PadCAM can implement coordinate transformations at the application level using Swift math on SIMD3<Double> points:
// Simple CAM coordinate transform
func modelToGcode(point: SIMD3<Double>, g54Origin: SIMD3<Double>) -> SIMD3<Double> {
return point - g54Origin
}
References
Background
PadCAM generates CNC toolpaths using OCCT geometry. CAM applications require transforming between:
Currently OCCTSwift provides shape-level transformations (
translated,rotated,scaled,mirrored) which work well for geometry manipulation.Feature Request
1. Coordinate System Type (Nice to Have)
A lightweight struct representing a coordinate system for CAM operations:
Maps to OCCT's
gp_Ax2class.2. Transform Composition (Nice to Have)
Ability to compose transformations:
Maps to OCCT's
gp_Trsfcomposition.Priority: Low
These features would be convenient but are not blocking. PadCAM can implement coordinate transformations at the application level using Swift math on
SIMD3<Double>points:References