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
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
/// This module contains functions for modifying solids, e.g., by adding a fillet or chamfer, or
/// removing part of a solid.

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

import Face from "std::types"

/// Blend a transitional edge along a tagged path, smoothing the sharp edge.
///
/// Fillet is similar in function and use to a chamfer, except
/// a chamfer will cut a sharp transition along an edge while fillet
/// will smoothly blend the transition.
///
/// ```kcl,legacySketch
/// 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)
///   |> fillet(
///     radius = filletRadius,
///     tags = [
///       getNextAdjacentEdge(edge1),
///       getNextAdjacentEdge(edge2),
///       getNextAdjacentEdge(edge3),
///       getNextAdjacentEdge(edge4)
///     ],
///   )
/// ```
///
/// ```kcl,legacySketch
/// width = 20
/// length = 10
/// thickness = 1
/// filletRadius = 1
///
/// 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)
///   |> fillet(
///     radius = filletRadius,
///     tolerance = 0.000001,
///     tags = [
///       getNextAdjacentEdge(edge1),
///       getNextAdjacentEdge(edge2),
///       getNextAdjacentEdge(edge3),
///       getNextAdjacentEdge(edge4)
///     ],
///   )
/// ```
///
/// ```kcl,sketchSolve
/// blockProfile = sketch(on = XY) {
///   edge1 = line(start = [var 0mm, var 0mm], end = [var 6mm, var 0mm])
///   edge2 = line(start = [var 6mm, var 0mm], end = [var 6mm, var 4mm])
///   edge3 = line(start = [var 6mm, var 4mm], end = [var 0mm, var 4mm])
///   edge4 = line(start = [var 0mm, var 4mm], end = [var 0mm, var 0mm])
///   coincident([edge1.end, edge2.start])
///   coincident([edge2.end, edge3.start])
///   coincident([edge3.end, edge4.start])
///   coincident([edge4.end, edge1.start])
///   horizontal(edge1)
///   vertical(edge2)
///   horizontal(edge3)
///   vertical(edge4)
/// }
///
/// block = extrude(region(point = [3mm, 2mm], sketch = blockProfile), length = 3, tagEnd = $top)
///
/// tabProfile = startSketchOn(block, face = top)
///   |> startProfile(at = [1mm, 1mm])
///   |> line(end = [4mm, 0mm], tag = $tabEdge)
///   |> line(end = [0mm, 1mm])
///   |> line(end = [-4mm, 0mm])
///   |> close()
///
/// blockWithTab = extrude(tabProfile, length = 1mm)
/// filletedBlock = fillet(blockWithTab, radius = 0.5mm, tags = [getNextAdjacentEdge(tabEdge)])
/// ```
@(impl = std_rust, feature_tree = true)
export fn fillet(
  /// The solid whose edges should be filletted
  @solid: Solid,
  /// The radius of the fillet
  radius: number(Length),
  /// The paths you want to fillet
  tags: [Edge; 1+],
  /// Defines the smallest distance below which two entities are considered coincident, intersecting, coplanar, or similar. For most use cases, it should not be changed from its default value of 10^-7 millimeters.
  tolerance?: number(Length),
  /// Create a new tag which refers to this fillet
  tag?: TagDecl,
  /// You probably shouldn't set this or care about this, it's for opting back into an older version of an engine algorithm.
  /// If true, revert to older engine SSI algorithm.
  /// Defaults to false.
  legacyMethod?: bool,
): Solid {}

/// Cut a straight transitional edge along a tagged path.
///
/// Chamfer is similar in function and use to a fillet, except
/// a fillet will blend the transition along an edge, rather than cut
/// a sharp, straight transitional edge.
///
/// ```kcl,legacySketch
/// // Chamfer a mounting plate.
/// width = 20
/// length = 10
/// thickness = 1
/// chamferLength = 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)
///   |> chamfer(
///     length = chamferLength,
///     tags = [
///       getNextAdjacentEdge(edge1),
///       getNextAdjacentEdge(edge2),
///       getNextAdjacentEdge(edge3),
///       getNextAdjacentEdge(edge4)
///     ],
///   )
/// ```
///
/// ```kcl,legacySketch
/// // Sketch on the face of a chamfer.
/// fn cube(pos, scale) {
/// sg = startSketchOn(XY)
///     |> startProfile(at = pos)
///     |> line(end = [0, scale])
///     |> line(end = [scale, 0])
///     |> line(end = [0, -scale])
///
///     return sg
/// }
///
/// part001 = cube(pos = [0,0], scale = 20)
///     |> close(tag = $line1)
///     |> extrude(length = 20)
///     // We tag the chamfer to reference it later.
///     |> chamfer(
///         length = 10,
///         tags = [getOppositeEdge(line1)],
///         tag = $chamfer1,
///     )  
///
/// sketch001 = startSketchOn(part001, face = chamfer1)
///     |> startProfile(at = [10, 10])
///     |> line(end = [2, 0])
///     |> line(end = [0, 2])
///     |> line(end = [-2, 0])
///     |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
///     |> close()
///     |> extrude(length = 10)
/// ```
///
/// ```kcl,legacySketch
/// // Specify a custom chamfer angle.
/// fn cube(pos, scale) {
/// sg = startSketchOn(XY)
///     |> startProfile(at = pos)
///     |> line(end = [0, scale])
///     |> line(end = [scale, 0])
///     |> line(end = [0, -scale])
///
///     return sg
/// }
///
/// part001 = cube(pos = [0,0], scale = 20)
///     |> close(tag = $line1)
///     |> extrude(length = 20)
///     |> chamfer(
///         length = 10,
///         angle = 30deg,
///         tags = [getOppositeEdge(line1)],
///     )
/// ```
///
/// ```kcl,sketchSolve
/// baseProfile = sketch(on = XY) {
///   edge1 = line(start = [var 0mm, var 0mm], end = [var 6mm, var 0mm])
///   edge2 = line(start = [var 6mm, var 0mm], end = [var 6mm, var 4mm])
///   edge3 = line(start = [var 6mm, var 4mm], end = [var 0mm, var 4mm])
///   edge4 = line(start = [var 0mm, var 4mm], end = [var 0mm, var 0mm])
///   coincident([edge1.end, edge2.start])
///   coincident([edge2.end, edge3.start])
///   coincident([edge3.end, edge4.start])
///   coincident([edge4.end, edge1.start])
///   horizontal(edge1)
///   vertical(edge2)
///   horizontal(edge3)
///   vertical(edge4)
/// }
///
/// block = extrude(region(point = [3mm, 2mm], sketch = baseProfile), length = 3mm, tagEnd = $top)
///
/// tabProfile = startSketchOn(block, face = top)
///   |> startProfile(at = [1mm, 1mm])
///   |> line(end = [4mm, 0mm], tag = $tabEdge)
///   |> line(end = [0mm, 1mm])
///   |> line(end = [-4mm, 0mm])
///   |> close()
///
/// blockWithTab = extrude(tabProfile, length = 1mm)
/// chamfered = chamfer(blockWithTab, length = 0.5mm, tags = [getNextAdjacentEdge(tabEdge)])
/// ```
@(impl = std_rust, feature_tree = true)
export fn chamfer(
  /// The solid whose edges should be chamfered
  @solid: Solid,
  /// Chamfering cuts away two faces to create a third face.
  /// This is the length to chamfer away from each face.
  /// The larger this length to chamfer away, the larger the
  /// new face will be.
  length: number(Length),
  /// The paths you want to chamfer
  tags: [Edge; 1+],
  /// Chamfering cuts away two faces to create a third face.
  /// If this argument isn't given, the lengths chamfered away from both
  /// the first and second face are both given by `length`.
  /// If this argument _is_ given, it determines how much is cut away
  /// from the second face. Incompatible with `angle`.
  secondLength?: number(Length),
  /// Chamfering cuts away two faces to create a third face.
  /// This argument determines the angle between the two cut edges.
  /// Requires `length`, incompatible with `secondLength`.
  /// The valid range is 0deg < angle < 90deg.
  angle?: number(Angle),
  /// Create a new tag which refers to this chamfer
  tag?: TagDecl,
  /// You probably shouldn't set this or care about this, it's for opting back into an older version of an engine algorithm.
  /// If true, revert to older engine SSI algorithm.
  /// Defaults to false.
  legacyMethod?: bool,
): Solid {}

/// Remove volume from a 3-dimensional shape such that a wall of the
/// provided thickness remains, taking volume starting at the provided
/// face, leaving it open in that direction.
///
/// ```kcl,legacySketch
/// // Remove the end face for the extrusion.
/// firstSketch = startSketchOn(XY)
///     |> startProfile(at = [-12, 12])
///     |> line(end = [24, 0])
///     |> line(end = [0, -24])
///     |> line(end = [-24, 0])
///     |> close()
///     |> extrude(length = 6)
///
/// // Remove the end face for the extrusion.
/// shell(
///     firstSketch,
///     faces = [END],
///     thickness = 0.25,
/// )
/// ```
///
/// ```kcl,legacySketch
/// // Remove the start face for the extrusion.
/// firstSketch = startSketchOn(-XZ)
///     |> startProfile(at = [-12, 12])
///     |> line(end = [24, 0])
///     |> line(end = [0, -24])
///     |> line(end = [-24, 0])
///     |> close()
///     |> extrude(length = 6)
///
/// // Remove the start face for the extrusion.
/// shell(
///     firstSketch,
///     faces = [START],
///     thickness = 0.25,
/// )
/// ```
///
/// ```kcl,legacySketch
/// // Remove a tagged face and the end face for the extrusion.
/// firstSketch = startSketchOn(XY)
///     |> startProfile(at = [-12, 12])
///     |> line(end = [24, 0])
///     |> line(end = [0, -24])
///     |> line(end = [-24, 0], tag = $myTag)
///     |> close()
///     |> extrude(length = 6)
///
/// // Remove a tagged face for the extrusion.
/// shell(
///     firstSketch,
///     faces = [myTag],
///     thickness = 0.25,
/// )
/// ```
///
/// ```kcl,legacySketch
/// // Remove multiple faces at once.
/// firstSketch = startSketchOn(XY)
///     |> startProfile(at = [-12, 12])
///     |> line(end = [24, 0])
///     |> line(end = [0, -24])
///     |> line(end = [-24, 0], tag = $myTag)
///     |> close()
///     |> extrude(length = 6)
///
/// // Remove a tagged face and the end face for the extrusion.
/// shell(
///     firstSketch,
///     faces = [myTag, END],
///     thickness = 0.25,
/// )
/// ```
///
/// ```kcl,legacySketch
/// // Shell a sketch on face.
/// size = 100
/// case = startSketchOn(-XZ)
///     |> startProfile(at = [-size, -size])
///     |> line(end = [2 * size, 0])
///     |> line(end = [0, 2 * size])
///     |> tangentialArc(endAbsolute = [-size, size])
///     |> close()
///     |> extrude(length = 65)
///
/// thing1 = startSketchOn(case, face = END)
///     |> circle( center = [-size / 2, -size / 2], radius = 25 )
///     |> extrude(length = 50)
///
/// thing2 = startSketchOn(case, face = END)
///     |> circle( center = [size / 2, -size / 2], radius = 25 )
///     |> extrude(length = 50)
///
/// // We put "case" in the shell function to shell the entire object.
/// shell(case, faces = [START], thickness = 5)
/// ```
///
/// ```kcl,legacySketch
/// // Shell a sketch on face object on the end face.
/// size = 100
/// case = startSketchOn(XY)
///     |> startProfile(at = [-size, -size])
///     |> line(end = [2 * size, 0])
///     |> line(end = [0, 2 * size])
///     |> tangentialArc(endAbsolute = [-size, size])
///     |> close()
///     |> extrude(length = 65)
///
/// thing1 = startSketchOn(case, face = END)
///     |> circle( center = [-size / 2, -size / 2], radius = 25 )
///     |> extrude(length = 50)
///
/// thing2 = startSketchOn(case, face = END)
///     |> circle( center = [size / 2, -size / 2], radius = 25 )
///     |> extrude(length = 50)
///
/// // We put "thing1" in the shell function to shell the end face of the object.
/// shell(thing1, faces = [END], thickness = 5)
/// ```
///
/// ```kcl,legacySketch
/// // Shell sketched on face objects on the end face, include all sketches to shell
/// // the entire object.
///
/// size = 100
/// case = startSketchOn(XY)
///     |> startProfile(at = [-size, -size])
///     |> line(end = [2 * size, 0])
///     |> line(end = [0, 2 * size])
///     |> tangentialArc(endAbsolute = [-size, size])
///     |> close()
///     |> extrude(length = 65)
///
/// thing1 = startSketchOn(case, face = END)
///     |> circle( center = [-size / 2, -size / 2], radius = 25 )
///     |> extrude(length = 50)
///
/// thing2 = startSketchOn(case, face = END)
///     |> circle( center = [size / 2, -size / 2], radius = 25)
///     |> extrude(length = 50)
///
/// // We put "thing1" and "thing2" in the shell function to shell the end face of the object.
/// shell([thing1, thing2], faces = [END], thickness = 5)
/// ```
///
/// ```kcl,sketchSolve
/// boxProfile = sketch(on = XY) {
///   edge1 = line(start = [var 0mm, var 0mm], end = [var 6mm, var 0mm])
///   edge2 = line(start = [var 6mm, var 0mm], end = [var 6mm, var 4mm])
///   edge3 = line(start = [var 6mm, var 4mm], end = [var 0mm, var 4mm])
///   edge4 = line(start = [var 0mm, var 4mm], end = [var 0mm, var 0mm])
///   coincident([edge1.end, edge2.start])
///   coincident([edge2.end, edge3.start])
///   coincident([edge3.end, edge4.start])
///   coincident([edge4.end, edge1.start])
///   horizontal(edge1)
///   vertical(edge2)
///   horizontal(edge3)
///   vertical(edge4)
/// }
///
/// box = extrude(region(point = [3mm, 2mm], sketch = boxProfile), length = 4mm)
/// openBox = shell(box, faces = [END], thickness = 0.5mm)
/// ```
@(impl = std_rust, feature_tree = true)
export fn shell(
  /// Which solid (or solids) to shell out
  @solids: [Solid; 1+],
  /// The thickness of the shell
  thickness: number(Length),
  /// The faces you want removed
  faces: [TaggedFace; 1+],
): [Solid] {}


/// Make the inside of a 3D object hollow.
///
/// Remove volume from a 3-dimensional shape such that a wall of the
/// provided thickness remains around the exterior of the shape.
/// By default, it'll look visually the same, but you can see the difference
/// if you use `appearance` to make it transparent, or cut it open with
/// a `subtract`.
///
/// ```kcl,legacySketch
/// // Make two cubes, utterly identical,
/// // except that one (left) is hollowed out,
/// // and the other one (right) isn't.
/// width = 2
/// solidCube = startSketchOn(-XZ)
///   |> startProfile(at = [-width, width])
///   |> line(end = [width, 0])
///   |> line(end = [0, -width])
///   |> line(end = [-width, 0])
///   |> close()
///   |> extrude(length = width, symmetric = true)
/// 
/// hollowCube = clone(solidCube)
///   |> hollow(thickness = 0.25)
///   |> translate(x = width * 1.1)
/// 
/// // Make a tool that spans the top half of both cubes,
/// // so we can cut open the cubes and look at their insides.
/// tool = startSketchOn(offsetPlane(XY, offset = width))
///   |> startProfile(at = [0, width])
///   |> line(end = [width * 3, 0])
///   |> line(end = [0, -width * 2])
///   |> line(end = [-width * 3, 0])
///   |> close()
///   |> extrude(length = width, symmetric = true)
/// subtract([solidCube, hollowCube], tools = tool)
/// ```
/// ```kcl,legacySketch
/// // Hollow a sketch on face object.
/// size = 100
/// case = startSketchOn(-XZ)
///     |> startProfile(at = [-size, -size])
///     |> line(end = [2 * size, 0])
///     |> line(end = [0, 2 * size])
///     |> tangentialArc(endAbsolute = [-size, size])
///     |> close()
///     |> extrude(length = 65)
///
/// thing1 = startSketchOn(case, face = END)
///     |> circle( center = [-size / 2, -size / 2], radius = 25 )
///     |> extrude(length = 50)
///
/// thing2 = startSketchOn(case, face = END)
///     |> circle( center = [size / 2, -size / 2], radius = 25 )
///     |> extrude(length = 50)
///
/// hollow(case, thickness = 0.5)
/// ```
@(impl = std_rust, feature_tree = true)
export fn hollow(
  /// Which solid to hollow out
  @solid: Solid,
  /// The thickness of the remaining shell
  thickness: number(Length),
): Solid {}

/// Repeat a 3-dimensional solid, changing it each time.
///
/// Replicates the 3D solid, applying a transformation function to each replica.
/// Transformation function could alter rotation, scale, visibility, position, etc.
///
/// The `patternTransform` call itself takes a number for how many total instances of
/// the shape should be. For example, if you use a circle with `patternTransform(instances = 4, transform = f)`
/// then there will be 4 circles: the original, and 3 created by replicating the original and
/// calling the transform function on each.
///
/// The transform function takes a single parameter: an integer representing which
/// number replication the transform is for. E.g. the first replica to be transformed
/// will be passed the argument `1`. This simplifies your math: the transform function can
/// rely on id `0` being the original instance passed into the `patternTransform`. See the examples.
///
/// The transform function returns a transform object. All properties of the object are optional,
/// they each default to "no change". So the overall transform object defaults to "no change" too.
/// Its properties are:
///
///  - `translate` (3D point)
///
///    Translates the replica, moving its position in space.      
///
///  - `replicate` (bool)
///
///    If false, this ID will not actually copy the object. It'll be skipped.
///
///  - `scale` (3D point)
///
///    Stretches the object, multiplying its width in the given dimension by the point's component in
///    that direction.      
///
///  - `rotation` (object, with the following properties)
///
///    - `rotation.axis` (a 3D point, defaults to the Z axis)
///
///    - `rotation.angle`
///
///    - `rotation.origin` (either "local" i.e. rotate around its own center, "global" i.e. rotate around the scene's center, or a 3D point, defaults to "local")
///
/// ```kcl,legacySketch
/// // Each instance will be shifted along the X axis.
/// fn transform(@id) {
///   return { translate = [4 * id, 0, 0] }
/// }
///
/// // Sketch 4 cylinders.
/// sketch001 = startSketchOn(XZ)
///   |> circle(center = [0, 0], radius = 2)
///   |> extrude(length = 5)
///   |> patternTransform(instances = 4, transform = transform)
/// ```
///
/// ```kcl,legacySketch
/// // Each instance will be shifted along the X axis,
/// // with a gap between the original (at x = 0) and the first replica
/// // (at x = 8). This is because `id` starts at 1.
/// fn transform(@id) {
///   return { translate = [4 * (1+id), 0, 0] }
/// }
///
/// sketch001 = startSketchOn(XZ)
///   |> circle(center = [0, 0], radius = 2)
///   |> extrude(length = 5)
///   |> patternTransform(instances = 4, transform = transform)
/// ```
///
/// ```kcl,legacySketch
/// fn cube(length, center) {
///   l = length/2
///   x = center[0]
///   y = center[1]
///   p0 = [-l + x, -l + y]
///   p1 = [-l + x,  l + y]
///   p2 = [ l + x,  l + y]
///   p3 = [ l + x, -l + y]
///
///   return startSketchOn(XY)
///   |> startProfile(at = p0)
///   |> line(endAbsolute = p1)
///   |> line(endAbsolute = p2)
///   |> line(endAbsolute = p3)
///   |> line(endAbsolute = p0)
///   |> close()
///   |> extrude(length = length)
/// }
///
/// width = 20
/// fn transform(@i) {
///   return {
///     // Move down each time.
///     translate = [0, 0, -i * width],
///     // Make the cube longer, wider and flatter each time.
///     scale = [pow(1.1, exp = i), pow(1.1, exp = i), pow(0.9, exp = i)],
///     // Turn by 15 degrees each time.
///     rotation = {
///       angle = 15deg * i,
///       origin = "local",
///     }
///   }
/// }
///
/// myCubes =
///   cube(length = width, center = [100,0])
///   |> patternTransform(instances = 25, transform = transform)
/// ```
///
/// ```kcl,legacySketch
/// fn cube(length, center) {
///   l = length/2
///   x = center[0]
///   y = center[1]
///   p0 = [-l + x, -l + y]
///   p1 = [-l + x,  l + y]
///   p2 = [ l + x,  l + y]
///   p3 = [ l + x, -l + y]
///   
///   return startSketchOn(XY)
///   |> startProfile(at = p0)
///   |> line(endAbsolute = p1)
///   |> line(endAbsolute = p2)
///   |> line(endAbsolute = p3)
///   |> line(endAbsolute = p0)
///   |> close()
///   |> extrude(length = length)
/// }
///
/// width = 20
/// fn transform(@i) {
///   return {
///     translate = [0, 0, -i * width],
///     rotation = {
///       angle = 90deg * i,
///       // Rotate around the overall scene's origin.
///       origin = "global",
///     }
///   }
/// }
/// myCubes =
///   cube(length = width, center = [100,100])
///   |> patternTransform(instances = 4, transform = transform)
/// ```
///
/// ```kcl,legacySketch
/// // Parameters
/// r = 50    // base radius
/// h = 10    // layer height
/// t = 0.005 // taper factor [0-1)
/// // Defines how to modify each layer of the vase.
/// // Each replica is shifted up the Z axis, and has a smoothly-varying radius
/// fn transform(@replicaId) {
///   scale = r * abs(1 - (t * replicaId)) * (5 + cos((replicaId / 8): number(rad)))
///   return {
///     translate = [0, 0, replicaId * 10],
///     scale = [scale, scale, 1],
///   }
/// }
/// // Each layer is just a pretty thin cylinder.
/// fn layer() {
///   return startSketchOn(XY) // or some other plane idk
///     |> circle(center = [0, 0], radius = 1, tag = $tag1)
///     |> extrude(length = h)
/// }
/// // The vase is 100 layers tall.
/// // The 100 layers are replica of each other, with a slight transformation applied to each.
/// vase = layer() |> patternTransform(instances = 100, transform = transform)
/// ```
///
/// ```kcl,legacySketch
/// fn transform(@i) {
///   // Transform functions can return multiple transforms. They'll be applied in order.
///   return [
///     { translate = [30 * i, 0, 0] },
///     { rotation = { angle = 45deg * i } },
///   ]
/// }
/// startSketchOn(XY)
///   |> startProfile(at = [0, 0])
///   |> polygon(
///        radius = 10,
///        numSides = 4,
///        center = [0, 0],
///        inscribed = false,
///      )
///   |> extrude(length = 4)
///   |> patternTransform(instances = 3, transform = transform)
/// ```
/// ```kcl,legacySketch
/// n = 5
/// width = 10
/// gap = 1.5 * width
/// 
/// // Transform function
/// fn chessboard(@i) {
///   row = rem(i, divisor = n)
///   column = floor(i / n)
///   isEven = rem(i, divisor = 2) == 0
///   return [{ translate = [row * gap, column * gap, 0], replicate = isEven }]
/// }
/// 
/// startSketchOn(XY)
///   |> polygon(numSides = 4, radius = width, center = [0, 0])
///   |> extrude(length = 2)
///   |> rotate(yaw = 45)
///   |> patternTransform(instances = n * n, transform = chessboard)
/// ```
@(impl = std_rust, feature_tree = true)
export fn patternTransform(
  /// The solid(s) to duplicate.
  @solids: [Solid; 1+],
  /// The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect.
  instances: number(Count),
  /// How each replica should be transformed. The transform function takes a single parameter: an integer representing which number replication the transform is for. E.g. the first replica to be transformed will be passed the argument `1`. This simplifies your math: the transform function can rely on id `0` being the original instance passed into the `patternTransform`. See the examples.
  transform: fn(number(Count)): {},
  /// If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid.
  useOriginal?: bool = false,
): [Solid; 1+] {}

/// Repeat a 3-dimensional solid along a linear path, with a dynamic amount
/// of distance between each repetition, some specified number of times.
///
/// ```kcl,legacySketch
/// /// Pattern using a named axis.
///
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> line(end = [0, 2])
///   |> line(end = [3, 1])
///   |> line(end = [0, -4])
///   |> close()
///
/// example = extrude(exampleSketch, length = 1)
///   |> patternLinear3d(
///       axis = X,
///       instances = 7,
///       distance = 6
///     )
/// ```
///
/// ```kcl,legacySketch
/// /// Pattern using a raw axis.
///
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> line(end = [0, 2])
///   |> line(end = [3, 1])
///   |> line(end = [0, -4])
///   |> close()
///
/// example = extrude(exampleSketch, length = 1)
///   |> patternLinear3d(
///       axis = [1, 0, 1],
///       instances = 7,
///       distance = 6
///     )
/// ```
///
/// ```kcl,legacySketch
/// // Pattern a whole sketch on face.
/// size = 100
/// case = startSketchOn(XY)
///     |> startProfile(at = [-size, -size])
///     |> line(end = [2 * size, 0])
///     |> line(end = [0, 2 * size])
///     |> tangentialArc(endAbsolute = [-size, size])
///     |> close(%)
///     |> extrude(length = 65)
///
/// thing1 = startSketchOn(case, face = END)
///     |> circle(center = [-size / 2, -size / 2], radius = 25)
///     |> extrude(length = 50)
///
/// thing2 = startSketchOn(case, face = END)
///     |> circle(center = [size / 2, -size / 2], radius = 25)
///     |> extrude(length = 50)
///
/// // We pass in the "case" here since we want to pattern the whole sketch.
/// // And the case was the base of the sketch.
/// patternLinear3d(case,
///     axis= [1, 0, 0],
///     distance= 250,
///     instances=2,
///  )
/// ```
///
/// ```kcl,legacySketch
/// // Pattern an object on a face.
/// size = 100
/// case = startSketchOn(XY)
///     |> startProfile(at = [-size, -size])
///     |> line(end = [2 * size, 0])
///     |> line(end = [0, 2 * size])
///     |> tangentialArc(endAbsolute = [-size, size])
///     |> close(%)
///     |> extrude(length = 65)
///
/// thing1 = startSketchOn(case, face = END)
///     |> circle(center =[-size / 2, -size / 2], radius = 25)
///     |> extrude(length = 50)
///
/// // We pass in `thing1` here with `useOriginal` since we want to pattern just this object on the face.
/// patternLinear3d(thing1,
///     axis = [1, 0, 0],
///     distance = size,
///     instances =2,
///     useOriginal = true
/// )
/// ```
@(impl = std_rust, feature_tree = true)
export fn patternLinear3d(
  /// The solid(s) to duplicate.
  @solids: [Solid; 1+],
  /// The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect.
  instances: number(Count),
  /// Distance between each repetition. Also known as 'spacing'.
  distance: number(Length),
  /// The axis of the pattern. A 3D vector.
  @(snippetArray = ["1", "0", "0"])
  axis: Axis3d | Point3d,
  /// If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid.
  useOriginal?: bool = false,
): [Solid; 1+] {}

/// Repeat a 3-dimensional solid some number of times along a partial or
/// complete circle some specified number of times. Each object may
/// additionally be rotated along the circle, ensuring orientation of the
/// solid with respect to the center of the circle is maintained.
///
/// ```kcl,legacySketch
/// /// Pattern using a named axis.
///
/// exampleSketch = startSketchOn(XZ)
///   |> circle(center = [0, 0], radius = 1)
///
/// example = extrude(exampleSketch, length = -5)
///   |> patternCircular3d(
///        axis = X,
///        center = [10, -20, 0],
///        instances = 11,
///        arcDegrees = 360,
///        rotateDuplicates = true
///      )
/// ```
///
/// ```kcl,legacySketch
/// /// Pattern using a raw axis.
///
/// exampleSketch = startSketchOn(XZ)
///   |> circle(center = [0, 0], radius = 1)
///
/// example = extrude(exampleSketch, length = -5)
///   |> patternCircular3d(
///        axis = [1, -1, 0],
///        center = [10, -20, 0],
///        instances = 11,
///        arcDegrees = 360,
///        rotateDuplicates = true
///      )
/// ```
@(impl = std_rust, feature_tree = true)
export fn patternCircular3d(
  /// The solid(s) to pattern.
  @solids: [Solid; 1+],
  /// The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect.
  instances: number(Count),
  /// The axis of the pattern. A 3D vector.
  @(snippetArray = ["1", "0", "0"])
  axis: Axis3d | Point3d,
  /// The center about which to make the pattern. This is a 3D vector.
  /// If not given, defaults to `[0, 0, 0]`.
  @(includeInSnippet = true, snippetArray = ["0", "0", "0"])
  center?: Point3d,
  /// "The arc angle to place the repetitions. Must be greater than 0.
  arcDegrees?: number(deg) = 360deg,
  /// Whether or not to rotate the duplicates as they are copied.
  rotateDuplicates?: bool = true,
  /// If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid.
  useOriginal?: bool = false,
): [Solid; 1+] {}

/// Union two or more solids into a single solid.
///
/// ```kcl,legacySketch
/// // Union two cubes using the stdlib functions.
///
/// fn cube(center, size) {
///     return startSketchOn(XY)
///         |> startProfile(at = [center[0] - size, center[1] - size])
///         |> line(endAbsolute = [center[0] + size, center[1] - size])
///         |> line(endAbsolute = [center[0] + size, center[1] + size])
///         |> line(endAbsolute = [center[0] - size, center[1] + size])
///         |> close()
///         |> extrude(length = 10)
/// }
///
/// part001 = cube(center = [0, 0], size = 10)
/// part002 = cube(center = [7, 3], size = 5)
///     |> translate(z = 1)
///
/// unionedPart = union([part001, part002])
/// ```
///
/// ```kcl,legacySketch
/// // Union two cubes using operators.
/// // NOTE: This will not work when using codemods through the UI.
/// // Codemods will generate the stdlib function call instead.
///
/// fn cube(center, size) {
///     return startSketchOn(XY)
///         |> startProfile(at = [center[0] - size, center[1] - size])
///         |> line(endAbsolute = [center[0] + size, center[1] - size])
///         |> line(endAbsolute = [center[0] + size, center[1] + size])
///         |> line(endAbsolute = [center[0] - size, center[1] + size])
///         |> close()
///         |> extrude(length = 10)
/// }
///
/// part001 = cube(center = [0, 0], size = 10)
/// part002 = cube(center = [7, 3], size = 5)
///     |> translate(z = 1)
///
/// // This is the equivalent of: union([part001, part002])
/// unionedPart = part001 + part002
/// ```
///
/// ```kcl,legacySketch
/// // Union two cubes using the more programmer-friendly operator.
/// // NOTE: This will not work when using codemods through the UI.
/// // Codemods will generate the stdlib function call instead.
///
/// fn cube(center, size) {
///     return startSketchOn(XY)
///         |> startProfile(at = [center[0] - size, center[1] - size])
///         |> line(endAbsolute = [center[0] + size, center[1] - size])
///         |> line(endAbsolute = [center[0] + size, center[1] + size])
///         |> line(endAbsolute = [center[0] - size, center[1] + size])
///         |> close()
///         |> extrude(length = 10)
/// }
///
/// part001 = cube(center = [0, 0], size = 10)
/// part002 = cube(center = [7, 3], size = 5)
///     |> translate(z = 1)
///
/// // This is the equivalent of: union([part001, part002])
/// // Programmers will understand `|` as a union operation, but mechanical engineers
/// // will understand `+`, we made both work.
/// unionedPart = part001 | part002
/// ```
@(impl = std_rust, feature_tree = true)
export fn union(
  /// The solids to union.
  @solids: [Solid; 2+],
  /// Defines the smallest distance below which two entities are considered coincident, intersecting, coplanar, or similar. For most use cases, it should not be changed from its default value of 10^-7 millimeters.
  tolerance?: number(Length),
  /// You probably shouldn't set this or care about this, it's for opting back into an older version of an engine algorithm.
  /// If true, revert to older engine SSI algorithm.
  /// Defaults to false.
  legacyMethod?: bool,
): [Solid; 1+] {}

/// Intersect returns the shared volume between multiple solids, preserving only
/// overlapping regions.
///
/// Intersect computes the geometric intersection of multiple solid bodies,
/// returning a new solid representing the volume that is common to all input
/// solids. This operation is useful for determining shared material regions,
/// verifying fit, and analyzing overlapping geometries in assemblies.
///
/// ```kcl,legacySketch
/// // Intersect two cubes using the stdlib functions.
///
/// fn cube(center, size) {
///     return startSketchOn(XY)
///         |> startProfile(at = [center[0] - size, center[1] - size])
///         |> line(endAbsolute = [center[0] + size, center[1] - size])
///         |> line(endAbsolute = [center[0] + size, center[1] + size])
///         |> line(endAbsolute = [center[0] - size, center[1] + size])
///         |> close()
///         |> extrude(length = 10)
/// }
///
/// part001 = cube(center = [0, 0], size = 10)
/// part002 = cube(center = [7, 3], size = 5)
///     |> translate(z = 1)
///
/// intersectedPart = intersect([part001, part002])
/// ```
///
/// ```kcl,legacySketch
/// // Intersect two cubes using operators.
/// // NOTE: This will not work when using codemods through the UI.
/// // Codemods will generate the stdlib function call instead.
///
/// fn cube(center, size) {
///     return startSketchOn(XY)
///         |> startProfile(at = [center[0] - size, center[1] - size])
///         |> line(endAbsolute = [center[0] + size, center[1] - size])
///         |> line(endAbsolute = [center[0] + size, center[1] + size])
///         |> line(endAbsolute = [center[0] - size, center[1] + size])
///         |> close()
///         |> extrude(length = 10)
/// }
///
/// part001 = cube(center = [0, 0], size = 10)
/// part002 = cube(center = [7, 3], size = 5)
///     |> translate(z = 1)
///
/// // This is the equivalent of: intersect([part001, part002])
/// intersectedPart = part001 & part002
/// ```
@(impl = std_rust, feature_tree = true)
export fn intersect(
  /// The solids to intersect.
  @solids: [Solid; 2+],
  /// Defines the smallest distance below which two entities are considered coincident, intersecting, coplanar, or similar. For most use cases, it should not be changed from its default value of 10^-7 millimeters.
  tolerance?: number(Length),
  /// You probably shouldn't set this or care about this, it's for opting back into an older version of an engine algorithm.
  /// If true, revert to older engine SSI algorithm.
  /// Defaults to false.
  legacyMethod?: bool,
): [Solid; 1+] {}

/// Subtract removes tool solids from base solids, leaving the remaining material.
///
/// Performs a bool subtraction operation, removing the volume of one or more
/// tool solids from one or more base solids. The result is a new solid
/// representing the material that remains after all tool solids have been cut
/// away. This function is essential for machining simulations, cavity creation,
/// and complex multi-body part modeling.
///
/// ```kcl,legacySketch
/// // Subtract a cylinder from a cube using the stdlib functions.
///
/// fn cube(center, size) {
///     return startSketchOn(XY)
///         |> startProfile(at = [center[0] - size, center[1] - size])
///         |> line(endAbsolute = [center[0] + size, center[1] - size])
///         |> line(endAbsolute = [center[0] + size, center[1] + size])
///         |> line(endAbsolute = [center[0] - size, center[1] + size])
///         |> close()
///         |> extrude(length = 10)
/// }
///
/// part001 = cube(center = [0, 0], size = 10)
/// part002 = cube(center = [7, 3], size = 5)
///     |> translate(z = 1)
///
/// subtractedPart = subtract([part001], tools=[part002])
/// ```
///
/// ```kcl,legacySketch
/// // Subtract a cylinder from a cube using operators.
/// // NOTE: This will not work when using codemods through the UI.
/// // Codemods will generate the stdlib function call instead.
///
/// fn cube(center, size) {
///     return startSketchOn(XY)
///         |> startProfile(at = [center[0] - size, center[1] - size])
///         |> line(endAbsolute = [center[0] + size, center[1] - size])
///         |> line(endAbsolute = [center[0] + size, center[1] + size])
///         |> line(endAbsolute = [center[0] - size, center[1] + size])
///         |> close()
///         |> extrude(length = 10)
/// }
///
/// part001 = cube(center = [0, 0], size = 10)
/// part002 = cube(center = [7, 3], size = 5)
///     |> translate(z = 1)
///
/// // This is the equivalent of: subtract([part001], tools=[part002])
/// subtractedPart = part001 - part002
/// ```
/// ```kcl,legacySketch
/// @settings(defaultLengthUnit = in)
/// 
/// height = 2.5
/// width = 2.5
/// bodyLength = 6
/// mountCenterToCenter = 1.625
/// rodThreadLength = 0.75
/// strokeLength = 1
/// boreDiameter = 1.5
/// rodDiameter = 0.625
/// portCenterToCenter = 3.875
/// rodThreadSize = 0.438
/// 
/// // Sketch a cube.
/// sketch001 = startSketchOn(YZ)
/// profile001 = startProfile(sketch001, at = [-width / 2, -height / 2])
///   |> angledLine(angle = 0deg, length = width, tag = $rectangleSegmentA001)
///   |> angledLine(angle = segAng(rectangleSegmentA001) + 90deg, length = height, tag = $seg01)
///   |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001), tag = $seg02)
///   |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
///   |> close()
/// blueCube = extrude(profile001, length = -1.5)
/// appearance(blueCube, color = '#9dcfed')
/// 
/// // Sketch a cylinder.
/// sketch002 = startSketchOn(blueCube, face = START)
/// profile002 = circle(sketch002, center = [0, 0], radius = boreDiameter / 2)
/// profile003 = circle(sketch002, center = [0, 0], radius = boreDiameter / 2 + 0.1)
///   |> subtract2d(tool = profile002)
/// cylinder = extrude(profile003, length = 2.375, method = NEW)
/// appearance(cylinder, color = '#9dcfed')
/// 
/// // Sketch a second cube.
/// sketch003 = startSketchOn(cylinder, face = END)
/// profile004 = startProfile(sketch003, at = [-width / 2, -height / 2])
///   |> angledLine(angle = 0deg, length = width, tag = $rectangleSegmentA002)
///   |> angledLine(angle = segAng(rectangleSegmentA002) + 90deg, length = height)
///   |> angledLine(angle = segAng(rectangleSegmentA002), length = -segLen(rectangleSegmentA002))
///   |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
///   |> close()
/// brownCube = extrude(profile004, length = 1.75)
/// |> appearance(color = "#da7333", roughness = 50, metalness = 90)
/// 
/// // Sketch 4 circles.
/// sketch006 = startSketchOn(blueCube, face = END)
/// profile008 = circle(
///   sketch006,
///   center = [
///     mountCenterToCenter / 2,
///     mountCenterToCenter / 2
///   ],
///   diameter = 0.375,
/// )
/// profile009 = circle(
///   sketch006,
///   center = [
///     -mountCenterToCenter / 2,
///     mountCenterToCenter / 2
///   ],
///   diameter = 0.375,
/// )
/// profile010 = circle(
///   sketch006,
///   center = [
///     -mountCenterToCenter / 2,
///     -mountCenterToCenter / 2
///   ],
///   diameter = 0.375,
/// )
/// profile011 = circle(
///   sketch006,
///   center = [
///     mountCenterToCenter / 2,
///     -mountCenterToCenter / 2
///   ],
///   diameter = 0.375,
/// )
///
/// // Extrude the 4 circles into 4 rods.
/// rods = extrude(
///   [
///     profile008,
///     profile009,
///     profile010,
///     profile011
///   ],
///   length = -6,
///   method = NEW,
/// )
/// |> appearance(color = "#ff2222", roughness = 50, metalness = 90)
/// 
/// // Subtract all 4 rods from both cubes.
/// subtract([blueCube, brownCube], tools = rods)
/// ```
@(impl = std_rust, feature_tree = true)
export fn subtract(
  /// The solids to use as the base to subtract from.
  @solids: [Solid; 1+],
  /// The solids to subtract.
  tools: [Solid],
  /// Defines the smallest distance below which two entities are considered coincident, intersecting, coplanar, or similar. For most use cases, it should not be changed from its default value of 10^-7 millimeters.
  tolerance?: number(Length),
  /// You probably shouldn't set this or care about this, it's for opting back into an older version of an engine algorithm.
  /// If true, revert to older engine SSI algorithm.
  /// Defaults to false.
  legacyMethod?: bool,
): [Solid; 1+] {}

/// Set the appearance of a solid. This only works on solids, not sketches or individual paths.
///
/// This will work on any solid, including extruded solids, revolved solids, and shelled solids.
///
/// ```kcl,legacySketch
/// // Add color to an extruded solid.
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> line(endAbsolute = [10, 0])
///   |> line(endAbsolute = [0, 10])
///   |> line(endAbsolute = [-10, 0])
///   |> close()
///
/// example = extrude(exampleSketch, length = 5)
///  // There are other options besides 'color', but they're optional.
///  |> appearance(color='#ff0000')
/// ```
///
/// ```kcl,legacySketch
/// // Add color to a revolved solid.
/// sketch001 = startSketchOn(XY)
///     |> circle( center = [15, 0], radius = 5 )
///     |> revolve( angle = 360deg, axis = Y)
///     |> appearance(
///         color = '#ff0000',
///         metalness = 90,
///         roughness = 90
///     )
/// ```
///
/// ```kcl,legacySketch
/// // Add color to different solids.
/// fn cube(center) {
///    return startSketchOn(XY)
///    |> startProfile(at = [center[0] - 10, center[1] - 10])
///    |> line(endAbsolute = [center[0] + 10, center[1] - 10])
///     |> line(endAbsolute = [center[0] + 10, center[1] + 10])
///     |> line(endAbsolute = [center[0] - 10, center[1] + 10])
///     |> close()
///    |> extrude(length = 10)
/// }
///
/// example0 = cube(center = [0, 0])
/// example1 = cube(center = [20, 0])
/// example2 = cube(center = [40, 0])
///
///  appearance([example0, example1], color='#ff0000', metalness=50, roughness=50)
///  appearance(example2, color='#00ff00', metalness=50, roughness=50)
/// ```
///
/// ```kcl,legacySketch
/// // You can set the appearance before or after you shell it will yield the same result.
/// // This example shows setting the appearance _after_ the shell.
/// firstSketch = startSketchOn(XY)
///     |> startProfile(at = [-12, 12])
///     |> line(end = [24, 0])
///     |> line(end = [0, -24])
///     |> line(end = [-24, 0])
///     |> close()
///     |> extrude(length = 6)
///
/// shell(
///     firstSketch,
///     faces = [END],
///     thickness = 0.25,
/// )
///     |> appearance(
///         color = '#ff0000',
///         metalness = 90,
///         roughness = 90
///     )
/// ```
///
/// ```kcl,legacySketch
/// // You can set the appearance before or after you shell it will yield the same result.
/// // This example shows setting the appearance _before_ the shell.
/// firstSketch = startSketchOn(XY)
///     |> startProfile(at = [-12, 12])
///     |> line(end = [24, 0])
///     |> line(end = [0, -24])
///     |> line(end = [-24, 0])
///     |> close()
///     |> extrude(length = 6)
///     |> appearance(
///         color = '#ff0000',
///         metalness = 90,
///         roughness = 90
///     )
///
/// shell(
///     firstSketch,
///     faces = [END],
///     thickness = 0.25,
/// )
/// ```
///
/// ```kcl,legacySketch
/// // Setting the appearance of a 3D pattern can be done _before_ or _after_ the pattern.
/// // This example shows _before_ the pattern.
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> line(end = [0, 2])
///   |> line(end = [3, 1])
///   |> line(end = [0, -4])
///   |> close()
///
/// example = extrude(exampleSketch, length = 1)
///     |> appearance(
///         color = '#ff0000',
///         metalness = 90,
///         roughness = 90
///        )
///     |> patternLinear3d(
///         axis = [1, 0, 1],
///         instances = 7,
///         distance = 6
///        )
/// ```
///
/// ```kcl,legacySketch
/// // Setting the appearance of a 3D pattern can be done _before_ or _after_ the pattern.
/// // This example shows _after_ the pattern.
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> line(end = [0, 2])
///   |> line(end = [3, 1])
///   |> line(end = [0, -4])
///   |> close()
///
/// example = extrude(exampleSketch, length = 1)
///   |> patternLinear3d(
///       axis = [1, 0, 1],
///       instances = 7,
///       distance = 6
///      )
///   |> appearance(
///       color = '#ff0000',
///       metalness = 90,
///       roughness = 90
///      )
/// ```
///
/// ```kcl,legacySketch
/// // Color the result of a 2D pattern that was extruded.
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [.5, 25])
///   |> line(end = [0, 5])
///   |> line(end = [-1, 0])
///   |> line(end = [0, -5])
///   |> close()
///   |> patternCircular2d(
///        center = [0, 0],
///        instances = 13,
///        arcDegrees = 360,
///        rotateDuplicates = true
///      )
///
/// example = extrude(exampleSketch, length = 1)
///     |> appearance(
///         color = '#ff0000',
///         metalness = 90,
///         roughness = 90
///     )
/// ```
///
/// ```kcl,legacySketch
/// // Color the result of a sweep.
///
/// // Create a path for the sweep.
/// sweepPath = startSketchOn(XZ)
///     |> startProfile(at = [0.05, 0.05])
///     |> line(end = [0, 7])
///     |> tangentialArc(angle = 90deg, radius = 5)
///     |> line(end = [-3, 0])
///     |> tangentialArc(angle = -90deg, radius = 5)
///     |> line(end = [0, 7])
///
/// pipeHole = startSketchOn(XY)
///     |> circle(
///         center = [0, 0],
///         radius = 1.5,
///     )
///
/// sweepSketch = startSketchOn(XY)
///     |> circle(
///         center = [0, 0],
///         radius = 2,
///         )              
///     |> subtract2d(tool = pipeHole)
///     |> sweep(path = sweepPath)
///     |> appearance(
///         color = "#ff0000",
///         metalness = 50,
///         roughness = 50
///     )
/// ```
///
/// ```kcl,sketchSyntaxAgnostic
/// // Change the appearance of an imported model.
///
/// import "tests/inputs/cube.sldprt" as cube
///
/// cube
///    |> appearance(
///        color = "#ff0000",
///        metalness = 50,
///        roughness = 50
///    )
/// ```
@(impl = std_rust, feature_tree = true)
export fn appearance(
  /// The The solid(s) whose appearance is being set.
  @solids: [Solid; 1+] | ImportedGeometry,
  /// Color of the new material, a hex string like '#ff0000'.
  color: string,
  /// Metalness of the new material, a percentage like 95.7.
  metalness?: number(Count),
  /// Roughness of the new material, a percentage like 95.7.
  roughness?: number(Count),
  /// Opacity. Defaults to 100 (totally opaque). 0 would be totally transparent.
  opacity?: number(Count),
): [Solid; 1+] | ImportedGeometry {}

/// Flips the orientation of a surface, swapping which side is the front and which is the reverse.
///
/// ```kcl,legacySketch
/// sideLen = 4
/// 
/// fn square(@plane, offset, y) {
///   at = if y {
///     [-offset, 0]
///   } else {
///     [0, offset]
///   }
///   return startSketchOn(plane)
///     |> startProfile(at)
///     |> if y { yLine(length = sideLen)} else {xLine(length = sideLen)}
///     |> extrude(length = if y {-sideLen} else {sideLen}, bodyType = SURFACE)
/// }
/// 
/// // Make a cube polysurface from 6 squares
/// cube = [
///   square(XY, offset = 0, y = false),
///   square(XZ, offset = 0, y = true) |> flipSurface(),
///   square(YZ, offset = 0, y = false),
///   square(XY, offset = sideLen, y = false),
///   square(XZ, offset = -sideLen, y = true),
///   square(YZ, offset = sideLen, y = false)
/// ]
/// ```
/// ```kcl,legacySketch
/// sideLen = 4
/// 
/// fn square(@plane, offset, y) {
///   at = if y {
///     [-offset, 0]
///   } else {
///     [0, offset]
///   }
///   return startSketchOn(plane)
///     |> startProfile(at)
///     |> if y { yLine(length = sideLen)} else {xLine(length = sideLen)}
///     |> extrude(length = if y {-sideLen} else {sideLen}, bodyType = SURFACE)
/// }
/// 
/// // Make a cube polysurface from 6 squares
/// cube = [
///   square(XY, offset = 0, y = false),
///   square(XZ, offset = 0, y = true) |> flipSurface(),
///   square(YZ, offset = 0, y = false),
///   square(XY, offset = sideLen, y = false),
///   square(XZ, offset = -sideLen, y = true),
///   square(YZ, offset = sideLen, y = false)
/// ]
/// // Flip the cube inside out
/// flipSurface(cube)
/// ```
@(impl = std_rust, feature_tree = true)
export fn flipSurface(
  /// The surfaces to flip (swap the surface's back and front sides)
  @surface: [Solid; 1+],
): [Solid; 1+] {}

/// Split all faces of the target body along all faces of the tool bodies.
///
/// ```kcl,legacySketch
/// sideLen = 4
/// 
/// // Helper function to make a square surface body.
/// fn square(@plane, offset, y) {
///   at = if y {
///     [-offset, 0]
///   } else {
///     [0, offset]
///   }
///   return startSketchOn(plane)
///     |> startProfile(at)
///     |> if y { yLine(length = sideLen)} else {xLine(length = sideLen)}
///     |> extrude(length = if y {-sideLen} else {sideLen}, bodyType = SURFACE)
/// }
/// 
/// // Make a cube polysurface from 6 squares.
/// cube = [
///   square(XY, offset = 0, y = false),
///   square(XZ, offset = 0, y = true) |> flipSurface(),
///   square(YZ, offset = 0, y = false),
///   square(XY, offset = sideLen, y = false),
///   square(XZ, offset = -sideLen, y = true),
///   square(YZ, offset = sideLen, y = false)
/// ]
///
/// // Via split + merge, create a solid cube from the 6 square surfaces (faces of the cube).
/// cubeSolid = split(cube, merge = true)
///
/// // To prove it's solid, we can set the whole cube's appearance.
/// appearance(cubeSolid, color = "#da4333", roughness = 50, metalness = 90)
/// ```
/// ```kcl,legacySketch
/// cube1 = startSketchOn(XY)
/// |> rectangle(width = 3, height = 3, center = [0, 0])
/// |> extrude(length = 2)
/// 
/// cube2 = startSketchOn(offsetPlane(XY, offset = 0.4))
/// |> rectangle(width = 3, height = 3, center = [2, 2])
/// |> extrude(length = 2)
/// 
/// cubes = split([cube1], tools = [cube2], merge = true)
/// |> appearance(color = "#da4333", roughness = 50, metalness = 90, opacity = 80)
/// ```
/// ```kcl,legacySketch
/// goldCube = startSketchOn(XY)
///   |> rectangle(width = 10, height = 10, center = [0, 0])
///   |> extrude(length = 10)
///   |> appearance(color = "#da7333", roughness = 50, metalness = 90)
/// 
/// roseCube = startSketchOn(offsetPlane(XY, offset = 2))
///   |> rectangle(width = 10, height = 10, center = [4, 2])
///   |> extrude(length = 10)
///   |> appearance(color = "#da4333", roughness = 50, metalness = 90)
/// 
/// // Split the gold cube along the edges of rose cube. Keep rose cube in place after.
/// final = split([goldCube], tools = [roseCube], merge = true, keepTools = true)
/// // You can't see it, because the rose cube is covering it, but the gold cube now has
/// // had its faces split along the edges of the rose cube.
/// ```
/// ```kcl,legacySketch
/// goldCube = startSketchOn(XY)
///   |> rectangle(width = 10, height = 10, center = [0, 0])
///   |> extrude(length = 10)
///   |> appearance(color = "#da7333", roughness = 50, metalness = 90)
/// 
/// roseCube = startSketchOn(offsetPlane(XY, offset = 2))
///   |> rectangle(width = 10, height = 10, center = [4, 2])
///   |> extrude(length = 10)
///   |> appearance(color = "#da4333", roughness = 50, metalness = 90)
/// 
/// // Split the gold cube along the edges of rose cube.
/// // Then delete some of the new faces that were created on gold cube.
/// final = split([goldCube], tools = [roseCube], merge = true)
///   |> deleteFace(faceIndices = [6, 8])
/// ```
/// ```kcl,legacySketch
/// // Make a cylinder.
/// sketch001 = startSketchOn(XY)
/// profile001 = circle(
///   sketch001,
///   center = [0, 0],
///   radius = 4.09,
///   tag = $seg01,
/// )
/// cylinder = extrude(profile001, length = 5)
/// 
/// // Make a wedge that splits the cylinder down the middle.
/// sketch002 = startSketchOn(XY)
/// profile002 = startProfile(sketch002, at = [0, -4.75])
///   |> angledLine(angle = 0deg, length = 2, tag = $a)
///   |> angledLine(angle = segAng(a) + 90deg, length = 9.5)
///   |> angledLine(angle = segAng(a), length = -segLen(a))
///   |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
///   |> close()
/// wedge = extrude(profile002, length = 15, symmetric = true)
/// 
/// // Split the cylinder down the wedge.
/// result = split([cylinder], tools = [wedge])
/// 
/// // Color each part of the split cylinder differently,
/// // and move the parts a bit away from each other,
/// // so you can see their interiors.
/// right = appearance(result[2], color = "#B2FFD6")
///   |> translate(x = 4)
///   
/// middle = appearance(result[1], color = "#F6AE2D")
/// 
/// left = appearance(result[0], color = "#AA78A6")
///   |> translate(x = -4)
/// 
/// ```
@(impl = std_rust, feature_tree = true)
export fn split(
  /// The bodies to split
  @targets: [Solid; 1+],
  /// Whether to merge the bodies into one after.
  /// Defaults to false.
  merge?: bool,
  /// If false, the tool bodies will be removed from the scene.
  /// If true, they'll be kept.
  /// Defaults to false.
  keepTools?: bool,
  /// The tools to split the target bodies along.
  tools?: [Solid],
  /// You probably shouldn't set this or care about this, it's for opting back into an older version of an engine algorithm.
  /// If true, revert to older engine SSI algorithm.
  /// Defaults to false.
  legacyMethod?: bool,
): [Solid; 1+] {}


/// Given a KCL value that is a "body" (currently typed as `Solid`), returns `true` if the value is a solid and `false` otherwise. 
///
/// ```kcl,legacySketch
/// fn square(@plane, origin, side, body_type) {
///   return startSketchOn(plane)
///     |> startProfile(at = origin)
///     |> yLine(length = side)
///     |> xLine(length = side)
///     |> yLine(length = -side)
///     |> xLine(length = -side)
///     |> extrude(length = side, bodyType = body_type)
/// }
/// 
/// originX0Y0 = [0, 0]
/// originX10Y0 = [10, 0]
/// 
/// cube = square(
///   XY,
///   origin = originX0Y0,
///   side = 5,
///   body_type = "solid",
/// )
/// openBoxSurface = square(
///   XY,
///   origin = originX10Y0,
///   side = 6,
///   body_type = "surface",
/// )
/// 
/// assertIs(isSolid(cube))
/// assertIs(isSurface(openBoxSurface))
/// 
/// // surface is not a solid
/// assertIs(!isSolid(openBoxSurface))
/// 
/// // solid is not a surface
/// assertIs(!isSurface(cube))
/// ```
@(impl = std_rust, feature_tree = true)
export fn isSolid(
  /// Value to check if it is a solid or not
  @val: Solid,
): bool {}


/// Given a KCL value that is a 'body' (currently typed as `Solid`), returns `true` if the value is a surface and `false` otherwise. 
///
/// ```kcl,legacySketch
/// fn square(@plane, origin, side, body_type) {
///   return startSketchOn(plane)
///     |> startProfile(at = origin)
///     |> yLine(length = side)
///     |> xLine(length = side)
///     |> yLine(length = -side)
///     |> xLine(length = -side)
///     |> extrude(length = side, bodyType = body_type)
/// }
/// 
/// originX0Y0 = [0, 0]
/// originX10Y0 = [10, 0]
/// 
/// cube = square(
///   XY,
///   origin = originX0Y0,
///   side = 5,
///   body_type = "solid",
/// )
/// openBoxSurface = square(
///   XY,
///   origin = originX10Y0,
///   side = 6,
///   body_type = "surface",
/// )
/// 
/// assertIs(isSolid(cube))
/// assertIs(isSurface(openBoxSurface))
/// 
/// // surface is not a solid
/// assertIs(!isSolid(openBoxSurface))
/// 
/// // solid is not a surface
/// assertIs(!isSurface(cube))
/// ```
@(impl = std_rust, feature_tree = true)
export fn isSurface(
  /// Value to check if it is a surface or not
  @val: Solid,
): bool {}

/// Delete a face from a body (a solid, or a polysurface).
/// ```kcl,legacySketch
/// // Make an extruded triangle.
/// startSketchOn(XY)
/// |> startProfile(at = [0, 15])
/// |> xLine(length = 10, tag = $a)
/// |> yLine(length = 8)
/// |> close()
/// |> extrude(length = 2)
/// // Delete some faces.
/// |> deleteFace(faces = [a, END])
/// ```
/// ```kcl,legacySketch
/// // Make an extruded square.
/// startSketchOn(XY)
/// |> polygon(radius = 10, numSides = 4, center = [0, 0])
/// |> extrude(length = 2)
/// // Delete some faces. Because there's no tags, we can delete by face _index_.
/// |> deleteFace(faceIndices = [0, 5])
/// ```
/// ```kcl,legacySketch
/// sideLen = 4
/// 
/// // Helper function to make a square surface body.
/// fn square(@plane, offset, y) {
///   at = if y {
///     [-offset, 0]
///   } else {
///     [0, offset]
///   }
///   return startSketchOn(plane)
///     |> startProfile(at)
///     |> if y { yLine(length = sideLen)} else {xLine(length = sideLen)}
///     |> extrude(length = if y {-sideLen} else {sideLen}, bodyType = SURFACE)
/// }
/// 
/// // Make a cube polysurface from 6 squares.
/// cube = [
///   square(XY, offset = 0, y = false),
///   square(XZ, offset = 0, y = true) |> flipSurface(),
///   square(YZ, offset = 0, y = false),
///   square(XY, offset = sideLen, y = false),
///   square(XZ, offset = -sideLen, y = true),
///   square(YZ, offset = sideLen, y = false)
/// ]
///
/// // Via split + merge, create a solid cube from the 6 square surfaces (faces of the cube).
/// cubeSolid = split(cube, merge = true)
///
/// // We can delete faces using their face index, because there's no tags on this cube.
/// deleteFace(cubeSolid, faceIndices = [0, 1])
/// ```
/// ```kcl,sketchSolve
/// boxProfile = sketch(on = XY) {
///   edge1 = line(start = [var 0mm, var 0mm], end = [var 5mm, var 0mm])
///   edge2 = line(start = [var 5mm, var 0mm], end = [var 5mm, var 5mm])
///   edge3 = line(start = [var 5mm, var 5mm], end = [var 0mm, var 5mm])
///   edge4 = line(start = [var 0mm, var 5mm], end = [var 0mm, var 0mm])
///   coincident([edge1.end, edge2.start])
///   coincident([edge2.end, edge3.start])
///   coincident([edge3.end, edge4.start])
///   coincident([edge4.end, edge1.start])
///   horizontal(edge1)
///   vertical(edge2)
///   horizontal(edge3)
///   vertical(edge4)
/// }
///
/// box = extrude(region(point = [2mm, 2mm], sketch = boxProfile), length = 4mm, tagEnd = $top)
/// openBox = deleteFace(box, faces = [top])
/// ```
@(impl = std_rust, feature_tree = true)
export fn deleteFace(
  /// Target to delete a surface from.
  @body: Solid,
  /// Face to delete. This is the usual face representation, e.g. a tagged face.
  faces?: [TaggedFace; 1+],
  /// Face to delete.
  /// The index is a stable ordering of faces, used when you can't get the
  /// usual ID (UUID) of a face.
  faceIndices?: [number(Count); 1+],
): Solid {}

/// Blend two surfaces together.
/// Use [bounded edges](/docs/kcl-std/types/std-types-BoundedEdge) to control the extents of the newly created surface, or tagged edges to use the full edge span.
/// ```kcl,legacySketch
/// sketch001 = startSketchOn(XY)
/// profile001 = startProfile(sketch001, at = [-2, 0])
///   |> angledLine(angle = 0deg, length = 4, tag = $rectangleSegmentA001)
///   |> extrude(length = 2, bodyType = SURFACE)
///   |> translate(y = 3, z = 2)
/// 
/// sketch002 = startSketchOn(XZ)
/// profile002 = startProfile(sketch002, at = [-1, 0])
///   |> angledLine(angle = 0deg, length = 2, tag = $rectangleSegmentA002)
///   |> extrude(length = 2, bodyType = SURFACE)
///   |> flipSurface()
/// 
/// edge001 = getBoundedEdge(profile001, edge = rectangleSegmentA001, lowerBound = 0.1, upperBound = 0.9)
/// edge002 = getBoundedEdge(profile002, edge = rectangleSegmentA002)
/// 
/// blend([edge001, edge002])
/// ```
///
/// Or blend the full edges directly with tagged edges (no `getBoundedEdge`):
/// ```kcl,legacySketch
/// sketch001 = startSketchOn(XY)
/// profile001 = startProfile(sketch001, at = [-2, 0])
///   |> angledLine(angle = 0deg, length = 4, tag = $rectangleSegmentA001)
///   |> extrude(length = 2, bodyType = SURFACE)
///   |> translate(y = 3, z = 2)
///
/// sketch002 = startSketchOn(XZ)
/// profile002 = startProfile(sketch002, at = [-1, 0])
///   |> angledLine(angle = 0deg, length = 2, tag = $rectangleSegmentA002)
///   |> extrude(length = 2, bodyType = SURFACE)
///   |> flipSurface()
///
/// blend([rectangleSegmentA001, rectangleSegmentA002])
/// ```
///
/// ```kcl,sketchSolve
/// sketch001 = sketch(on = YZ) {
///   line1 = line(start = [var 4.1mm, var -0.1mm], end = [var 5.5mm, var 0mm])
///   line2 = line(start = [var 5.5mm, var 0mm], end = [var 5.5mm, var 3mm])
///   line3 = line(start = [var 5.5mm, var 3mm], end = [var 3.9mm, var 2.8mm])
///   line4 = line(start = [var 4.1mm, var 3mm], end = [var 4.5mm, var -0.2mm])
///   coincident([line1.end, line2.start])
///   coincident([line2.end, line3.start])
///   coincident([line3.end, line4.start])
///   coincident([line4.end, line1.start])
/// }
///
/// sketch002 = sketch(on = -XZ) {
///   line5 = line(start = [var -5.3mm, var -0.1mm], end = [var -3.5mm, var -0.1mm])
///   line6 = line(start = [var -3.5mm, var -0.1mm], end = [var -3.5mm, var 3.1mm])
///   line7 = line(start = [var -3.5mm, var 4.5mm], end = [var -5.4mm, var 4.5mm])
///   line8 = line(start = [var -5.3mm, var 3.1mm], end = [var -5.3mm, var -0.1mm])
///   coincident([line5.end, line6.start])
///   coincident([line6.end, line7.start])
///   coincident([line7.end, line8.start])
///   coincident([line8.end, line5.start])
/// }
///
/// region001 = region(point = [-4.4mm, 2mm], sketch = sketch002)
/// extrude001 = extrude(region001, length = -2mm, bodyType = SURFACE)
/// region002 = region(point = [4.8mm, 1.5mm], sketch = sketch001)
/// extrude002 = extrude(region002, length = -2mm, bodyType = SURFACE)
///
/// myBlend = blend([extrude001.sketch.tags.line7, extrude002.sketch.tags.line3])
/// ```
@(impl = std_rust, feature_tree = true)
export fn blend(
   /// The two edges that will be blended.
   /// Tagged edges blend the full edge length.
   @edges: [BoundedEdge | TaggedEdge; 2],
): Solid {}

/// ```kcl,legacySketch
/// @settings(defaultLengthUnit = mm)
/// 
/// beamSectionWidth = 40
/// beamSectionHeight = 95
/// beamLength = 142
/// beamCurvedRadius = 2000
/// beamCurvedArcLength = beamLength
/// beamBoxCutterInset = 8
/// beamForkCutterGap = 2
/// beamForkCutterTipExtension = beamBoxCutterInset + beamForkCutterGap
/// 
/// beamHalfWidth = beamSectionWidth / 2
/// beamHalfHeight = beamSectionHeight / 2
/// beamCurvedAngle = -(beamCurvedArcLength / beamCurvedRadius): number(rad)
/// beamForkCutterHalfWidth = beamHalfWidth + beamForkCutterGap
/// beamForkCutterHalfHeight = beamHalfHeight + beamForkCutterGap
/// beamForkCutterBackX = beamForkCutterHalfWidth
/// beamForkCutterOpenX = -beamForkCutterHalfWidth - beamForkCutterTipExtension
/// 
/// 
/// beamForkCutterStraightProfile = startSketchOn(XZ)
///   |> startProfile(at = [beamForkCutterOpenX, beamForkCutterHalfHeight])
///   |> line(
///        end = [beamForkCutterBackX - beamForkCutterOpenX, 0],
///        tag = $beamForkCutterTopStraightEdge,
///      )
///   |> line(end = [0, -2 * beamForkCutterHalfHeight], tag = $beamForkCutterBackStraightEdge)
///   |> line(
///        end = [beamForkCutterOpenX - beamForkCutterBackX, 0],
///        tag = $beamForkCutterBottomStraightEdge,
///      )
/// 
/// beamForkCutterStraight = extrude(
///   beamForkCutterStraightProfile,
///   length = beamLength,
///   bodyType = SURFACE,
/// )
/// 
/// beamForkCutterCurvedProfile = startSketchOn(XZ)
///   |> startProfile(at = [beamForkCutterOpenX, beamForkCutterHalfHeight])
///   |> line(
///        end = [beamForkCutterBackX - beamForkCutterOpenX, 0],
///        tag = $beamForkCutterTopCurvedEdge,
///      )
///   |> line(end = [0, -2 * beamForkCutterHalfHeight], tag = $beamForkCutterBackCurvedEdge)
///   |> line(
///        end = [beamForkCutterOpenX - beamForkCutterBackX, 0],
///        tag = $beamForkCutterBottomCurvedEdge,
///      )
/// 
/// curvedBeamAxis = {
///   direction = [0, 1],
///   origin = [beamCurvedRadius, 0]
/// }
/// 
/// beamForkCutterCurved = revolve(
///   beamForkCutterCurvedProfile,
///   axis = curvedBeamAxis,
///   angle = beamCurvedAngle,
///   bodyType = SURFACE,
/// )
/// 
/// beamForkCutterCurvedPlaced = beamForkCutterCurved
///   |> rotate(axis = Z, angle = -22deg, global = true)
///   |> translate(x = 93, y = 453, global = true)
/// 
/// beamForkCutterTopBlend = blend([
///   getBoundedEdge(beamForkCutterCurvedPlaced, edge = getOppositeEdge(beamForkCutterTopCurvedEdge)),
///   beamForkCutterTopStraightEdge,
/// ])
/// 
/// beamForkCutterBackBlend = blend([
///   getBoundedEdge(beamForkCutterCurvedPlaced, edge = getOppositeEdge(beamForkCutterBackCurvedEdge)),
///   beamForkCutterBackStraightEdge,
/// ])
/// 
/// beamForkCutterBottomBlend = blend([
///   getBoundedEdge(beamForkCutterCurvedPlaced, edge = getOppositeEdge(beamForkCutterBottomCurvedEdge)),
///   beamForkCutterBottomStraightEdge,
/// ])
/// 
/// bumperBeamForkCutter = [
///   beamForkCutterTopBlend,
///   beamForkCutterBackBlend,
///   beamForkCutterBottomBlend,
/// ]
/// |> joinSurfaces()
/// ```
/// Join multiple surfaces together into one body, or join together the results of a split into one body
@(impl = std_rust, feature_tree = true)
export fn joinSurfaces(
  /// The bodies to join together
  @selection: [Solid; 1+],
  /// Defines the smallest distance below which two entities are considered coincident, intersecting, coplanar, or similar. For most use cases, it should not be changed from its default value of 10^-7 millimeters.
  tolerance?: number(Length),
): Solid {}