11import Foundation
22import Cadova
33
4+ /// A bolt with a head, threaded section, and optional point.
45public struct Bolt : Shape3D {
6+ /// The screw thread specification.
57 public let thread : ScrewThread
8+ /// Nominal length of the bolt, measured according to convention for the head type.
69 public let length : Double
10+ /// Length of the unthreaded portion.
711 public let unthreadedLength : Double
12+ /// Diameter of the unthreaded portion.
813 public let unthreadedDiameter : Double
14+ /// The bolt head geometry.
915 public let headShape : any BoltHeadShape
16+ /// Optional drive socket in the head.
1017 public let socket : ( any BoltHeadSocket ) ?
18+ /// Optional bolt point geometry.
1119 public let point : ( any BoltPoint ) ?
1220
21+ /// Creates a bolt with the specified thread, dimensions, and head configuration.
22+ ///
23+ /// - Parameters:
24+ /// - thread: The screw thread specification.
25+ /// - length: Nominal length of the bolt.
26+ /// - unthreadedLength: Length of the unthreaded portion.
27+ /// - unthreadedDiameter: Diameter of the unthreaded portion. Defaults to the thread's major diameter.
28+ /// - headShape: The bolt head geometry.
29+ /// - socket: Optional drive socket in the head.
30+ /// - point: Optional bolt point geometry.
1331 public init (
1432 thread: ScrewThread ,
1533 length: Double ,
@@ -28,6 +46,16 @@ public struct Bolt: Shape3D {
2846 self . point = point
2947 }
3048
49+ /// Creates a bolt with a chamfered point.
50+ ///
51+ /// - Parameters:
52+ /// - thread: The screw thread specification.
53+ /// - length: Nominal length of the bolt.
54+ /// - unthreadedLength: Length of the unthreaded portion.
55+ /// - unthreadedDiameter: Diameter of the unthreaded portion. Defaults to the thread's major diameter.
56+ /// - leadinChamferSize: Size of the lead-in chamfer at the bolt tip.
57+ /// - headShape: The bolt head geometry.
58+ /// - socket: Optional drive socket in the head.
3159 public init (
3260 thread: ScrewThread ,
3361 length: Double ,
@@ -48,7 +76,14 @@ public struct Bolt: Shape3D {
4876 )
4977 }
5078
51- // A bolt without a screw thread, for purposes where the thread is unimportant
79+ /// Creates a bolt without threads, for cases where thread detail is unimportant.
80+ ///
81+ /// - Parameters:
82+ /// - solidDiameter: Diameter of the bolt body.
83+ /// - length: Nominal length of the bolt.
84+ /// - headShape: The bolt head geometry.
85+ /// - socket: Optional drive socket in the head.
86+ /// - point: Optional bolt point geometry.
5287 public init (
5388 solidDiameter: Double ,
5489 length: Double ,
@@ -99,6 +134,12 @@ public struct Bolt: Shape3D {
99134 recessedHead ? ( length + headShape. clearanceLength) : ( length - headShape. consumedLength)
100135 }
101136
137+ /// Creates a clearance hole sized for this bolt.
138+ ///
139+ /// - Parameters:
140+ /// - depth: Hole depth. Defaults to the bolt length minus head consumption.
141+ /// - edgeProfile: Optional edge profile at the hole opening.
142+ /// - Returns: A clearance hole configured for this bolt.
102143 public func clearanceHole( depth: Double ? = nil , edgeProfile: EdgeProfile ? = nil ) -> ClearanceHole {
103144 ClearanceHole (
104145 diameter: thread. majorDiameter,
@@ -107,6 +148,12 @@ public struct Bolt: Shape3D {
107148 )
108149 }
109150
151+ /// Creates a clearance hole sized for this bolt, optionally with a recess for the head.
152+ ///
153+ /// - Parameters:
154+ /// - depth: Hole depth. Defaults to a depth that accommodates the full bolt length.
155+ /// - recessedHead: Whether to include a recess matching the bolt head shape.
156+ /// - Returns: A clearance hole configured for this bolt.
110157 public func clearanceHole( depth: Double ? = nil , recessedHead: Bool ) -> ClearanceHole {
111158 return ClearanceHole (
112159 diameter: thread. majorDiameter,
0 commit comments