Skip to content

Commit 2153a74

Browse files
committed
Remove uses of Box with center parameter and update to latest SwiftSCAD
1 parent e816bae commit 2153a74

File tree

6 files changed

+17
-10
lines changed

6 files changed

+17
-10
lines changed

Package.resolved

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ let customBolt = Bolt(
7474
Creating a matching countersunk clearance hole for a bolt is straightforward:
7575

7676
```swift
77-
Box([20, 20, 10], center: .xy)
77+
Box([20, 20, 10])
78+
.aligned(at: .centerXY)
7879
.subtracting {
7980
customBolt.clearanceHole(recessedHead: true)
8081
}
@@ -83,7 +84,8 @@ Box([20, 20, 10], center: .xy)
8384
As is making a threaded hole for a particular thread:
8485

8586
```swift
86-
Box([20, 20, 10], center: .xy)
87+
Box([20, 20, 10])
88+
.aligned(at: .centerXY)
8789
.subtracting {
8890
ThreadedHole(thread: thread, depth: 10, unthreadedDepth: 2)
8991
}

Sources/Helical/Bolt/Parts/Heads/CountersunkBoltHeadShape.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ public struct CountersunkBoltHeadShape: BoltHeadShape {
5050
Sphere(diameter: diameter)
5151
.translated(z: diameter / 2)
5252
.intersection {
53-
Box([effectiveTopDiameter, effectiveTopDiameter, lensHeight], center: .xy)
53+
Box([effectiveTopDiameter, effectiveTopDiameter, lensHeight])
54+
.aligned(at: .centerXY)
5455
}
5556
}
5657
}

Sources/Helical/Bolt/Parts/Sockets/PhillipsBoltHeadSocket.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ public struct PhillipsBoltHeadSocket: BoltHeadSocket {
9797
let cornerAngleFromX = -(cornerAcrossAngle - 90°) / 2
9898
let cornerDistanceFromBottom = crossDistanceBetweenCorners / bottomWidth * bottomDepth
9999

100-
let mask = Box([fullWidth / 2 + filletRadius, slotWidth, depth + 0.001], center: .y)
100+
let mask = Box([fullWidth / 2 + filletRadius, slotWidth, depth + 0.001])
101+
.aligned(at: .centerY)
101102
.adding {
102103
let blockDepth = slotWidth
103104
Box([0.01, blockDepth, depth + 2])
@@ -131,7 +132,8 @@ public struct PhillipsBoltHeadSocket: BoltHeadSocket {
131132
.rotated(z: 45°)
132133
.symmetry(over: .y)
133134

134-
Box([cornerWidth, 0.02, 0.02], center: .all)
135+
Box([cornerWidth, 0.02, 0.02])
136+
.aligned(at: .center)
135137
.rotated(z: 45°)
136138
.translated(z: 3)
137139
.background()

Sources/Helical/Bolt/Parts/Sockets/SlottedBoltHeadSocket.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ public struct SlottedBoltHeadSocket: BoltHeadSocket {
1414

1515
public var body: any Geometry3D {
1616
EnvironmentReader { environment in
17-
Box([length + 1, width + environment.tolerance, depth], center: .xy)
17+
Box([length + 1, width + environment.tolerance, depth])
18+
.aligned(at: .centerXY)
1819
}
1920
}
2021
}

Sources/Helical/Thread/Screw.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ public struct Screw: Shape3D {
2323
.repeated(around: .z, in: 0°..<360°, count: thread.starts)
2424
.flipped(along: thread.leftHanded ? .x : .none)
2525
.intersection {
26-
Box([thread.majorDiameter + 2, thread.majorDiameter + 2, length], center: .xy)
26+
Box([thread.majorDiameter + 2, thread.majorDiameter + 2, length])
27+
.aligned(at: .centerXY)
2728
}
2829
.adding {
2930
Cylinder(radius: minorRadius + 0.01, height: length)

0 commit comments

Comments
 (0)