kcl-lib 0.2.145

KittyCAD Language implementation and tools
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
/// The KCL standard library
///
/// Contains frequently used constants, functions for interacting with the KittyCAD servers to
/// create sketches and geometry, and utility functions.
///
/// The standard library is organised into modules (listed below), but most things are always available
/// in KCL programs.
///
/// You might also want the [KCL language reference](/docs/kcl-lang) or the [KCL guide](https://zoo.dev/docs/kcl-book/intro.html).

@no_std
@settings(defaultLengthUnit = mm, kclVersion = 1.0, experimentalFeatures = allow)

// Note that everything in the prelude is treated as exported.

export import * from "std::types"
export import "std::gdt"
export import "std::units"
export import * from "std::array"
export import * from "std::math"
export import * from "std::sketch"
export import "std::solver"
export import * from "std::solid"
export import * from "std::transform"
export import "std::turns"
export import "std::sweep"
export import "std::appearance"
export import "std::vector"
export import "std::hole"
@(experimental = true)
export import "std::gear"
@(experimental = true)
export import * from "std::runtime"

/// An abstract 3d plane aligned with the X and Y axes. Its normal is the positive Z axis.
export XY = {
  origin = { x = 0, y = 0, z = 0 },
  xAxis = { x = 1, y = 0, z = 0 },
  yAxis = { x = 0, y = 1, z = 0 },
}: Plane

/// An abstract 3d plane aligned with the X and Z axes. Its normal is the negative Y axis.
export XZ = {
  origin = { x = 0, y = 0, z = 0 },
  xAxis = { x = 1, y = 0, z = 0 },
  yAxis = { x = 0, y = 0, z = 1 },
}: Plane

/// An abstract 3d plane aligned with the Y and Z axes. Its normal is the positive X axis.
export YZ = {
  origin = { x = 0, y = 0, z = 0 },
  xAxis = { x = 0, y = 1, z = 0 },
  yAxis = { x = 0, y = 0, z = 1 },
}: Plane

/// The X-axis (can be used in both 2d and 3d contexts).
export X = {
  origin = [0, 0, 0],
  direction = [1, 0, 0],
}: Axis3d

/// The Y-axis (can be used in both 2d and 3d contexts).
export Y = {
  origin = [0, 0, 0],
  direction = [0, 1, 0],
}: Axis3d

/// The 3D Z-axis.
export Z = {
  origin = [0, 0, 0],
  direction = [0, 0, 1],
}: Axis3d

/// Identifies the starting face of an extrusion. I.e., the face which is extruded.
export START = 'start': TaggedFace

/// Identifies the ending face of an extrusion. I.e., the new face created by an extrusion.
export END = 'end': TaggedFace

/// Specifies that a new object is created during extrusion.
export NEW = "new": string

/// Specifies that the extrusion will be pulled into or pushed out of the existing object,
/// modifying it without creating a new object.
export MERGE = "merge": string

/// When bodies are solid, they have a top and bottom, and enclose all space between them.
export SOLID = "solid": string

/// When bodies are surfaces, they have zero thickness. They are perfectly flat and do not
/// enclose any space.
export SURFACE = "surface": string

/// Counterclockwise circular direction, currently used by `region()`.
export CCW = "ccw": string

/// Clockwise circular direction, currently used by `region()`.
export CW = "cw": string

/// Create a helix.
///
/// ```kcl,no3d,legacySketch
/// // Create a helix around the Z axis.
/// helixPath = helix(
///     angleStart = 0,
///     ccw = true,
///     revolutions = 5,
///     length = 10,
///     radius = 5,
///     axis = Z,
///  )
///
/// // Create a spring by sweeping around the helix path.
/// springSketch = startSketchOn(XZ)
///     |> circle( center = [5, 0], radius = 0.5)
///     |> sweep(path = helixPath)
/// ```
///
/// ```kcl,no3d,legacySketch
/// // Create a helix around an edge.
/// helper001 = startSketchOn(XZ)
///  |> startProfile(at = [0, 0])
///  |> line(end = [0, 10], tag = $edge001)
///
/// helixPath = helix(
///     angleStart = 0,
///     ccw = true,
///     revolutions = 5,
///     length = 10,
///     radius = 5,
///     axis = edge001,
///  )
///
/// // Create a spring by sweeping around the helix path.
/// springSketch = startSketchOn(XZ)
///     |> circle( center = [5, 0], radius = 0.5 )
///     |> sweep(path = helixPath)
/// ```
///
/// ```kcl,no3d,legacySketch
/// // Create a helix around a custom axis.
/// helixPath = helix(
///     angleStart = 0,
///     ccw = true,
///     revolutions = 5,
///     length = 10,
///     radius = 5,
///     axis = {
///         direction = [0, 0, 1.0],
///         origin = [0, 0.25, 0]
///     }
///  )
///
/// // Create a spring by sweeping around the helix path.
/// springSketch = startSketchOn(XZ)
///     |> circle( center = [5, 0], radius = 1 )
///     |> sweep(path = helixPath)
/// ```
///
/// ```kcl,no3d,legacySketch
/// // Create a helix on a cylinder.
///
/// part001 = startSketchOn(XY)
///   |> circle( center = [5, 5], radius= 10 )
///   |> extrude(length = 10)
///
/// helix(
///     angleStart = 0,
///     ccw = true,
///     revolutions = 16,
///     cylinder = part001,
///  )
/// ```
/// ```kcl,sketchSolve
/// // Demonstrate building a helix where the central axis is a line defined in a sketch block.
/// // First, here's the sketch block with a line:
/// sketch002 = sketch(on = XZ) {
///   line1 = line(start = [var -0.82mm, var 3.4mm], end = [var -1.58mm, var -5.24mm])
/// }
///
/// // Create a helix around the line in the sketch above.
/// helixPath = helix(
///   angleStart = 0,
///   ccw = true,
///   revolutions = 5,
///   length = 10,
///   radius = 5,
///   axis = sketch002.line1,
/// )
///
/// // Create a spring by sweeping around the helix path.
/// springSketch = startSketchOn(XZ)
///   |> circle(center = [5, 0], radius = 0.5)
///   |> sweep(path = helixPath)
/// ```
@(impl = std_rust, feature_tree = true)
export fn helix(
  /// Number of revolutions.
  revolutions: number(_),
  /// Start angle.
  angleStart: number(Angle),
  /// Is the helix rotation counter clockwise? The default is `false`.
  ccw?: bool,
  /// Radius of the helix.
  @(includeInSnippet = true)
  radius?: number(Length),
  /// Axis to use for the helix.
  /// The center of the helix's base will be at this axis's origin point.
  @(includeInSnippet = true)
  axis?: Axis3d | Edge | Segment,
  /// Length of the helix. This is not necessary if the helix is created around an edge. If not given the length of the edge is used.
  @(includeInSnippet = true)
  length?: number(Length),
  /// Cylinder to create the helix on.
  cylinder?: Solid,
): Helix {}

/// Offset a plane by a distance along its normal.
///
/// For example, if you offset the `XZ` plane by 10, the new plane will be parallel to the `XZ`
/// plane and 10 units away from it.
///
/// ```kcl,legacySketch
/// // Loft a square and a circle on the `XY` plane using offset.
/// squareSketch = startSketchOn(XY)
///     |> startProfile(at = [-100, 200])
///     |> line(end = [200, 0])
///     |> line(end = [0, -200])
///     |> line(end = [-200, 0])
///     |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
///     |> close()
///
/// circleSketch = startSketchOn(offsetPlane(XY, offset = 150))
///     |> circle( center = [0, 100], radius = 50 )
///
/// loft([squareSketch, circleSketch])
/// ```
///
/// ```kcl,legacySketch
/// // Loft a square and a circle on the `XZ` plane using offset.
/// squareSketch = startSketchOn(XZ)
///     |> startProfile(at = [-100, 200])
///     |> line(end = [200, 0])
///     |> line(end = [0, -200])
///     |> line(end = [-200, 0])
///     |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
///     |> close()
///
/// circleSketch = startSketchOn(offsetPlane(XZ, offset = 150))
///     |> circle( center = [0, 100], radius = 50 )
///
/// loft([squareSketch, circleSketch])
/// ```
///
/// ```kcl,legacySketch
/// // Loft a square and a circle on the `YZ` plane using offset.
/// squareSketch = startSketchOn(YZ)
///     |> startProfile(at = [-100, 200])
///     |> line(end = [200, 0])
///     |> line(end = [0, -200])
///     |> line(end = [-200, 0])
///     |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
///     |> close()
///
/// circleSketch = startSketchOn(offsetPlane(YZ, offset = 150))
///     |> circle( center = [0, 100], radius = 50 )
///
/// loft([squareSketch, circleSketch])
/// ```
///
/// ```kcl,legacySketch
/// // Loft a square and a circle on the `-XZ` plane using offset.
/// squareSketch = startSketchOn(-XZ)
///     |> startProfile(at = [-100, 200])
///     |> line(end = [200, 0])
///     |> line(end = [0, -200])
///     |> line(end = [-200, 0])
///     |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
///     |> close()
///
/// circleSketch = startSketchOn(offsetPlane(-XZ, offset = 150))
///     |> circle(center = [0, 100], radius = 50)
///
/// loft([squareSketch, circleSketch])
/// ```
///
/// ```kcl,legacySketch
/// // A circle on the XY plane
/// startSketchOn(XY)
///   |> startProfile(at = [0, 0])
///   |> circle( radius = 10, center = [0, 0] )
///
/// // Triangle on the plane 4 units above
/// startSketchOn(offsetPlane(XY, offset = 4))
///   |> startProfile(at = [0, 0])
///   |> line(end = [10, 0])
///   |> line(end = [0, 10])
///   |> close()
/// ```
@(impl = std_rust, feature_tree = true)
export fn offsetPlane(
  /// The plane (e.g. `XY`) which this new plane is created from.
  @plane: Plane,
  /// Distance from the standard plane this new plane will be created at.
  offset: number(Length),
): Plane {}

/// Clone a sketch or solid.
///
/// This works essentially like a copy-paste operation. It creates a perfect replica
/// at that point in time that you can manipulate individually afterwards.
///
/// This doesn't really have much utility unless you need the equivalent of a double
/// instance pattern with zero transformations.
///
/// Really only use this function if YOU ARE SURE you need it. In most cases you
/// do not need clone and using a pattern with `instance = 2` is more appropriate.
///
/// ```kcl,legacySketch
/// // Clone a basic sketch and move it and extrude it.
/// exampleSketch = startSketchOn(XY)
///   |> startProfile(at = [0, 0])
///   |> line(end = [10, 0])
///   |> line(end = [0, 10])
///   |> line(end = [-10, 0])
///   |> close()
///
/// clonedSketch = clone(exampleSketch)
///     |> scale(
///     x = 1.0,
///     y = 1.0,
///     z = 2.5,
///     )
///     |> translate(
///         x = 15.0,
///         y = 0,
///         z = 0,
///     )
///
/// extrude(clonedSketch, length = 5)
/// ```
///
/// ```kcl,legacySketch
/// // Clone a basic solid and move it.
///
/// exampleSketch = startSketchOn(XY)
///   |> startProfile(at = [0, 0])
///   |> line(end = [10, 0])
///   |> line(end = [0, 10])
///   |> line(end = [-10, 0])
///   |> close()
///
/// myPart = extrude(exampleSketch, length = 5)
/// clonedPart = clone(myPart)
///     |> translate(
///         x = 25.0,
///     )
/// ```
///
/// ```kcl,legacySketch
/// // Translate and rotate a cloned sketch to create a loft.
///
/// sketch001 = startSketchOn(XY)
///         |> startProfile(at = [-10, 10])
///         |> xLine(length = 20)
///         |> yLine(length = -20)
///         |> xLine(length = -20)
///         |> close()
///
/// sketch002 = clone(sketch001)
///     |> translate(x = 0, y = 0, z = 20)
///     |> rotate(axis = [0, 0, 1.0], angle = 45)
///
/// loft([sketch001, sketch002])
/// ```
///
/// ```kcl,legacySketch
/// // Translate a cloned solid. Fillet only the clone.
///
/// sketch001 = startSketchOn(XY)
/// |> startProfile(at = [-10, 10])
/// |> xLine(length = 20)
/// |> yLine(length = -20)
/// |> xLine(length = -20, tag = $face0)
/// |> line(endAbsolute = [profileStart()], tag=$face1)
/// |> extrude(length = 5, tagEnd=$end1)
///
/// sketch002 = clone(sketch001)
/// |> translate(x = 0, y = 0, z = 20)
///
/// fillet(
/// sketch002,
/// radius = 2,
/// tags = [getCommonEdge(faces = [sketch002.sketch.tags.face0, sketch002.sketch.tags.face1])],
/// )
/// ```
///
/// ```kcl,legacySketch
/// // You can reuse the tags from the original geometry with the cloned geometry.
///
/// sketch001 = startSketchOn(XY)
///   |> startProfile(at = [0, 0])
///   |> line(end = [10, 0])
///   |> line(end = [0, 10], tag = $sketchingFace)
///   |> line(end = [-10, 0])
///   |> close()
///
/// sketch002 = clone(sketch001)
///   |> translate(x = 15, y = 0, z = 5)
///   |> extrude(length = 5)
///
/// startSketchOn(sketch002, face = sketch002.sketch.tags.sketchingFace)
///   |> startProfile(at = [4, 6])
///   |> line(end = [3, 0])
///   |> line(end = [0, 3])
///   |> line(end = [-3, 0])
///   |> close()
///   |> extrude(length = 5)
/// ```
///
/// ```kcl,legacySketch
/// // You can also use the tags from the original geometry to fillet the cloned geometry.
///
/// width = 20
/// length = 10
/// thickness = 1
/// filletRadius = 2
///
/// mountingPlateSketch = startSketchOn(XY)
///   |> startProfile(at = [-width/2, -length/2])
///   |> line(endAbsolute = [width/2, -length/2], tag = $edge1)
///   |> line(endAbsolute = [width/2, length/2], tag = $edge2)
///   |> line(endAbsolute = [-width/2, length/2], tag = $edge3)
///   |> close(tag = $edge4)
///
/// mountingPlate = extrude(mountingPlateSketch, length = thickness)
///
/// clonedMountingPlate = clone(mountingPlate)
///
/// fillet(
///       clonedMountingPlate,
///        radius = filletRadius,
///        tags = [
///          getNextAdjacentEdge(clonedMountingPlate.sketch.tags.edge1),
///          getNextAdjacentEdge(clonedMountingPlate.sketch.tags.edge2),
///          getNextAdjacentEdge(clonedMountingPlate.sketch.tags.edge3),
///          getNextAdjacentEdge(clonedMountingPlate.sketch.tags.edge4)
///        ],
///      )
///   |> translate(x = 0, y = 50, z = 0)
/// ```
///
/// ```kcl,legacySketch
/// // Create a spring by sweeping around a helix path from a cloned sketch.
///
/// // Create a helix around the Z axis.
/// helixPath = helix(
///     angleStart = 0,
///     ccw = true,
///     revolutions = 4,
///     length = 10,
///     radius = 5,
///     axis = Z,
///  )
///
///
/// springSketch = startSketchOn(XZ)
///     |> circle( center = [0, 0], radius = 1)
///
/// // Create a spring by sweeping around the helix path.
/// sweepedSpring = clone(springSketch)
///     |> translate(x=5)
///     |> sweep(path = helixPath)
/// ```
///
/// ```kcl,legacySketch
/// // A donut shape from a cloned sketch.
/// sketch001 = startSketchOn(XY)
///     |> circle( center = [15, 0], radius = 5 )
///
/// sketch002 = clone(sketch001)
///    |> translate( z = 30)
///     |> revolve(
///         angle = 360,
///         axis = Y,
///     )
/// ```
///
/// ```kcl,legacySketch
/// // Sketch on the end of a revolved face by tagging the end face.
/// // This shows the cloned geometry will have the same tags as the original geometry.
///
/// exampleSketch = startSketchOn(XY)
///   |> startProfile(at = [4, 12])
///   |> line(end = [2, 0])
///   |> line(end = [0, -6])
///   |> line(end = [4, -6])
///   |> line(end = [0, -6])
///   |> line(end = [-3.75, -4.5])
///   |> line(end = [0, -5.5])
///   |> line(end = [-2, 0])
///   |> close()
///
/// example001 = revolve(exampleSketch, axis = Y, angle = 180, tagEnd = $end01)
///
/// // example002 = clone(example001)
/// // |> translate(x = 0, y = 20, z = 0)
///
/// // Sketch on the cloned face.
/// // exampleSketch002 = startSketchOn(example002, face = example002.sketch.tags.end01)
/// //  |> startProfile(at = [4.5, -5])
/// //  |> line(end = [0, 5])
/// //  |> line(end = [5, 0])
/// //  |> line(end = [0, -5])
/// //  |> close()
///
/// // example003 = extrude(exampleSketch002, length = 5)
/// ```
///
/// ```kcl,sketchSyntaxAgnostic
/// // Clone an imported model.
///
/// import "tests/inputs/cube.sldprt" as cube
///
/// myCube = cube
///
/// clonedCube = clone(myCube)
///    |> translate(
///    x = 1020,
///    )
///    |> appearance(
///        color = "#ff0000",
///        metalness = 50,
///        roughness = 50
///    )
/// ```
///
/// ```kcl,legacySketch
/// // Clone an array of sketches and solids
/// exampleSketch = startSketchOn(XY)
///  |> startProfile(at = [0, 0])
///  |> line(end = [10, 0])
///  |> line(end = [0, 10])
///  |> line(end = [-10, 0])
///  |> close()
///
/// exampleSolid = startSketchOn(XY)
///   |> startProfile(at = [-15, 0])
///   |> line(end = [10, 0])
///   |> line(end = [0, 10])
///   |> line(end = [-10, 0])
///   |> close()
///   |> extrude(length = 5)
///
///
/// inputArray = [ exampleSketch, exampleSolid]
/// outputArray = clone(inputArray)
///
/// outputArray[0]
/// |> translate(xyz = [10, 10, 10])
/// |> extrude(length = 5)
///
/// clonedSolid = outputArray[1]
/// |> translate(xyz = [-10, -10, -10])
///
/// ```
///
/// // Clone an array that includes an imported geometry, solid and sketch.
/// ```kcl,legacySketch
/// import "tests/inputs/cube.sldprt" as cube
///
/// geom = cube
/// |> translate(xyz = [1000, 50 , 50])
///
/// // Clone a basic sketch and move it and extrude it.
/// exampleSketch = startSketchOn(XY)
///   |> startProfile(at = [0, 0])
///   |> line(end = [10, 0])
///   |> line(end = [0, 10])
///   |> line(end = [-10, 0])
///   |> close()
///
/// exampleSolid = startSketchOn(XY)
///   |> startProfile(at = [-15, 0])
///   |> line(end = [10, 0])
///   |> line(end = [0, 10])
///   |> line(end = [-10, 0])
///   |> close()
///   |> extrude(length = 5)
///
///
/// inputArray = [ exampleSketch, exampleSolid, geom ]
/// outputArray = clone(inputArray)
///
/// outputArray[0]
/// |> translate(xyz = [10, 10, 10])
/// |> extrude(length = 5)
/// ```
@(impl = std_rust, feature_tree = true)
export fn clone(
  /// The sketch, solid, or imported geometry to be cloned.
  @geometries: [Sketch | Solid | ImportedGeometry; 1+],
): [Sketch | Solid | ImportedGeometry; 1+] {}

/// Asserts that a value is the boolean value true.
///
/// ```kcl,norun,sketchSyntaxAgnostic
/// kclIsFun = true
/// assertIs(kclIsFun)
/// ```
@(impl = std_rust, feature_tree = false)
export fn assertIs(
  /// Value to check. If this is the boolean value true, assert passes. Otherwise it fails..
  @actual: bool,
  /// If the value was false, the program will terminate with this error message
  error?: string,
) {}

/// Check a value meets some expected conditions at runtime. Program terminates with an error if conditions aren't met.
/// If you provide multiple conditions, they will all be checked and all must be met.
///
/// ```kcl,norun,sketchSyntaxAgnostic
/// n = 10
/// assert(n, isEqualTo = 10)
/// assert(n, isGreaterThanOrEqual = 0, isLessThan = 100, error = "number should be between 0 and 100")
/// assert(1.0000000000012, isEqualTo = 1, tolerance = 0.0001, error = "number should be almost exactly 1")
/// assert(PI, isNotEqualTo = 3, tolerance = 0.0001, error = "PI should not be exactly 3")
/// ```
@(impl = std_rust, feature_tree = false)
export fn assert(
  /// Value to check. If this is the boolean value true, assert passes. Otherwise it fails..
  @actual: number,
  /// Comparison argument. If given, checks the `actual` value is greater than this.
  isGreaterThan?: number,
  /// Comparison argument. If given, checks the `actual` value is less than this.
  isLessThan?: number,
  /// Comparison argument. If given, checks the `actual` value is greater than or equal to this.
  isGreaterThanOrEqual?: number,
  /// Comparison argument. If given, checks the `actual` value is less than or equal to this.
  isLessThanOrEqual?: number,
  /// Comparison argument. If given, checks the `actual` value is equal to this.
  @(includeInSnippet = true)
  isEqualTo?: number,
  /// Comparison argument. If given, checks the `actual` value is not equal to this.
  isNotEqualTo?: number,
  /// If `isEqualTo` or `isNotEqualTo` is used, this is the tolerance to allow for the comparison. This tolerance is used because KCL's number system has some floating-point imprecision when used with very large decimal places.
  tolerance?: number,
  /// If the value was false, the program will terminate with this error message
  error?: string,
) {}


/// Given a face index, find its ID.
/// In general, you should prefer tagging faces to using this function. Use this function if
/// you can't tag a face. For example, if the face comes from imported geometry in a .STEP file,
/// or if it's from an operation that doesn't yet support tagging the faces it creates, like `subtract`.
/// ```kcl,legacySketch
/// // Cylinder
/// cylinder = startSketchOn(XY)
///   |> circle(center = [0, 0], radius = 4.09, tag = $seg01)
///   |> extrude(length = 5)
///
/// // Delete the face at index 2
/// // (the top face)
/// deleteFace(cylinder, faces = [faceId(cylinder, index = 2)])
/// ```
@(impl = std_rust, feature_tree = false)
export fn faceId(
  /// The solid whose faces we're trying to find
  @body: Solid,
  /// Face to identify.
  /// The index is a stable ordering of faces, used when you can't get the
  /// usual ID of a face.
  index: number(Count),
): TaggedFace {}

/// Given an edge index, find its ID.
/// In general, you should prefer tagging edges to using this function. Use this function if
/// you can't tag an edge. For example, if the edge comes from imported geometry in a .STEP file,
/// or if it's from an operation that doesn't yet support tagging the edges it creates, like `subtract`.
/// ```kcl,legacySketch
/// // Cylinder
/// cylinder = startSketchOn(XY)
///   |> circle(center = [0, 0], radius = 4.09, tag = $seg01)
///   |> extrude(length = 5)
///   // Fillet the edge at index 2, i.e. the top edge.
///   |> fillet(radius = 1, tags = [edgeId(index = 2)])
/// ```
/// ```kcl,legacySketch
/// startSketchOn(XY)
///   |> rectangle(width = 10, height = 10, center = [0, 0])
///   |> extrude(length = 2)
///   |> fillet(radius = 0.5, tags = [edgeId(closestTo = [5, 0, 2])])
/// ```
@(impl = std_rust, feature_tree = false)
export fn edgeId(
  /// The solid whose edges we're trying to find
  @body: Solid,
  /// Edge to identify.
  /// The index is a stable ordering of edges, used when you can't get the
  /// usual ID of an edge.
  index?: number(Count),
  /// Query the edge closest to this point. Uses absolute global coordinates.
  closestTo?: Point3d,
): Edge {}