kcl-lib 0.2.147

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
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
/// Sketching is the foundational activity for most KCL programs. A sketch is a two-dimensional
/// drawing made from paths or shapes. A sketch is always drawn on a surface (either an abstract
/// plane of a face of a solid). A sketch can be made into a solid by extruding it (or revolving, etc.).
///
/// This module contains functions for creating and manipulating sketches, and making them into solids.

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

/// Start a new 2-dimensional sketch on a specific plane or face.
///
/// This is part of sketch v1 and is soft deprecated in favor of
/// [sketch-solve](/docs/kcl-std/modules/std-solver).
///
/// ### Sketch on Face Behavior
///
/// There are some important behaviors to understand when sketching on a face:
///
/// The resulting sketch will _include_ the face and thus Solid
/// that was sketched on. So say you were to export the resulting Sketch / Solid
/// from a sketch on a face, you would get both the artifact of the sketch
/// on the face and the parent face / Solid itself.
///
/// This is important to understand because if you were to then sketch on the
/// resulting Solid, it would again include the face and parent Solid that was
/// sketched on. This could go on indefinitely.
///
/// The point is if you want to export the result of a sketch on a face, you
/// only need to export the final Solid that was created from the sketch on the
/// face, since it will include all the parent faces and Solids.
///
/// See [sketch on face](/docs/kcl-lang/sketch-on-face) for more details.
///
/// ### Multiple Profiles
///
/// When creating multiple profiles in a sketch, each profile must be made
/// separately and assigned to a variable. Using one pipeline to create multiple
/// profiles, where one profile is piped into the next, is not currently
/// supported.
///
/// ```kcl,inline,legacySketch
/// // This does NOT work.
/// twoSquares = startSketchOn(XY)
///   |> startProfile(at = [0, 0])
///   |> line(end = [10, 0])
///   |> line(end = [0, 10])
///   |> line(end = [-10, 0])
///   |> close()
///   |> startProfile(at = [20, 0])
///   |> line(end = [10, 0])
///   |> line(end = [0, 10])
///   |> line(end = [-10, 0])
///   |> close()
/// twoCubes = extrude(twoSquares, length = 10)
/// ```
///
/// Instead, use separate pipelines, and extrude an array of them all.
///
/// ```kcl,inline,legacySketch
/// sketch1 = startSketchOn(XY)
/// squareProfile1 = startProfile(sketch1, at = [0, 0])
///   |> line(end = [10, 0])
///   |> line(end = [0, 10])
///   |> line(end = [-10, 0])
///   |> close()
/// squareProfile2 = startProfile(sketch1, at = [20, 0])
///   |> line(end = [10, 0])
///   |> line(end = [0, 10])
///   |> line(end = [-10, 0])
///   |> close()
/// twoCubes = extrude([squareProfile1, squareProfile2], length = 10)
/// ```
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(XY)
///   |> startProfile(at = [0, 0])
///   |> line(end = [10, 0])
///   |> line(end = [0, 10])
///   |> line(end = [-10, 0])
///   |> close()
///
/// example = extrude(exampleSketch, length = 5)
///
/// exampleSketch002 = startSketchOn(example, face = END)
///   |> startProfile(at = [1, 1])
///   |> line(end = [8, 0])
///   |> line(end = [0, 8])
///   |> line(end = [-8, 0])
///   |> close()
///
/// example002 = extrude(exampleSketch002, length = 5)
///
/// exampleSketch003 = startSketchOn(example002, face = END)
///   |> startProfile(at = [2, 2])
///   |> line(end = [6, 0])
///   |> line(end = [0, 6])
///   |> line(end = [-6, 0])
///   |> close()
///
/// example003 = extrude(exampleSketch003, length = 5)
/// ```
///
/// ```kcl,legacySketch
/// // Sketch on the end of an extruded face by tagging the end face.
///
/// exampleSketch = startSketchOn(XY)
///   |> startProfile(at = [0, 0])
///   |> line(end = [10, 0])
///   |> line(end = [0, 10])
///   |> line(end = [-10, 0])
///   |> close()
///
/// example = extrude(exampleSketch, length = 5, tagEnd = $end01)
///
/// exampleSketch002 = startSketchOn(example, face = end01)
///   |> startProfile(at = [1, 1])
///   |> line(end = [8, 0])
///   |> line(end = [0, 8])
///   |> line(end = [-8, 0])
///   |> close()
///
/// example002 = extrude(exampleSketch002, length = 5, tagEnd = $end02)
///
/// exampleSketch003 = startSketchOn(example002, face = end02)
///   |> startProfile(at = [2, 2])
///   |> line(end = [6, 0])
///   |> line(end = [0, 6])
///   |> line(end = [-6, 0])
///   |> close()
///
/// example003 = extrude(exampleSketch003, length = 5)
/// ```
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(XY)
///   |> startProfile(at = [0, 0])
///   |> line(end = [10, 0])
///   |> line(end = [0, 10], tag = $sketchingFace)
///   |> line(end = [-10, 0])
///   |> close()
///
/// example = extrude(exampleSketch, length = 10)
///
/// exampleSketch002 = startSketchOn(example, face = sketchingFace)
///   |> startProfile(at = [1, 1])
///   |> line(end = [8, 0])
///   |> line(end = [0, 8])
///   |> line(end = [-8, 0])
///   |> close(tag = $sketchingFace002)
///
/// example002 = extrude(exampleSketch002, length = 10)
///
/// exampleSketch003 = startSketchOn(example002, face = sketchingFace002)
///   |> startProfile(at = [-8, 12])
///   |> line(end = [0, 6])
///   |> line(end = [6, 0])
///   |> line(end = [0, -6])
///   |> close()
///
/// example003 = extrude(exampleSketch003, length = 5)
/// ```
///
/// ```kcl,legacySketch
/// 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()
///
/// example = revolve(exampleSketch, axis = Y, angle = 180deg)
///
/// exampleSketch002 = startSketchOn(example, face = END)
///   |> startProfile(at = [4.5, -5])
///   |> line(end = [0, 5])
///   |> line(end = [5, 0])
///   |> line(end = [0, -5])
///   |> close()
///
/// example002 = extrude(exampleSketch002, length = 5)
/// ```
///
/// ```kcl,legacySketch
/// // Sketch on the end of a revolved face by tagging the end face.
///
/// 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()
///
/// example = revolve(exampleSketch, axis = Y, angle = 180deg, tagEnd = $end01)
///
/// exampleSketch002 = startSketchOn(example, face = end01)
///   |> startProfile(at = [4.5, -5])
///   |> line(end = [0, 5])
///   |> line(end = [5, 0])
///   |> line(end = [0, -5])
///   |> close()
///
/// example002 = extrude(exampleSketch002, length = 5)
/// ```
///
/// ```kcl,legacySketch
/// a1 = startSketchOn({
///     origin = { x = 0, y = 0, z = 0 },
///     xAxis = { x = 1, y = 0, z = 0 },
///     yAxis = { x = 0, y = 1, z = 0 },
///     zAxis = { x = 0, y = 0, z = 1 }
///   })
///  |> startProfile(at = [0, 0])
///  |> line(end = [100.0, 0])
///  |> yLine(length = -100.0)
///  |> xLine(length = -100.0)
///  |> yLine(length = 100.0)
///  |> close()
///  |> extrude(length = 3.14)
/// ```
///
/// ```kcl,legacySketch
/// sketch001 = startSketchOn(XY)
///   |> startProfile(at = [-5, -5])
///   |> xLine(length = 10)
///   |> yLine(length = 10, tag = $b)
///   |> xLine(length = -10)
///   |> close()
///
/// cube001 = extrude(sketch001, length = 10)
///   |> rotate(roll = 10, pitch = 20, yaw = 30)
///
/// sketch002 = startSketchOn(cube001, normalToFace = END, alignAxis = Y)
///   |> circle(radius = 2, center = [0, 0])
/// cube002 = extrude(sketch002, length = 4)
///
/// subtract(cube001, tools = cube002)
/// ```
///
/// ```kcl,sketchSolve
/// baseProfile = sketch(on = XY) {
///   line1 = line(start = [var 0mm, var 0mm], end = [var 6mm, var 0mm])
///   line2 = line(start = [var 6mm, var 0mm], end = [var 6mm, var 4mm])
///   line3 = line(start = [var 6mm, var 4mm], end = [var 0mm, var 4mm])
///   line4 = line(start = [var 0mm, var 4mm], end = [var 0mm, var 0mm])
///   coincident([line1.end, line2.start])
///   coincident([line2.end, line3.start])
///   coincident([line3.end, line4.start])
///   coincident([line4.end, line1.start])
///   horizontal(line1)
///   vertical(line2)
///   horizontal(line3)
///   vertical(line4)
/// }
///
/// baseRegion = region(point = [3mm, 2mm], sketch = baseProfile)
/// block = extrude(baseRegion, length = 4mm, tagEnd = $top)
///
/// sideSketch = startSketchOn(block, face = top)
///   |> startProfile(at = [0.5mm, 0.5mm])
///   |> line(end = [2mm, 0mm])
///   |> line(end = [0mm, 1mm])
///   |> line(end = [-2mm, 0mm])
///   |> close()
///
/// tower = extrude(sideSketch, length = 1mm)
/// ```
@(impl = std_rust, feature_tree = true)
export fn startSketchOn(
  /// Profile whose start is being used.
  @planeOrSolid: Solid | Plane,
  /// Identify a face of a solid if a solid is specified as the input argument (`planeOrSolid`). Incompatible with `normalToFace`.
  face?: TaggedFace | Segment,
  /// Identify a face of a solid if a solid is specified as the input argument. Starts a sketch on the plane orthogonal to this specified face. Incompatible with `face`, requires `alignAxis`.
  normalToFace?: TaggedFace | Segment,
  /// If sketching normal to face, this axis will be the new local x axis of the sketch plane. The selected face's normal will be the local y axis. Incompatible with `face`, requires `normalToFace`.
  alignAxis?: Axis2d,
  /// Offset the sketch plane along its normal by the given amount. Incompatible with `face`, requires `normalToFace`.
  normalOffset?: number(Length),
): Plane | Face {}

/// Start a new profile at a given point.
///
/// This is part of sketch v1 and is soft deprecated in favor of
/// [sketch-solve](/docs/kcl-std/modules/std-solver).
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> line(end = [10, 0])
///   |> line(end = [0, 10])
///   |> line(end = [-10, 0])
///   |> close()
///
/// example = extrude(exampleSketch, length = 5)
/// ```
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(-XZ)
///   |> startProfile(at = [10, 10])
///   |> line(end = [10, 0])
///   |> line(end = [0, 10])
///   |> line(end = [-10, 0])
///   |> close()
///
/// example = extrude(exampleSketch, length = 5)
/// ```
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(-XZ)
///   |> startProfile(at = [-10, 23])
///   |> line(end = [10, 0])
///   |> line(end = [0, 10])
///   |> line(end = [-10, 0])
///   |> close()
///
/// example = extrude(exampleSketch, length = 5)
/// ```
///
/// ```kcl,legacySketch
/// // Create a sketch plane.
/// mySketch = startSketchOn(XY)
///
/// // Start a profile on the sketch plane.
/// squareProfile1 = startProfile(mySketch, at = [0, 0])
///   |> line(end = [10, 0])
///   |> line(end = [0, 10])
///   |> line(end = [-10, 0])
///   |> close()
///
/// // Start another profile on the same sketch plane.
/// squareProfile2 = startProfile(mySketch, at = [20, 0])
///   |> line(end = [10, 0])
///   |> line(end = [0, 10])
///   |> line(end = [-10, 0])
///   |> close()
/// ```
@(impl = std_rust, feature_tree = false)
export fn startProfile(
  /// What to start the profile on.
  @startProfileOn: Plane | Face,
  /// Where to start the profile. An absolute point.
  @(snippetArray = ["0", "0"])
  at: Point2d,
  /// Tag this first starting point.
  tag?: TagDecl,
): Sketch {}

/// Sketch a rectangle.
///
/// This is part of sketch v1 and is soft deprecated in favor of
/// [sketch-solve](/docs/kcl-std/modules/std-solver).
///
/// A rectangle can be defined by its width, height, and location. Either the center or corner must be provided, but not both, to specify its location.
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(-XZ)
///   |> rectangle(center = [0, 0], width = 10, height = 5)
//    |> extrude(length = 2)
/// ```
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(-XZ)
///   |> rectangle(corner = [0, 0], width = 10, height = 5)
//    |> extrude(length = 2)
/// ```
@(impl = std_rust, feature_tree = false)
export fn rectangle(
  /// Sketch to extend, or plane or surface to sketch on.
  @sketchOrSurface: Sketch | Plane | Face,
  /// Rectangle's width along X axis.
  width: number(Length),
  /// Rectangle's height along Y axis.
  height: number(Length),
  /// The center of the rectangle.
  /// Either `corner` or `center` is required, but not both.
  @(snippetArray = ["0", "0"])
  center?: Point2d,
  /// The corner of the rectangle.
  /// Either `corner` or `center` is required, but not both.
  /// This will be the corner which is most negative on both X and Y axes.
  @(snippetArray = ["0", "0"])
  corner?: Point2d,
): Sketch {}

/// Construct a 2-dimensional circle, of the specified radius, centered at
/// the provided (x, y) origin point.
///
/// This is part of sketch v1 and is soft deprecated in favor of
/// [sketch-solve](/docs/kcl-std/modules/std-solver).
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(-XZ)
///   |> circle(center = [0, 0], radius = 10)
///
/// example = extrude(exampleSketch, length = 5)
/// ```
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [-15, 0])
///   |> line(end = [30, 0])
///   |> line(end = [0, 30])
///   |> line(end = [-30, 0])
///   |> close()
///   |> subtract2d(tool = circle(center = [0, 15], diameter = 10))
///
/// example = extrude(exampleSketch, length = 5)
/// ```
@(impl = std_rust, feature_tree = false)
export fn circle(
  /// Sketch to extend, or plane or surface to sketch on.
  @sketchOrSurface: Sketch | Plane | Face,
  /// The center of the circle.
  /// If not given, defaults to `[0, 0]`.
  @(includeInSnippet = true, snippetArray = ["0", "0"])
  center?: Point2d,
  /// The radius of the circle. Incompatible with `diameter`.
  radius?: number(Length),
  /// The diameter of the circle. Incompatible with `radius`.
  @(includeInSnippet = true)
  diameter?: number(Length),
  /// Create a new tag which refers to this circle.
  tag?: TagDecl,
): Sketch {}

/// Construct a 2-dimensional ellipse, of the specified major/minor radius, centered at the provided (x, y) point.
///
/// This is part of sketch v1 and is soft deprecated in favor of
/// [sketch-solve](/docs/kcl-std/modules/std-solver). The sketch-solve version
/// of ellipse is still under development.
///
/// ```kcl,legacySketch
/// @settings(experimentalFeatures = allow)
///
/// exampleSketch = startSketchOn(XY)
///   |> ellipse(center = [0, 0], majorRadius = 50, minorRadius = 20)
/// ```
@(impl = std_rust, experimental = true, feature_tree = true)
export fn ellipse(
  /// Sketch to extend, or plane or surface to sketch on.
  @sketchOrSurface: Sketch | Plane | Face,
  /// The minor radius of the ellipse.
  minorRadius: number(Length),
  /// The center of the ellipse.
  /// If not given, defaults to `[0, 0]`.
  @(includeInSnippet = true, snippetArray = ["0", "0"])
  center?: Point2d,
  /// The major radius of the ellipse. Equivalent to majorAxis = [majorRadius, 0].
  majorRadius?: number(Length),
  /// The major axis of the ellipse.
  majorAxis?: Point2d,
  /// Create a new tag which refers to this ellipse.
  tag?: TagDecl,
): Sketch {}

/// Extend a 2-dimensional sketch or individual segment of a sketch through
/// a third dimension to create a new 3-dimensional volume or surface, or if
/// extruded into an existing volume, cut into an existing solid.
///
/// You can provide more than one sketch to extrude, and they will all be
/// extruded in the same direction.
///
/// When you sketch on a face of a solid, extruding extends or cuts into the
/// existing solid, meaning you don't need to union or subtract the volumes. You
/// can change this behavior by using the `method` parameter. See
/// [sketch on face](/docs/kcl-lang/sketch-on-face) for more details.
///
/// ```kcl,legacySketch
/// example = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> line(end = [10, 0])
///   |> arc(
///     angleStart = 120deg,
///     angleEnd = 0,
///     radius = 5,
///   )
///   |> line(end = [5, 0])
///   |> line(end = [0, 10])
///   |> bezierCurve(
///        control1 = [-10, 0],
///        control2 = [2, 10],
///        end = [-5, 10],
///      )
///   |> line(end = [-5, -2])
///   |> close()
///   |> extrude(length = 10)
/// ```
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [-10, 0])
///   |> arc(
///     angleStart = 120deg,
///     angleEnd = -60deg,
///     radius = 5,
///   )
///   |> line(end = [10, 0])
///   |> line(end = [5, 0])
///   |> bezierCurve(
///        control1 = [-3, 0],
///        control2 = [2, 10],
///        end = [-5, 10],
///      )
///   |> line(end = [-4, 10])
///   |> line(end = [-5, -2])
///   |> close()
///
/// example = extrude(exampleSketch, length = 10)
/// ```
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [-10, 0])
///   |> arc(
///     angleStart = 120deg,
///     angleEnd = -60deg,
///     radius = 5,
///   )
///   |> line(end = [10, 0])
///   |> line(end = [5, 0])
///   |> bezierCurve(
///        control1 = [-3, 0],
///        control2 = [2, 10],
///        end = [-5, 10],
///      )
///   |> line(end = [-4, 10])
///   |> line(end = [-5, -2])
///   |> close()
///
/// example = extrude(exampleSketch, length = 20, symmetric = true)
/// ```
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [-10, 0])
///   |> arc(
///     angleStart = 120deg,
///     angleEnd = -60deg,
///     radius = 5,
///   )
///   |> line(end = [10, 0])
///   |> line(end = [5, 0])
///   |> bezierCurve(
///        control1 = [-3, 0],
///        control2 = [2, 10],
///        end = [-5, 10],
///      )
///   |> line(end = [-4, 10])
///   |> line(end = [-5, -2])
///   |> close()
///
/// example = extrude(exampleSketch, length = 10, bidirectionalLength = 50)
/// ```
/// ```kcl,legacySketch
/// example = startSketchOn(XZ)
///   |> polygon(radius = 10, numSides = 3, center = [0, 0])
///   |> extrude(length = 10, twistAngle = 120deg)
/// ```
/// ```kcl,legacySketch
/// // Sketch a square in the corner of the scene.
/// startSketchOn(XY)
///   |> startProfile(at = [0, 0])
///   |> polygon(radius = 1, numSides = 10, center = [4, 4])
/// // Because the twist defaults to the plane's center, this makes a spiral shape.
///   |> extrude(length = 10, twistAngle = 360deg)
/// ```
/// ```kcl,legacySketch
/// sketch001 = startSketchOn(XY)
/// profile001 = startProfile(sketch001, at = [0, 0])
///   |> yLine(length = 1)
///   |> xLine(length = 1)
///   |> yLine(length = -1)
///   |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
///   |> close()
/// cube = extrude(profile001, length = 1)
///
/// sketch002 = startSketchOn(cube, face = END)
/// profile002 = circle(sketch002, center = [0.38, 0.64], radius = 0.13)
/// // When sketching on a face, we can make a new solid instead of merging with
/// // it by using the method parameter.
/// cylinder = extrude(profile002, length = 2, method = NEW)
///
/// // The cylinder is a separate solid that can be translated separately from
/// // the cube.
/// translate(cylinder, x = 1)
/// ```
///
/// ```kcl,legacySketch
/// // You could also use the 'to' parameter if you want extrusions
/// // to end at a reference point, axis, scene geometry, tagged geometry, or plane.
///
///
/// sketch001 = startSketchOn(XY)
/// profile001 = startProfile(sketch001, at = [2, 2])
///   |> yLine(length = 1)
///   |> xLine(length = 1)
///   |> yLine(length = -1, tag = $facetag0)
///   |> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $facetag1)
///   |> close()
/// cube = extrude(profile001, length = 1)
///
/// // extrude a circle to a point reference (red cylinder)
/// sketch002 = startSketchOn(XZ)
/// cylinder0 = circle(sketch002, center = [0.5, 0.5], radius = 0.25)
///   |> extrude(to = [-2, -3, -4])
///   |> appearance(color='#FF0000')
///
/// // extrude a circle to an axis reference (green cylinder)
/// sketch003 = startSketchOn(offsetPlane(XY, offset = -2))
/// cylinder1 = circle(sketch003, center = [0.5, 0.5], radius = 0.25)
///   |> extrude(to = Y)
///   |> appearance(color ='#00FF00')
///
/// // extrude a circle to a solid reference (blue cylinder)
/// sketch004 = startSketchOn(offsetPlane(YZ, offset = -1))
/// cylinder2 = circle(sketch004, center = [0.5, 0.5], radius = 0.25)
///   |> extrude(to = cube)
///   |> appearance(color ='#0000FF')
///
/// // extrude a circle to a tagged edge (cyan cylinder)
/// sketch005 = startSketchOn(offsetPlane(YZ, offset = 4))
/// cylinder3 = circle(sketch005, center = [0.5, 0.5], radius = 0.25)
///   |> extrude(to = getCommonEdge(faces = [facetag0, facetag1]))
///   |> appearance(color = '#00FFFF')
///
/// // extrude a circle to a plane (magenta cylinder)
/// sketch006 = startSketchOn(cube, face = facetag1)
/// cylinder4 = circle(sketch006, center = [2.5, 0.5], radius = 0.25)
///   |> extrude(to = XZ, method = NEW)
///   |> appearance(color ='#FF00FF')
/// ```
/// ```kcl,legacySketch
/// // Surface extrude of an open profile
/// openProfile = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> line(end = [4, 0])
///   |> arc(angleStart = 120deg, angleEnd = 0, radius = 5)
///   |> line(end = [5, 0])
///   |> line(end = [0, 10])
/// // Surface extrude
/// extrude(openProfile, length = 2, bodyType = SURFACE)
/// ```
/// ```kcl,legacySketch
/// // Extrude a face from an extruded object
/// sketch001 = startSketchOn(XY)
/// profile001 = startProfile(sketch001, at = [-5, 0])
///   |> xLine(length=1)
///   |> yLine(length = -1)
///   |> line(end = [-1, -1], tag = $seg01)
///   |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
///   |> close()
///   |> extrude(length = 5)
/// extrude(seg01, length = 2, method = MERGE, hideSeams=false) // if hideSeams=true, the seam still shows because the edges of the coplanar faces are not colinear
///   |> appearance(color = "#ff0000")
///
/// // Extrude a face from an extruded object to create a new object
/// sketch002 = startSketchOn(XY)
/// profile002 = startProfile(sketch002, at = [-1, 0])
///   |> yLine(length = -1.0)
///   |> xLine(length = 1.0, tag = $seg02)
///   |> yLine(length = 1.0)
///   |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
///   |> close()
///   |> extrude(length = 5)
/// extrude(seg02, length=2, method = NEW, hideSeams=false) // if hideSeams=true, the seam still shows because the resulting extrusion is a separate object
///   |> appearance(color = "#00ff00")
///
/// // Extrude a face from an extruded object and merge the result
/// sketch003 = startSketchOn(XY)
/// profile003 = startProfile(sketch003, at = [1, 0])
///   |> yLine(length = -1.0)
///   |> xLine(length = 1.0, tag = $seg03)
///   |> yLine(length = 1.0)
///   |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
///   |> close()
///   |> extrude(length = 5)
/// extrude(seg03, length=2, method = MERGE, hideSeams=true)
///   |> appearance(color = "#0000ff")
/// ```
/// ```kcl,legacySketch
/// // Create a yellow extruded triangle.
/// sketch001 = startSketchOn(XY)
/// profile001 = startProfile(sketch001, at = [0, 0])
///   |> yLine(length = 1, tag = $a)
///   |> xLine(length = 1, tag = $b)
///   |> close(tag = $c)
/// cube = extrude(profile001, length = 1)
/// |> appearance(color = "#ffaa00")
///
/// // Extrude a red box from one of the triangle's side faces.
/// box = extrude(
///        c,
///        length = 4,
///        hideSeams = false,
///        method = NEW,
///      )
///   |> appearance(color = "#ff0000")
/// ```
/// ```kcl,legacySketch
/// // You can even extrude faces from sweeps!
/// // In this example, the sweep is blue,
/// // and the extrusion from its end face is yellow
/// sketch001 = startSketchOn(XY)
/// profile001 = startProfile(sketch001, at = [-1.0, 1.0])
///   |> yLine(length = -2.0)
///   |> xLine(length = 2.0)
///   |> yLine(length = 2.0)
///   |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
///   |> close()
/// sketch003 = startSketchOn(XZ)
/// profile002 = startProfile(sketch003, at = [0, 0])
///   |> yLine(length = 2.0)
///   |> tangentialArc(end = [-2.0, 2.0])
///   |> xLine(length = -2.0)
///   |> tangentialArc(end = [-2, 2.0])
///   |> yLine(length = 2)
/// sweep001 = sweep(profile001, path = profile002, tagEnd = $endSweep)
/// |> appearance(color = "#0000FF")
/// extrude(endSweep, length = 2, method = NEW)
/// |> appearance(color = "#FFFF00")
/// ```
/// ```kcl,legacySketch
/// // Surface extrude of a closed profile
/// closedProfile = startSketchOn(XY)
///   |> startProfile(at = [0, 0])
///   |> circle(center = [0, 0], diameter = 10)
/// // Surface extrude
/// extrude(closedProfile, length = 5, bodyType = SURFACE)
/// ```
/// ```kcl,sketchSolve
/// profile = 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 3mm])
///   edge3 = line(start = [var 5mm, var 3mm], end = [var 0mm, var 3mm])
///   edge4 = line(start = [var 0mm, var 3mm], 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)
/// }
///
/// solid = extrude(region(point = [2mm, 1mm], sketch = profile), length = 5)
/// ```
/// ```kcl,sketchSolve
/// // Sketch some disconnected lines in a sketch block.
/// originalSketch = sketch(on = YZ) {
///   line1 = line(start = [var -5.33mm, var 3.69mm], end = [var -5.93mm, var -2.59mm])
///   line2 = line(start = [var -0.9mm, var 0.63mm], end = [var 4.01mm, var 0.68mm])
/// }
///
/// // Surface extrudes of sketch blocks let you extrude any lines.
/// extrude([originalSketch.line1, originalSketch.line2], length = 1, bodyType = SURFACE)
///
/// // Surface extrudes of sketch blocks are non-destructive: they leave the original sketch
/// // in place. So we can add another extrude of the same lines, in a different direction.
/// extrude([originalSketch.line1, originalSketch.line2], length = -1, bodyType = SURFACE)
/// ```
@(impl = std_rust, feature_tree = true)
export fn extrude(
  /// Which sketch or sketches should be extruded.
  @sketches: [Sketch | Face | TaggedFace | Segment; 1+],
  /// How far to extrude the given sketches. Incompatible with `to`.
  length?: number(Length),
  /// Reference to extrude to. Incompatible with `length` and `twistAngle`.
  to?: Point3d | Axis3d | Plane | Edge | Face | Sketch | Solid | TaggedEdge | TaggedFace,
  /// If true, the extrusion will happen symmetrically around the sketch. Otherwise, the extrusion will happen on only one side of the sketch.
  symmetric?: bool,
  /// If specified, will also extrude in the opposite direction to 'distance' to the specified distance. If 'symmetric' is true, this value is ignored.
  bidirectionalLength?: number(Length),
  /// A named tag for the face at the start of the extrusion, i.e. the original sketch.
  tagStart?: TagDecl,
  /// A named tag for the face at the end of the extrusion, i.e. the new face created by extruding the original sketch.
  tagEnd?: TagDecl,
  /// If given, the sketch will be twisted around this angle while being extruded. Incompatible with `to`.
  twistAngle?: number(Angle),
  /// The size of each intermediate angle as the sketch twists around.
  /// Must be between 4 and 90 degrees.
  /// Only used if `twistAngle` is given, defaults to 15 degrees.
  twistAngleStep?: number(Angle),
  /// The center around which the sketch will be twisted. Relative to the plane's origin.
  /// Only used if `twistAngle` is given, defaults to [0, 0] i.e. plane origin.
  @(snippetArray = ["0", "0"])
  twistCenter?: Point2d,
  /// The method used during extrusion, either `NEW` or `MERGE`. `NEW` creates a new object. `MERGE` merges the extruded objects together. The default is `MERGE`.
  method?: string,
  /// Whether or not to hide the seams between the original and resulting object.
  /// Only used if a face is extruded and method = MERGE
  hideSeams?: bool,
  /// What type of body to produce (solid or surface).
  /// Defaults to "solid".
  bodyType?: string = "solid",
): [Solid; 1+] {}

/// Rotate a sketch around some provided axis, creating a solid from its extent.
///
/// This, like extrude, is able to create a 3-dimensional solid from a
/// 2-dimensional sketch. However, unlike extrude, this creates a solid
/// by using the extent of the sketch as its revolved around an axis rather
/// than using the extent of the sketch linearly translated through a third
/// dimension.
///
/// Revolve occurs around a local sketch axis rather than a global axis.
///
/// You can provide more than one sketch to revolve, and they will all be
/// revolved around the same axis.
///
/// ```kcl,legacySketch
/// part001 = 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()
///     |> revolve(axis = Y) // default angle is 360deg
/// ```
///
/// ```kcl,legacySketch
/// // A donut shape.
/// sketch001 = startSketchOn(XY)
///     |> circle( center = [15, 0], radius = 5 )
///     |> revolve(
///         angle = 360deg,
///         axis = Y,
///     )
/// ```
///
/// ```kcl,legacySketch
/// part001 = 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()
///     |> revolve(axis = Y, angle = 180deg)
/// ```
///
/// ```kcl,legacySketch
/// part001 = 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()
///     |> revolve(axis = Y, angle = 180deg)
///
/// part002 = startSketchOn(part001, face = END)
///     |> startProfile(at = [4.5, -5])
///     |> line(end = [0, 5])
///     |> line(end = [5, 0])
///     |> line(end = [0, -5])
///     |> close()
///     |> extrude(length = 5)
/// ```
///
/// ```kcl,legacySketch
/// box = startSketchOn(XY)
///     |> startProfile(at = [0, 0])
///     |> line(end = [0, 20])
///     |> line(end = [20, 0])
///     |> line(end = [0, -20])
///     |> close()
///     |> extrude(length = 20)
///
/// sketch001 = startSketchOn(box, face = END)
///     |> circle( center = [10,10], radius = 4 )
///     |> revolve(
///         angle = -90deg,
///         axis = Y
///     )
/// ```
///
/// ```kcl,legacySketch
/// box = startSketchOn(XY)
///     |> startProfile(at = [0, 0])
///     |> line(end = [0, 20])
///     |> line(end = [20, 0])
///     |> line(end = [0, -20], tag = $revolveAxis)
///     |> close()
///     |> extrude(length = 20)
///
/// sketch001 = startSketchOn(box, face = END)
///     |> circle( center = [10,10], radius = 4 )
///     |> revolve(
///         angle = 90deg,
///         axis = getOppositeEdge(revolveAxis)
///     )
/// ```
///
/// ```kcl,legacySketch
/// box = startSketchOn(XY)
///     |> startProfile(at = [0, 0])
///     |> line(end = [0, 20])
///     |> line(end = [20, 0])
///     |> line(end = [0, -20], tag = $revolveAxis)
///     |> close()
///     |> extrude(length = 20)
///
/// sketch001 = startSketchOn(box, face = END)
///     |> circle( center = [10,10], radius = 4 )
///     |> revolve(
///         angle = 90deg,
///         axis = getOppositeEdge(revolveAxis),
///         tolerance = 0.0001
///     )
/// ```
///
/// ```kcl,legacySketch
/// sketch001 = startSketchOn(XY)
///   |> startProfile(at = [10, 0])
///   |> line(end = [5, -5])
///   |> line(end = [5, 5])
///   |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
///   |> close()
///
/// part001 = revolve(
///    sketch001,
///    axis = {
///      direction = [0.0, 1.0],
///      origin = [0.0, 0.0]
///   }
/// )
/// ```
///
/// ```kcl,legacySketch
/// // Revolve two sketches around the same axis.
///
/// sketch001 = startSketchOn(XY)
/// profile001 = startProfile(sketch001, at = [4, 8])
///     |> xLine(length = 3)
///     |> yLine(length = -3)
///     |> xLine(length = -3)
///     |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
///     |> close()
///
/// profile002 = startProfile(sketch001, at = [-5, 8])
///     |> xLine(length = 3)
///     |> yLine(length = -3)
///     |> xLine(length = -3)
///     |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
///     |> close()
///
/// revolve(
///     [profile001, profile002],
///     axis = X,
/// )
/// ```
///
/// ```kcl,legacySketch
/// // Revolve around a path that has not been extruded.
///
/// profile001 = startSketchOn(XY)
///     |> startProfile(at = [0, 0])
///     |> line(end = [0, 20], tag = $revolveAxis)
///     |> line(end = [20, 0])
///     |> line(end = [0, -20])
///     |> close(%)
///
/// sketch001 = startSketchOn(XY)
///     |> circle(center = [-10, 10], radius = 4)
///     |> revolve(angle = 90deg, axis = revolveAxis)
/// ```
///
/// ```kcl,legacySketch
/// // Revolve around a path that has not been extruded or closed.
///
/// profile001 = startSketchOn(XY)
///     |> startProfile(at = [0, 0])
///     |> line(end = [0, 20], tag = $revolveAxis)
///     |> line(end = [20, 0])
///
/// sketch001 = startSketchOn(XY)
///     |> circle(center = [-10, 10], radius = 4)
///     |> revolve(angle = 90deg, axis = revolveAxis)
/// ```
///
/// ```kcl,legacySketch
/// // Symmetrically revolve around a path.
///
/// profile001 = startSketchOn(XY)
///     |> startProfile(at = [0, 0])
///     |> line(end = [0, 20], tag = $revolveAxis)
///     |> line(end = [20, 0])
///
/// sketch001 = startSketchOn(XY)
///     |> circle(center = [-10, 10], radius = 4)
///     |> revolve(angle = 90deg, axis = revolveAxis, symmetric = true)
/// ```
///
/// ```kcl,legacySketch
/// // Bidirectional revolve around a path.
///
/// profile001 = startSketchOn(XY)
///     |> startProfile(at = [0, 0])
///     |> line(end = [0, 20], tag = $revolveAxis)
///     |> line(end = [20, 0])
///
/// sketch001 = startSketchOn(XY)
///     |> circle(center = [-10, 10], radius = 4)
///     |> revolve(angle = 90deg, axis = revolveAxis, bidirectionalAngle = 50)
/// ```
/// ```kcl,sketchSolve
/// shellProfile = sketch(on = XY) {
///   outerWall = line(start = [var 10mm, var 0mm], end = [var 10mm, var 5mm])
///   connector = line(start = [var 10mm, var 5mm], end = [var 12mm, var 7mm])
///   innerWall = line(start = [var 12mm, var 7mm], end = [var 15mm, var 6mm])
///   coincident([outerWall.end, connector.start])
///   coincident([connector.end, innerWall.start])
/// }
///
/// halfShell = revolve([shellProfile.outerWall, shellProfile.innerWall], axis = Y, bodyType = SURFACE, angle = 180deg)
/// closedShell = revolve([shellProfile.outerWall, shellProfile.innerWall], axis = Y, bodyType = SURFACE)
///     |> translate(z = 30)
/// ```
///
/// ```kcl,sketchSolve
/// ringProfile = sketch(on = XZ) {
///   edge1 = line(start = [var 4mm, var 0mm], end = [var 7mm, var 0mm])
///   edge2 = line(start = [var 7mm, var 0mm], end = [var 7mm, var 4mm])
///   edge3 = line(start = [var 7mm, var 4mm], end = [var 4mm, var 4mm])
///   edge4 = line(start = [var 4mm, var 4mm], end = [var 4mm, var 0mm])
///   coincident([edge1.end, edge2.start])
///   coincident([edge2.end, edge3.start])
///   coincident([edge3.end, edge4.start])
///   coincident([edge4.end, edge1.start])
/// }
///
/// ringRegion = region(point = [5mm, 2mm], sketch = ringProfile)
/// ring = revolve(ringRegion, axis = Y)
/// ```
/// ```kcl,sketchSolve
/// // Sketch some disconnected lines in a sketch block.
/// originalSketch = sketch(on = YZ) {
///   line1 = line(start = [var -5.33mm, var 3.69mm], end = [var -5.93mm, var -2.59mm])
///   line2 = line(start = [var -0.9mm, var 0.63mm], end = [var 4.01mm, var 0.68mm])
/// }
///
/// // Revolve just one line in the sketch.
/// revolve([originalSketch.line1], axis = Y, angle = 180deg, bodyType = SURFACE)
/// // Surface revolves of sketch blocks are non-destructive, so you can keep revolving
/// // the same line again.
/// revolve([originalSketch.line1], axis = Y, angle = -90deg, bodyType = SURFACE)
/// ```
/// ```kcl,sketchSolve
/// // Use a solved constraint line as the axis of a revolve.
/// sketch001 = sketch(on = XZ) {
///   line1 = line(start = [var -3.34mm, var -1.89mm], end = [var -1.62mm, var -1.89mm])
///   line2 = line(start = [var -1.62mm, var -1.89mm], end = [var -1.62mm, var 0.56mm])
///   line3 = line(start = [var -1.62mm, var 0.56mm], end = [var -3.34mm, var 0.56mm])
///   line4 = line(start = [var -3.34mm, var 0.56mm], end = [var -3.34mm, var -1.89mm])
///   coincident([line1.end, line2.start])
///   coincident([line2.end, line3.start])
///   coincident([line3.end, line4.start])
///   coincident([line4.end, line1.start])
///   parallel([line2, line4])
///   parallel([line3, line1])
///   perpendicular([line1, line2])
///   horizontal(line3)
///   line5 = line(start = [var 0.94mm, var -3.66mm], end = [var 0.05mm, var 4.57mm])
/// }
/// region001 = region(point = [-2.48mm, -1.8875mm], sketch = sketch001)
/// revolve001 = revolve(region001, angle = 36deg, axis = sketch001.line5)
/// ```
@(impl = std_rust, feature_tree = true)
export fn revolve(
  /// The sketch or set of sketches that should be revolved, or solved sketch segments for a surface revolve.
  @sketches: [Sketch | Segment; 1+],
  /// Axis of revolution.
  axis: Axis2d | Edge | Segment,
  /// Angle to revolve (in degrees). Default is 360.
  angle?: number(Angle),
  /// 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),
  /// If true, the extrusion will happen symmetrically around the sketch. Otherwise, the extrusion will happen on only one side of the sketch.
  symmetric?: bool,
  /// If specified, will also revolve in the opposite direction to 'angle' to the specified angle. If 'symmetric' is true, this value is ignored.
  bidirectionalAngle?: number(Angle),
  /// A named tag for the face at the start of the revolve, i.e. the original sketch.
  tagStart?: TagDecl,
  /// A named tag for the face at the end of the revolve.
  tagEnd?: TagDecl,
  /// What type of body to produce (solid or surface).
  /// Defaults to "solid".
  bodyType?: string = "solid",
): [Solid; 1+] {}

/// Just like `patternTransform`, but works on 2D sketches not 3D solids.
///
/// ```kcl,legacySketch
/// // Each instance will be shifted along the X axis.
/// fn transform(@id) {
///   return { translate = [4 * id, 0] }
/// }
///
/// // Sketch 4 circles.
/// sketch001 = startSketchOn(XZ)
///   |> circle(center = [0, 0], radius = 2)
///   |> patternTransform2d(instances = 4, transform = transform)
/// ```
@(impl = std_rust, feature_tree = false)
export fn patternTransform2d(
  /// The sketch(es) to duplicate.
  @sketches: [Sketch; 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?: boolean = false,
): [Sketch; 1+] {}

/// Get the opposite edge to the edge given.
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> line(end = [10, 0])
///   |> angledLine(
///        angle = 60deg,
///        length = 10,
///      )
///   |> angledLine(
///        angle = 120deg,
///        length = 10,
///      )
///   |> line(end = [-10, 0])
///   |> angledLine(
///        angle = 240deg,
///        length = 10,
///        tag = $referenceEdge,
///      )
///   |> close()
///
/// example = extrude(exampleSketch, length = 5)
///   |> fillet(
///     radius = 3,
///     tags = [getOppositeEdge(referenceEdge)],
///   )
/// ```
@(impl = std_rust, feature_tree = false)
export fn getOppositeEdge(
  /// The tag of the edge you want to find the opposite edge of.
  @edge: TaggedEdge,
): Edge {}

/// Get the next adjacent edge to the edge given.
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> line(end = [10, 0])
///   |> angledLine(
///        angle = 60deg,
///        length = 10,
///      )
///   |> angledLine(
///        angle = 120deg,
///        length = 10,
///      )
///   |> line(end = [-10, 0])
///   |> angledLine(
///        angle = 240deg,
///        length = 10,
///        tag = $referenceEdge,
///      )
///   |> close()
///
/// example = extrude(exampleSketch, length = 5)
///   |> fillet(
///     radius = 3,
///     tags = [getNextAdjacentEdge(referenceEdge)],
///   )
/// ```
@(impl = std_rust, feature_tree = false)
export fn getNextAdjacentEdge(
  /// The tag of the edge you want to find the next adjacent edge of.
  @edge: TaggedEdge,
): Edge {}

/// Get the previous adjacent edge to the edge given.
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> line(end = [10, 0])
///   |> angledLine(
///        angle = 60deg,
///        length = 10,
///      )
///   |> angledLine(
///        angle = 120deg,
///        length = 10,
///      )
///   |> line(end = [-10, 0])
///   |> angledLine(
///        angle = 240deg,
///        length = 10,
///        tag = $referenceEdge,
///      )
///   |> close()
///
/// example = extrude(exampleSketch, length = 5)
///   |> fillet(
///     radius = 3,
///     tags = [getPreviousAdjacentEdge(referenceEdge)],
///   )
/// ```
@(impl = std_rust, feature_tree = false)
export fn getPreviousAdjacentEdge(
  /// The tag of the edge you want to find the previous adjacent edge of.
  @edge: TaggedEdge,
): Edge {}

/// Get the shared edge between two faces.
///
/// ```kcl,legacySketch
/// // Get an edge shared between two faces, created after a chamfer.
///
/// scale = 20
/// part001 = startSketchOn(XY)
///     |> startProfile(at = [0, 0])
///     |> line(end = [0, scale])
///     |> line(end = [scale, 0])
///     |> line(end = [0, -scale])
///     |> close(tag = $line0)
///     |> extrude(length = 20, tagEnd = $end0)
///     // We tag the chamfer to reference it later.
///     |> chamfer(length = 10, tags = [getOppositeEdge(line0)], tag = $chamfer0)
///
/// // Get the shared edge between the chamfer and the extrusion.
/// commonEdge = getCommonEdge(faces = [chamfer0, end0])
///
/// // Chamfer the shared edge.
/// // TODO: uncomment this when ssi for fillets lands
/// // chamfer(part001, length = 5, tags = [commonEdge])
/// ```
@(impl = std_rust, feature_tree = false)
export fn getCommonEdge(
  /// The tags of the faces you want to find the common edge between.
  faces: [TaggedFace; 2],
): Edge {}

/// Get a bounded edge of a surface used for the [blend](/docs/kcl-std/functions/std-solid-blend) operation. A bounded edge is a reference to an existing edge that can be clipped at both ends. This will result in only the non-clipped portion of the edge being used during the blend.
///
/// ```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)
///
/// boundedEdge1 = getBoundedEdge(extrude001, edge = extrude001.sketch.tags.line7, lowerBound = 0.1, upperBound = 0.9)
/// boundedEdge2 = getBoundedEdge(extrude002, edge = extrude002.sketch.tags.line3, lowerBound = 0.4, upperBound = 0.6)
///
/// blend([boundedEdge1, boundedEdge2])
/// ```
@(impl = std_rust, feature_tree = false)
export fn getBoundedEdge(
  /// The solid that the edge belongs to.
  @solid: Solid,
  /// The edge to bound. This can be a tagged edge or an edge ID from `edgeId(...)`.
  edge: Edge,
  /// A lower percentage bound of the edge, must be between 0 and 1 inclusive. Defaults to 0.
  lowerBound?: number(Count),
  /// A upper percentage bound of the edge, must be between 0 and 1 inclusive. Defaults to 1.
  upperBound?: number(Count),
): BoundedEdge {}

/// Construct a circle derived from 3 points.
///
/// This is part of sketch v1 and is soft deprecated in favor of
/// [sketch-solve](/docs/kcl-std/modules/std-solver).
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(XY)
///   |> circleThreePoint(p1 = [10,10], p2 = [20,8], p3 = [15,5])
///   |> extrude(length = 5)
/// ```
@(impl = std_rust, feature_tree = false)
export fn circleThreePoint(
  /// Plane or surface to sketch on.
  @sketchOrSurface: Sketch | Plane | Face,
  /// 1st point to derive the circle.
  p1: Point2d,
  /// 2nd point to derive the circle.
  p2: Point2d,
  /// 3rd point to derive the circle.
  p3: Point2d,
  /// Identifier for the circle to reference elsewhere.
  tag?: TagDecl,
): Sketch {}

/// Create a regular polygon with the specified number of sides that is either inscribed or circumscribed around a circle of the specified radius.
///
/// This is part of sketch v1 and is soft deprecated in favor of
/// [sketch-solve](/docs/kcl-std/modules/std-solver).
///
/// ```kcl,legacySketch
/// // Create a regular hexagon inscribed in a circle of radius 10
/// hex = startSketchOn(XY)
///   |> polygon(
///     radius = 10,
///     numSides = 6,
///     center = [0, 0],
///     inscribed = true,
///   )
///
/// example = extrude(hex, length = 5)
/// ```
///
/// ```kcl,legacySketch
/// // Create a square circumscribed around a circle of radius 5
/// square = startSketchOn(XY)
///   |> polygon(
///     radius = 5.0,
///     numSides = 4,
///     center = [10, 10],
///     inscribed = false,
///   )
/// example = extrude(square, length = 5)
/// ```
@(impl = std_rust, feature_tree = false)
export fn polygon(
  /// Plane or surface to sketch on.
  @sketchOrSurface: Sketch | Plane | Face,
  /// The radius of the polygon.
  radius: number(Length),
  /// The number of sides in the polygon.
  numSides: number(Count),
  /// The center point of the polygon.
  /// If not given, defaults to `[0, 0]`.
  @(includeInSnippet = true, snippetArray = ["0", "0"])
  center?: Point2d,
  /// Whether the polygon is inscribed (true, the default) or circumscribed (false) about a circle with the specified radius.
  inscribed?: bool = true,
): Sketch {}

/// Create a 3D surface or solid by sweeping a sketch along a path.
///
/// This, like extrude, is able to create a 3-dimensional surface or solid from a
/// 2-dimensional sketch. However, unlike extrude, this creates a body
/// by using the extent of the sketch as its path. This is useful for
/// creating more complex shapes that can't be created with a simple
/// extrusion.
///
/// You can provide more than one sketch to sweep, and they will all be
/// swept along the same path.
///
/// ```kcl,legacySketch
/// // Create a pipe using 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])
///
/// // Create a hole for the pipe.
/// 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)
/// ```
///
/// ```kcl,legacySketch
/// // Create a spring by sweeping around a helix path.
///
/// // Create a helix around the Z axis.
/// helixPath = helix(
///     angleStart = 0,
///     ccw = true,
///     revolutions = 4,
///     length = 10,
///     radius = 5,
///     axis = Z,
///  )
///
///
/// // Create a spring by sweeping around the helix path.
/// springSketch = startSketchOn(XZ)
///     |> circle( center = [5, 0], radius = 1)
///     |> sweep(path = helixPath)
/// ```
///
/// ```kcl,legacySketch
/// // Sweep two sketches along the same path.
///
/// sketch001 = startSketchOn(XY)
/// rectangleSketch = startProfile(sketch001, at = [-200, 23.86])
///     |> angledLine(angle = 0, length = 73.47, tag = $rectangleSegmentA001)
///     |> angledLine(
///         angle = segAng(rectangleSegmentA001) - 90deg,
///         length = 50.61,
///     )
///     |> angledLine(
///         angle = segAng(rectangleSegmentA001),
///         length = -segLen(rectangleSegmentA001),
///     )
///     |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
///     |> close()
///
/// circleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)
///
/// sketch002 = startSketchOn(YZ)
/// sweepPath = startProfile(sketch002, at = [0, 0])
///     |> yLine(length = 231.81)
///     |> tangentialArc(radius = 80, angle = -90deg)
///     |> xLine(length = 384.93)
///
/// sweep([rectangleSketch, circleSketch], path = sweepPath)
/// ```
///
/// ```kcl,legacySketch
/// // Sectionally sweep one sketch along the path
///
/// sketch001 = startSketchOn(XY)
/// circleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)
///
/// sketch002 = startSketchOn(YZ)
/// sweepPath = startProfile(sketch002, at = [0, 0])
///     |> yLine(length = 231.81)
///     |> tangentialArc(radius = 80, angle = -90deg)
///     |> xLine(length = 384.93)
///
/// sweep(circleSketch, path = sweepPath, sectional = true)
/// ```
///
/// ```kcl,legacySketch
/// // Sweep a square edge along a path
/// square = startSketchOn(XY)
///   |> startProfile(at = [-100, 200])
///   |> line(end = [200, 0])
///   |> line(end = [0, -200])
///   |> line(end = [-200, 0])
///  |> close()
///
/// path = startSketchOn(XY)
///   |> startProfile(at = [0, 0])
///   |> line(end = [100, 0])
///   |> tangentialArc(end = [107, -48])
///
/// sweep(square, path, bodyType = SURFACE)
/// ```
///
/// ```kcl,legacySketch
/// // Sweep a segment along a path
/// segment = startSketchOn(YZ)
///   |> startProfile(at = [-100, 200])
///   |> line(end = [100, 0])
///
/// path = startSketchOn(XY)
///   |> startProfile(at = [0, 0])
///   |> line(end = [100, 0])
///   |> tangentialArc(end = [117, 34.5])
///
/// sweep(segment, path, bodyType = SURFACE)
/// ```
///
/// ```kcl,legacySketch
/// // Sweep a segment along a path
/// segment = startSketchOn(YZ)
///   |> startProfile(at = [-100, 200])
///   |> line(end = [100, 0])
///
/// path = startSketchOn(XY)
///   |> startProfile(at = [0, 0])
///   |> line(end = [100, 0])
///   |> tangentialArc(end = [117, 34.5])
///
/// sweep(segment, path, bodyType = SURFACE, version = 2)
/// ```
///
/// ```kcl,sketchSolve
/// profile = sketch(on = YZ) {
///   edge1 = line(start = [var 0mm, var 0mm], end = [var 2mm, var 0mm])
///   edge2 = line(start = [var 2mm, var 0mm], end = [var 2mm, var 2mm])
///   edge3 = line(start = [var 2mm, var 2mm], end = [var 0mm, var 2mm])
///   edge4 = line(start = [var 0mm, var 2mm], 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])
/// }
///
/// profileRegion = region(point = [1mm, 1mm], sketch = profile)
///
/// path = startSketchOn(XY)
///   |> startProfile(at = [0mm, 0mm])
///   |> line(end = [8mm, 0mm])
///   |> tangentialArc(end = [4mm, 4mm])
///
/// swept = sweep(profileRegion, path)
/// ```
/// ```kcl,sketchSolve
/// // Demonstrates using sweeps with segments from sketch blocks.
///
/// // Sketch a square
/// sketch001 = sketch(on = XZ) {
///   line1 = line(start = [var -3.34mm, var -1.89mm], end = [var -1.62mm, var -1.89mm])
///   line2 = line(start = [var -1.62mm, var -1.89mm], end = [var -1.62mm, var 0.56mm])
///   line3 = line(start = [var -1.62mm, var 0.56mm], end = [var -3.34mm, var 0.56mm])
///   line4 = line(start = [var -3.34mm, var 0.56mm], end = [var -3.34mm, var -1.89mm])
///   coincident([line1.end, line2.start])
///   coincident([line2.end, line3.start])
///   coincident([line3.end, line4.start])
///   coincident([line4.end, line1.start])
///   parallel([line2, line4])
///   parallel([line3, line1])
///   perpendicular([line1, line2])
///   horizontal(line3)
/// }
///
/// // Sketch a path
/// sketch002 = sketch(on = offsetPlane(YZ, offset = -2)) {
///   line1 = line(start = [var 00mm, var 0mm], end = [var -3mm, var 0mm])
///   line2 = line(start = [var 00mm, var 0mm], end = [var 2mm, var 1mm])
/// }
///
/// mySquare = region(point = [-2.48mm, -1.8875mm], sketch = sketch001)
///
/// // Sweep the square along the path.
/// sweep(mySquare, path = sketch002.line1)
/// ```
/// ```kcl,sketchSolve
/// // Demonstrates sweeping along a multi-segment path from a sketch block.
///
/// sketch001 = sketch(on = XY) {
///   line1 = line(start = [var 2mm, var 2mm], end = [var 2mm, var 0mm])
///   line2 = line(start = [var 2mm, var 0mm], end = [var 0mm, var 0mm])
///   line3 = line(start = [var 0mm, var 0mm], end = [var 0mm, var 2mm])
///   line4 = line(start = [var 0mm, var 2mm], end = [var 2mm, var 2mm])
///   coincident([line1.end, line2.start])
///   coincident([line2.end, line3.start])
///   coincident([line3.end, line4.start])
///   coincident([line4.end, line1.start])
///   parallel([line2, line4])
///   parallel([line3, line1])
///   perpendicular([line1, line2])
/// }
/// mySquare = region(point = [1.9975mm, 1mm], sketch = sketch001)
///
/// // Sketch a path
/// sketch002 = sketch(on = offsetPlane(YZ, offset = -2)) {
///   line1 = line(start = [var -0.01mm, var -0.01mm], end = [var -0.12mm, var 2.4mm])
///   arc1 = arc(start = [var 0.6mm, var 4.55mm], end = [var -0.12mm, var 2.4mm], center = [var 3.03mm, var 2.54mm])
///   coincident([line1.end, arc1.end])
///   tangent([line1, arc1])
/// }
///
/// // Sweep the square along the path.
/// path = [sketch002.line1, sketch002.arc1]
/// sweep(mySquare, path)
/// ```
/// ```kcl,sketchSolve
/// // Demonstrates surface sweeps of open profiles.
///
/// // Sketch a square
/// sketch001 = sketch(on = XY) {
///   line1 = line(start = [var -3.34mm, var -1.89mm], end = [var -1.62mm, var -1.89mm])
///   line2 = line(start = [var -1.62mm, var -1.89mm], end = [var -1.62mm, var 0.56mm])
///   line3 = line(start = [var -1.62mm, var 0.56mm], end = [var -3.34mm, var 0.56mm])
///   line4 = line(start = [var -3.34mm, var 0.56mm], end = [var -3.34mm, var -1.89mm])
///   coincident([line1.end, line2.start])
///   coincident([line2.end, line3.start])
///   coincident([line3.end, line4.start])
///   coincident([line4.end, line1.start])
///   parallel([line2, line4])
///   parallel([line3, line1])
///   perpendicular([line1, line2])
///   horizontal(line3)
/// }
///
/// mySquare = region(point = [-2.48mm, -1.8875mm], sketch = sketch001)
///
/// sketch002 = sketch(on = XZ) {
///   line1 = line(start = [var -1.17mm, var -0.79mm], end = [var -15.37mm, var -0.7mm])
///   arc1 = arc(start = [var -15.37mm, var 21.18mm], end = [var -15.37mm, var -0.7mm], center = [var -15.3mm, var 10.24mm])
///   coincident([line1.end, arc1.end])
///   tangent([line1, arc1])
/// }
///
/// // Sweep the square along the path.
/// path = [sketch002.line1, sketch002.arc1]
/// sweep(sketch001.line2, path, bodyType = SURFACE)
/// ```
@(impl = std_rust, feature_tree = true)
export fn sweep(
  /// The sketch or set of sketches that should be swept in space.
  @sketches: [Sketch | Segment; 1+],
  /// The path to sweep the sketch along.
  path: Sketch | Helix | [Segment; 1+],
  /// If true, the sweep will be broken up into sub-sweeps (extrusions, revolves, sweeps) based on the trajectory path components.
  sectional?: bool,
  /// 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),
  /// What is the sweep relative to? Can be either 'sketchPlane' or 'trajectoryCurve'.
  relativeTo?: string = 'trajectoryCurve',
  /// A named tag for the face at the start of the sweep, i.e. the original sketch.
  tagStart?: TagDecl,
  /// A named tag for the face at the end of the sweep.
  tagEnd?: TagDecl,
  /// What type of body to produce (solid or surface).
  /// Defaults to "solid".
  bodyType?: string = "solid",
  /// What version of the sweeping algorithm to use (leave unspecified or use 0 to use the default algorithm).
  version?: number(Count) = 0,
): [Solid; 1+] {}

/// Create a 3D surface or solid by interpolating between two or more sketches.
///
/// ```kcl,legacySketch
/// // Loft a square and a triangle.
/// squareSketch = startSketchOn(XY)
///     |> startProfile(at = [-100, 200])
///     |> line(end = [200, 0])
///     |> line(end = [0, -200])
///     |> line(end = [-200, 0])
///     |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
///     |> close()
///
/// triangleSketch = startSketchOn(offsetPlane(XY, offset = 75))
///     |> startProfile(at = [0, 125])
///     |> line(end = [-15, -30])
///     |> line(end = [30, 0])
///     |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
///     |> close()
///
/// loft([triangleSketch, squareSketch])
/// ```
///
/// ```kcl,legacySketch
/// // Loft a square, a circle, and another circle.
/// squareSketch = startSketchOn(XY)
///     |> startProfile(at = [-100, 200])
///     |> line(end = [200, 0])
///     |> line(end = [0, -200])
///     |> line(end = [-200, 0])
///     |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
///     |> close()
///
/// circleSketch0 = startSketchOn(offsetPlane(XY, offset = 75))
///     |> circle( center = [0, 100], radius = 50 )
///
/// circleSketch1 = startSketchOn(offsetPlane(XY, offset = 150))
///     |> circle( center = [0, 100], radius = 20 )
///
/// loft([squareSketch, circleSketch0, circleSketch1])
///   |> appearance(color = "#da7333", roughness = 50, metalness = 90)
/// ```
///
/// ```kcl,legacySketch
/// // Loft a square, a circle, and another circle with options.
/// squareSketch = startSketchOn(XY)
///     |> startProfile(at = [-100, 200])
///     |> line(end = [200, 0])
///     |> line(end = [0, -200])
///     |> line(end = [-200, 0])
///     |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
///     |> close()
///
/// circleSketch0 = startSketchOn(offsetPlane(XY, offset = 75))
///     |> circle( center = [0, 100], radius = 50 )
///
/// circleSketch1 = startSketchOn(offsetPlane(XY, offset = 150))
///     |> circle( center = [0, 100], radius = 20 )
///
/// loft([squareSketch, circleSketch0, circleSketch1],
///     baseCurveIndex = 0,
///     bezApproximateRational = false,
///     tolerance = 0.000001,
///     vDegree = 2,
/// )
/// ```
///
/// ```kcl,legacySketch
/// sketch001 = startSketchOn(XZ)
/// profile001 = startProfile(sketch001, at = [-3, 0])
///   |> xLine(length = 6)
/// plane001 = offsetPlane(XZ, offset = -5)
/// sketch002 = startSketchOn(plane001)
/// profile002 = startProfile(sketch002, at = [-2, -2])
///   |> line(endAbsolute = [-1.25, -0.5])
///   |> tangentialArc(endAbsolute = [-0.5, 0])
///   |> xLine(length = 1)
///   |> tangentialArc(end = [0.75, -0.5])
///   |> line(end = [0.75, -1.5])
///
/// plane002 = offsetPlane(XZ, offset = -10)
/// sketch003 = startSketchOn(plane002)
/// profile003 = startProfile(sketch003, at = [-2, -6])
///   |> line(end = [0.75, 1.5])
///   |> tangentialArc(end = [0.75, 0.5])
///   |> line(end = [1, 0])
///   |> tangentialArc(end = [0.75, -0.5])
///   |> line(end = [0.75, -1.5])
/// plane003 = offsetPlane(XZ, offset = -15)
/// sketch004 = startSketchOn(plane003)
/// profile004 = startProfile(sketch004, at = [-3, -4])
///   |> xLine(length = 6)
///
/// loft([profile001, profile002, profile003, profile004], bodyType = SURFACE)
/// ```
///
/// ```kcl,legacySketch
/// sketch001 = startSketchOn(-XY)
/// profile001 = startProfile(sketch001, at = [-2, 3])
///   |> arc(interiorAbsolute = [0, 5], endAbsolute = [2, 3])
///
/// sketch002 = startSketchOn(XZ)
/// profile002 = startProfile(sketch002, at = [2, 0])
///   |> arc(interiorAbsolute = [0, -2], endAbsolute = [-2, 0])
///
/// sketch003 = startSketchOn(XY)
/// profile003 = startProfile(sketch003, at = [2, -3])
///   |> arc(interiorAbsolute = [0, -5], endAbsolute = [-2, -3])
///
/// loft([profile001, profile002, profile003], bodyType = SURFACE)
/// ```
///
/// ```kcl,sketchSolve
/// lowerProfile = 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])
/// }
///
/// upperProfile = sketch(on = offsetPlane(XY, offset = 8mm)) {
///   edge5 = line(start = [var 1.6mm, var 1mm], end = [var 4.4mm, var 1mm])
///   edge6 = line(start = [var 4.4mm, var 1mm], end = [var 3.2mm, var 2.6mm])
///   edge7 = line(start = [var 3.2mm, var 2.6mm], end = [var 2.8mm, var 2.6mm])
///   edge8 = line(start = [var 2.8mm, var 2.6mm], end = [var 1.6mm, var 1mm])
///   coincident([edge5.end, edge6.start])
///   coincident([edge6.end, edge7.start])
///   coincident([edge7.end, edge8.start])
///   coincident([edge8.end, edge5.start])
/// }
///
/// lowerRegion = region(point = [2mm, 2mm], sketch = lowerProfile)
/// upperRegion = region(point = [3mm, 1.8mm], sketch = upperProfile)
///
/// lofted = loft([lowerRegion, upperRegion])
/// ```
/// ```kcl,sketchSolve
/// // Demonstrates surface lofts with shapes from sketch blocks.
/// // Loft a square, a circle, and another circle.
/// sideLen = 4
/// squareSketch = sketch(on = XY) {
///   line1 = line(start = [var -0.02mm, var 4.02mm], end = [var 0mm, var 0mm])
///   coincident([line1.end, ORIGIN])
///   line2 = line(start = [var 4.02mm, var 0.03mm], end = [var 4.06mm, var 3.97mm])
///   line3 = line(start = [var 4.06mm, var 3.97mm], end = [var -0.02mm, var 4.02mm])
///   coincident([line2.end, line3.start])
///   coincident([line3.end, line1.start])
///   line4 = line(start = [var 0mm, var 0mm], end = [var 4.02mm, var 0.03mm])
///   coincident([line4.start, line1.end])
///   coincident([line4.end, line2.start])
///   equalLength([line1, line2, line3, line4])
///   parallel([line1, line2])
/// }
/// 
/// circleSketch0 = sketch(on = offsetPlane(XY, offset = 2)) {
///   circle1 = circle(start = [var 2.28mm, var 2.99mm], center = [var 1.98mm, var 2.03mm])
/// }
/// 
/// squareRegion = region(point = [0.0002mm, 2.0095mm], sketch = squareSketch)
/// circleRegion = region(point = [1.6807mm, 1.0724mm], sketch = circleSketch0)
/// 
/// shape = loft([squareRegion, circleRegion], bodyType = SURFACE)
/// ```
/// ```kcl,sketchSolve
/// // Demonstrates surface lofting of segments from multiple sketch blocks.
/// @settings(defaultLengthUnit = mm, kclVersion = 1.0)
/// 
/// sketch002 = sketch(on = XY) {
///   arc1 = arc(start = [var -2.02mm, var -3.05mm], end = [var 2.03mm, var -3.01mm], center = [var 0.01mm, var -3.05mm])
/// }
/// sketch003 = sketch(on = -XY) {
///   arc1 = arc(start = [var 2.03mm, var 3.05mm], end = [var -2.03mm, var 3.03mm], center = [var 0mm, var 2.94mm])
/// }
/// 
/// sketch001 = sketch(on = XZ) {
///   arc1 = arc(start = [var -2.03mm, var -0.13mm], end = [var 2.03mm, var -0.05mm], center = [var 0mm, var 0mm])
///   coincident([arc1.center, ORIGIN])
/// }
/// 
/// loft(
///   [
///     sketch003.arc1,
///     sketch002.arc1,
///     sketch001.arc1
///   ],
///   bodyType = SURFACE,
/// )
/// ```
@(impl = std_rust, feature_tree = true)
export fn loft(
  /// Which sketches to loft (or segments, for surface lofts).
  /// Must include at least 2 sketches.
  @sketches: [Sketch | [Segment; 1+]; 2+],
  /// Degree of the interpolation. Must be greater than zero. For example, use 2 for quadratic, or 3 for cubic interpolation in the V direction.
  vDegree?: number(Count) = 2,
  /// Attempt to approximate rational curves (such as arcs) using a bezier. This will remove banding around interpolations between arcs and non-arcs. It may produce errors in other scenarios. Over time, this field won't be necessary.
  bezApproximateRational?: bool = false,
  /// This can be set to override the automatically determined topological base curve, which is usually the first section encountered.
  baseCurveIndex?: number(Count),
  /// 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),
  /// A named tag for the face at the start of the loft, i.e. the original sketch.
  tagStart?: TagDecl,
  /// A named tag for the face at the end of the loft.
  tagEnd?: TagDecl,
  /// What type of body to produce (solid or surface).
  /// Defaults to "solid".
  bodyType?: string = "solid",
): Solid {}

/// Repeat a 2-dimensional sketch along some dimension, with a dynamic amount
/// of distance between each repetition, some specified number of times.
///
/// ```kcl,legacySketch
/// /// Pattern using a named axis.
///
/// exampleSketch = startSketchOn(XZ)
///   |> circle(center = [0, 0], radius = 1)
///   |> patternLinear2d(
///        axis = X,
///        instances = 7,
///        distance = 4
///      )
///
/// example = extrude(exampleSketch, length = 1)
/// ```
///
/// ```kcl,legacySketch
/// /// Pattern using a raw axis.
///
/// exampleSketch = startSketchOn(XZ)
///   |> circle(center = [0, 0], radius = 1)
///   |> patternLinear2d(
///        axis = [1, 0],
///        instances = 7,
///        distance = 4
///      )
///
/// example = extrude(exampleSketch, length = 1)
/// ```
@(impl = std_rust, feature_tree = false)
export fn patternLinear2d(
  /// The sketch(es) to duplicate.
  @sketches: [Sketch; 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 2D vector.
  @(snippetArray = ["1", "0"])
  axis: Axis2d | Point2d,
  /// 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,
): [Sketch; 1+] {}

/// Repeat a 2-dimensional sketch 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
/// 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)
/// ```
@(impl = std_rust, feature_tree = false)
export fn patternCircular2d(
  /// The sketch(es) to duplicate.
  @sketches: [Sketch; 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 center about which to make the pattern. This is a 2D vector.
  /// If not given, defaults to `[0, 0]`.
  @(includeInSnippet = true, snippetArray = ["0", "0"])
  center?: Point2d,
  /// The arc angle (in degrees) to place the repetitions. Must be greater than 0.
  arcDegrees?: number(Angle) = 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,
): [Sketch; 1+] {}

/// Compute the ending point of the provided line segment.
///
/// ```kcl,legacySketch
/// w = 15
/// cube = startSketchOn(XY)
///   |> startProfile(at = [0, 0])
///   |> line(end = [w, 0], tag = $line1)
///   |> line(end = [0, w], tag = $line2)
///   |> line(end = [-w, 0], tag = $line3)
///   |> line(end = [0, -w], tag = $line4)
///   |> close()
///   |> extrude(length = 5)
///
/// fn cylinder(radius, tag) {
///   return startSketchOn(XY)
///   |> startProfile(at = [0, 0])
///   |> circle(radius = radius, center = segEnd(tag) )
///   |> extrude(length = radius)
/// }
///
/// cylinder(radius = 1, tag = line1)
/// cylinder(radius = 2, tag = line2)
/// cylinder(radius = 3, tag = line3)
/// cylinder(radius = 4, tag = line4)
/// ```
@(impl = std_rust, feature_tree = false)
export fn segEnd(
  /// The line segment being queried by its tag.
  @tag: TaggedEdge,
): Point2d {}

/// Compute the ending point of the provided line segment along the 'x' axis.
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> line(end = [20, 0], tag = $thing)
///   |> line(end = [0, 5])
///   |> line(end = [segEndX(thing), 0])
///   |> line(end = [-20, 10])
///   |> close()
///
/// example = extrude(exampleSketch, length = 5)
/// ```
@(impl = std_rust, feature_tree = false)
export fn segEndX(
  /// The line segment being queried by its tag.
  @tag: TaggedEdge,
): number(Length) {}

/// Compute the ending point of the provided line segment along the 'y' axis.
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> line(end = [20, 0])
///   |> line(end = [0, 3], tag = $thing)
///   |> line(end = [-10, 0])
///   |> line(end = [0, segEndY(thing)])
///   |> line(end = [-10, 0])
///   |> close()
///
/// example = extrude(exampleSketch, length = 5)
/// ```
@(impl = std_rust, feature_tree = false)
export fn segEndY(
  /// The line segment being queried by its tag.
  @tag: TaggedEdge,
): number(Length) {}

/// Compute the starting point of the provided line segment.
///
/// ```kcl,legacySketch
/// w = 15
/// cube = startSketchOn(XY)
///   |> startProfile(at = [0, 0])
///   |> line(end = [w, 0], tag = $line1)
///   |> line(end = [0, w], tag = $line2)
///   |> line(end = [-w, 0], tag = $line3)
///   |> line(end = [0, -w], tag = $line4)
///   |> close()
///   |> extrude(length = 5)
///
/// fn cylinder(radius, tag) {
///   return startSketchOn(XY)
///   |> startProfile(at = [0, 0])
///   |> circle( radius = radius, center = segStart(tag) )
///   |> extrude(length = radius)
/// }
///
/// cylinder(radius = 1, tag = line1)
/// cylinder(radius = 2, tag = line2)
/// cylinder(radius = 3, tag = line3)
/// cylinder(radius = 4, tag = line4)
/// ```
@(impl = std_rust, feature_tree = false)
export fn segStart(
  /// The line segment being queried by its tag.
  @tag: TaggedEdge,
): Point2d {}

/// Compute the starting point of the provided line segment along the 'x' axis.
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> line(end = [20, 0], tag = $thing)
///   |> line(end = [0, 5])
///   |> line(end = [20 - segStartX(thing), 0])
///   |> line(end = [-20, 10])
///   |> close()
///
/// example = extrude(exampleSketch, length = 5)
/// ```
@(impl = std_rust, feature_tree = false)
export fn segStartX(
  /// The line segment being queried by its tag.
  @tag: TaggedEdge,
): number(Length) {}

/// Compute the starting point of the provided line segment along the 'y' axis.
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> line(end = [20, 0])
///   |> line(end = [0, 3], tag = $thing)
///   |> line(end = [-10, 0])
///   |> line(end = [0, 20-segStartY(thing)])
///   |> line(end = [-10, 0])
///   |> close()
///
/// example = extrude(exampleSketch, length = 5)
/// ```
@(impl = std_rust, feature_tree = false)
export fn segStartY(
  /// The line segment being queried by its tag.
  @tag: TaggedEdge,
): number(Length) {}

/// Extract the 'x' axis value of the last line segment in the provided 2-d sketch.
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> line(end = [5, 0])
///   |> line(end = [20, 5])
///   |> line(end = [lastSegX(%), 0])
///   |> line(end = [-15, 0])
///   |> close()
///
/// example = extrude(exampleSketch, length = 5)
/// ```
@(impl = std_rust, feature_tree = false)
export fn lastSegX(
  /// The sketch whose line segment is being queried.
  @sketch: Sketch,
): number(Length) {}

/// Extract the 'y' axis value of the last line segment in the provided 2-d sketch.
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> line(end = [5, 0])
///   |> line(end = [20, 5])
///   |> line(end = [0, lastSegY(%)])
///   |> line(end = [-15, 0])
///   |> close()
///
/// example = extrude(exampleSketch, length = 5)
/// ```
@(impl = std_rust, feature_tree = false)
export fn lastSegY(
  /// The sketch whose line segment is being queried.
  @sketch: Sketch,
): number(Length) {}

/// Compute the length of the provided line segment.
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> angledLine(
///     angle = 60deg,
///     length = 10,
///     tag = $thing,
///   )
///   |> tangentialArc(angle = -120deg, radius = 5)
///   |> angledLine(
///     angle = -60deg,
///     length = segLen(thing),
///   )
///   |> close()
///
/// example = extrude(exampleSketch, length = 5)
/// ```
@(impl = std_rust, feature_tree = false)
export fn segLen(
  /// The line segment being queried by its tag.
  @tag: TaggedEdge,
): number(Length) {}

/// Compute the angle (in degrees) of the provided line segment.
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> line(end = [10, 0])
///   |> line(end = [5, 10], tag = $seg01)
///   |> line(end = [-10, 0])
///   |> angledLine(angle = segAng(seg01), length = 10)
///   |> line(end = [-10, 0])
///   |> angledLine(angle = segAng(seg01), length = -15)
///   |> close()
///
/// example = extrude(exampleSketch, length = 4)
/// ```
@(impl = std_rust, feature_tree = false)
export fn segAng(
  /// The line segment being queried by its tag.
  @tag: TaggedEdge,
): number(Angle) {}

/// Returns the angle coming out of the end of the segment in degrees.
///
/// ```kcl,legacySketch
/// // Horizontal pill.
/// pillSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> line(end = [20, 0])
///   |> tangentialArc(end = [0, 10], tag = $arc1)
///   |> angledLine(
///     angle = tangentToEnd(arc1),
///     length = 20,
///   )
///   |> tangentialArc(end = [0, -10])
///   |> close()
///
/// pillExtrude = extrude(pillSketch, length = 10)
/// ```
///
/// ```kcl,legacySketch
/// // Vertical pill.  Use absolute coordinate for arc.
/// pillSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> line(end = [0, 20])
///   |> tangentialArc(endAbsolute = [10, 20], tag = $arc1)
///   |> angledLine(
///     angle = tangentToEnd(arc1),
///     length = 20,
///   )
///   |> tangentialArc(end = [-10, 0])
///   |> close()
///
/// pillExtrude = extrude(pillSketch, length = 10)
/// ```
///
/// ```kcl,legacySketch
/// rectangleSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> line(end = [10, 0], tag = $seg1)
///   |> angledLine(
///     angle = tangentToEnd(seg1),
///     length = 10,
///   )
///   |> line(end = [0, 10])
///   |> line(end = [-20, 0])
///   |> close()
///
/// rectangleExtrude = extrude(rectangleSketch, length = 10)
/// ```
///
/// ```kcl,legacySketch
/// bottom = startSketchOn(XY)
///   |> startProfile(at = [0, 0])
///   |> arc(
///        endAbsolute = [10, 10],
///        interiorAbsolute = [5, 1],
///        tag = $arc1,
///      )
///   |> angledLine(angle = tangentToEnd(arc1), length = 20)
///   |> close()
/// ```
///
/// ```kcl,legacySketch
/// circSketch = startSketchOn(XY)
///   |> circle(center = [0, 0], radius= 3, tag = $circ)
///
/// triangleSketch = startSketchOn(XY)
///   |> startProfile(at = [-5, 0])
///   |> angledLine(angle = tangentToEnd(circ), length = 10)
///   |> line(end = [-15, 0])
///   |> close()
/// ```
@(impl = std_rust, feature_tree = false)
export fn tangentToEnd(
  /// The line segment being queried by its tag.
  @tag: TaggedEdge,
): number(Angle) {}

/// Extract the provided 2-dimensional sketch's profile's origin value.
///
/// ```kcl,legacySketch
/// sketch001 = startSketchOn(XY)
///  |> startProfile(at = [5, 2])
///  |> angledLine(angle = 120deg, length = 50 , tag = $seg01)
///  |> angledLine(angle = segAng(seg01) + 120deg, length = 50 )
///  |> line(end = profileStart(%))
///  |> close()
///  |> extrude(length = 20)
/// ```
@(impl = std_rust, feature_tree = false)
export fn profileStart(
  /// Profile whose start is being used.
  @profile: Sketch,
): Point2d {}

/// Extract the provided 2-dimensional sketch's profile's origin's 'x' value.
///
/// ```kcl,legacySketch
/// sketch001 = startSketchOn(XY)
///  |> startProfile(at = [5, 2])
///  |> angledLine(angle = -26.6deg, length = 50)
///  |> angledLine(angle = 90deg, length = 50)
///  |> angledLine(angle = 30deg, endAbsoluteX = profileStartX(%))
/// ```
@(impl = std_rust, feature_tree = false)
export fn profileStartX(
  /// Profile whose start is being used.
  @profile: Sketch,
): number(Length) {}

/// Extract the provided 2-dimensional sketch's profile's origin's 'y' value.
///
/// ```kcl,legacySketch
/// sketch001 = startSketchOn(XY)
///  |> startProfile(at = [5, 2])
///  |> angledLine(angle = -60deg, length = 14 )
///  |> angledLine(angle = 30deg, endAbsoluteY =  profileStartY(%))
/// ```
@(impl = std_rust, feature_tree = false)
export fn profileStartY(
  /// Profile whose start is being used.
  @profile: Sketch,
): number(Length) {}

/// Extend the current sketch with a new involute circular curve.
///
/// This is part of sketch v1 and is soft deprecated in favor of
/// [sketch-solve](/docs/kcl-std/modules/std-solver). The sketch-solve version
/// of involute circular is still under development.
///
/// ```kcl,legacySketch
/// a = 10
/// b = 14
/// startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> involuteCircular(startRadius = a, endRadius = b, angle = 60deg)
///   |> involuteCircular(startRadius = a, endRadius = b, angle = 60deg, reverse = true)
/// ```
/// ```kcl,legacySketch
/// // Example: a gear that uses an involute circular profile for the teeth.
/// @settings(defaultLengthUnit = mm)
///
/// /// // Define gear parameters
/// nTeeth = 21
/// module = 1.5
/// pressureAngle = 14deg
/// gearHeight = 6
/// pitchDiameter = module * nTeeth
/// addendum = module
/// deddendum = 1.25 * module
/// baseDiameter = pitchDiameter * cos(pressureAngle)
/// tipDiameter = pitchDiameter + 2 * module
///
/// // Using the gear parameters, sketch an involute tooth spanning from the base diameter to the tip diameter
/// gearSketch = startSketchOn(XY)
///   |> startProfile(at = polar(angle = 0, length = baseDiameter / 2))
///   |> involuteCircular(
///        startDiameter = baseDiameter,
///        endDiameter = tipDiameter,
///        angle = 0,
///        tag = $seg01,
///      )
///   |> line(endAbsolute = polar(angle = 160deg / nTeeth, length = tipDiameter / 2))
///   |> involuteCircular(
///        startDiameter = baseDiameter,
///        endDiameter = tipDiameter,
///        angle = -atan(segEndY(seg01) / segEndX(seg01)) - (180deg / nTeeth),
///        reverse = true,
///      )
///   // Position the end line of the sketch at the start of the next tooth
///   |> line(endAbsolute = polar(angle = 360deg / nTeeth, length = baseDiameter / 2))
///   // Pattern the sketch about the center by the specified number of teeth, then close the sketch
///   |> patternCircular2d(
///        instances = nTeeth,
///        center = [0, 0],
///        arcDegrees = 360deg,
///        rotateDuplicates = true,
///      )
///   |> close()
///   // Extrude the gear to the specified height
///   |> extrude(length = gearHeight)
/// ```
@(impl = std_rust, feature_tree = false)
export fn involuteCircular(
  /// Which sketch should this path be added to?
  @sketch: Sketch,
  /// The angle to rotate the involute by. A value of zero will produce a curve with a tangent along the x-axis at the start point of the curve.
  angle: number(Angle),
  /// The involute is described between two circles, startRadius is the radius of the inner circle.
  /// Either `startRadius` or `startDiameter` must be given (but not both).
  startRadius?: number(Length),
  /// The involute is described between two circles, endRadius is the radius of the outer circle.
  /// Either `endRadius` or `endDiameter` must be given (but not both).
  endRadius?: number(Length),
  /// The involute is described between two circles, startDiameter describes the inner circle.
  /// Either `startRadius` or `startDiameter` must be given (but not both).
  startDiameter?: number(Length),
  /// The involute is described between two circles, endDiameter describes the outer circle.
  /// Either `endRadius` or `endDiameter` must be given (but not both).
  endDiameter?: number(Length),
  /// If reverse is true, the segment will start from the end of the involute, otherwise it will start from that start.
  reverse?: bool = false,
  /// Create a new tag which refers to this line.
  tag?: TagDecl,
): Sketch {}

/// Extend the current sketch with a new straight line.
///
/// This is part of sketch v1 and is soft deprecated in favor of
/// [sketch-solve](/docs/kcl-std/modules/std-solver).
///
/// ```kcl,legacySketch
/// triangle = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   // The END argument means it ends at exactly [10, 0].
///   // This is an absolute measurement, it is NOT relative to
///   // the start of the sketch.
///   |> line(endAbsolute = [10, 0])
///   |> line(endAbsolute = [0, 10])
///   |> line(endAbsolute = [-10, 0], tag = $thirdLineOfTriangle)
///   |> close()
///   |> extrude(length = 5)
///
/// box = startSketchOn(XZ)
///   |> startProfile(at = [10, 10])
///   // The 'to' argument means move the pen this much.
///   // So, [10, 0] is a relative distance away from the current point.
///   |> line(end = [10, 0])
///   |> line(end = [0, 10])
///   |> line(end = [-10, 0], tag = $thirdLineOfBox)
///   |> close()
///   |> extrude(length = 5)
/// ```
@(impl = std_rust, feature_tree = false)
export fn line(
  /// Which sketch should this path be added to?
  @sketch: Sketch,
  /// Which absolute point should this line go to? Incompatible with `end`.
  endAbsolute?: Point2d,
  /// How far away (along the X and Y axes) should this line go? Incompatible with `endAbsolute`.
  @(includeInSnippet = true)
  end?: Point2d,
  /// Create a new tag which refers to this line.
  tag?: TagDecl,
): Sketch {}

/// Draw a line relative to the current origin to a specified distance away
/// from the current position along the 'x' axis.
///
/// This is part of sketch v1 and is soft deprecated in favor of
/// [sketch-solve](/docs/kcl-std/modules/std-solver).
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> xLine(length = 15)
///   |> angledLine(
///     angle = 80deg,
///     length = 15,
///   )
///   |> line(end = [8, -10])
///   |> xLine(length = 10)
///   |> angledLine(
///     angle = 120deg,
///     length = 30,
///   )
///   |> xLine(length = -15)
///   |> close()
///
/// example = extrude(exampleSketch, length = 10)
/// ```
@(impl = std_rust, feature_tree = false)
export fn xLine(
  /// Which sketch should this path be added to?
  @sketch: Sketch,
  /// How far away along the X axis should this line go? Incompatible with `endAbsolute`.
  @(includeInSnippet = true)
  length?: number(Length),
  /// Which absolute X value should this line go to? Incompatible with `length`.
  endAbsolute?: number(Length),
  /// Create a new tag which refers to this line.
  tag?: TagDecl,
): Sketch {}

/// Draw a line relative to the current origin to a specified distance away
/// from the current position along the 'y' axis.
///
/// This is part of sketch v1 and is soft deprecated in favor of
/// [sketch-solve](/docs/kcl-std/modules/std-solver).
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> yLine(length = 15)
///   |> angledLine(
///     angle = 30deg,
///     length = 15,
///   )
///   |> line(end = [8, -10])
///   |> yLine(length = -5)
///   |> close()
///
/// example = extrude(exampleSketch, length = 10)
/// ```
@(impl = std_rust, feature_tree = false)
export fn yLine(
  /// Which sketch should this path be added to?
  @sketch: Sketch,
  /// How far away along the Y axis should this line go? Incompatible with `endAbsolute`.
  @(includeInSnippet = true)
  length?: number(Length),
  /// Which absolute Y value should this line go to? Incompatible with `length`.
  endAbsolute?: number(Length),
  /// Create a new tag which refers to this line.
  tag?: TagDecl,
): Sketch {}

/// Draw a line segment relative to the current origin using the polar
/// measure of some angle and distance.
///
/// This is part of sketch v1 and is soft deprecated in favor of
/// [sketch-solve](/docs/kcl-std/modules/std-solver).
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> yLine(endAbsolute = 15)
///   |> angledLine(
///     angle = 30deg,
///     length = 15,
///   )
///   |> line(end = [8, -10])
///   |> yLine(endAbsolute = 0)
///   |> close()
///
/// example = extrude(exampleSketch, length = 10)
/// ```
@(impl = std_rust, feature_tree = false)
export fn angledLine(
  /// Which sketch should this path be added to?
  @sketch: Sketch,
  /// Which angle should the line be drawn at?
  angle: number(Angle),
  /// Draw the line this distance along the given angle. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given.
  length?: number(Length),
  /// Draw the line this distance along the X axis. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given.
  lengthX?: number(Length),
  /// Draw the line this distance along the Y axis. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given.
  lengthY?: number(Length),
  /// Draw the line along the given angle until it reaches this point along the X axis. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given.
  endAbsoluteX?: number(Length),
  /// Draw the line along the given angle until it reaches this point along the Y axis. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given.
  endAbsoluteY?: number(Length),
  /// Create a new tag which refers to this line.
  tag?: TagDecl,
): Sketch {}

/// Draw an angled line from the current origin, constructing a line segment
/// such that the newly created line intersects the desired target line
/// segment.
///
/// This is part of sketch v1 and is soft deprecated in favor of
/// [sketch-solve](/docs/kcl-std/modules/std-solver).
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> line(endAbsolute = [5, 10])
///   |> line(endAbsolute = [-10, 10], tag = $lineToIntersect)
///   |> line(endAbsolute = [0, 20])
///   |> angledLineThatIntersects(
///        angle = 80deg,
///        intersectTag = lineToIntersect,
///        offset = 10,
///      )
///   |> close()
///
/// example = extrude(exampleSketch, length = 10)
/// ```
@(impl = std_rust, feature_tree = false)
export fn angledLineThatIntersects(
  /// Which sketch should this path be added to?
  @sketch: Sketch,
  /// Which angle should the line be drawn at?
  angle: number(Angle),
  /// The tag of the line to intersect with.
  intersectTag: TaggedEdge,
  /// The offset from the intersecting line.
  offset?: number(Length) = 0mm,
  /// Create a new tag which refers to this line.
  tag?: TagDecl,
): Sketch {}

/// Construct a line segment from the current origin back to the profile's
/// origin, ensuring the resulting 2-dimensional sketch is not open-ended.
///
/// This is part of sketch v1 and is soft deprecated in favor of
/// [sketch-solve](/docs/kcl-std/modules/std-solver).
///
/// If you want to perform some 3-dimensional operation on a sketch, like
/// extrude or sweep, you must `close` it first. `close` must be called even
/// if the end point of the last segment is coincident with the sketch
/// starting point.
///
/// ```kcl,legacySketch
/// startSketchOn(XZ)
///    |> startProfile(at = [0, 0])
///    |> line(end = [10, 10])
///    |> line(end = [10, 0])
///    |> close()
///    |> extrude(length = 10)
/// ```
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(-XZ)
///   |> startProfile(at = [0, 0])
///   |> line(end = [10, 0])
///   |> line(end = [0, 10])
///   |> close()
///
/// example = extrude(exampleSketch, length = 10)
/// ```
@(impl = std_rust, feature_tree = false)
export fn close(
  /// The sketch you want to close.
  @sketch: Sketch,
  /// Create a new tag which refers to this line.
  tag?: TagDecl,
): Sketch {}

/// Draw a curved line segment along an imaginary circle.
///
/// This is part of sketch v1 and is soft deprecated in favor of
/// [sketch-solve](/docs/kcl-std/modules/std-solver).
///
/// The arc is constructed such that the current position of the sketch is
/// placed along an imaginary circle of the specified radius, at angleStart
/// degrees. The resulting arc is the segment of the imaginary circle from
/// that origin point to angleEnd, radius away from the center of the imaginary
/// circle.
///
/// Unless this makes a lot of sense and feels like what you're looking
/// for to construct your shape, you're likely looking for tangentialArc.
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> line(end = [10, 0])
///   |> arc(
///        angleStart = 0,
///        angleEnd = 280deg,
///        radius = 16
///      )
///   |> close()
/// example = extrude(exampleSketch, length = 10)
/// ```
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> arc(
///         endAbsolute = [10,0],
///         interiorAbsolute = [5,5]
///      )
///   |> close()
/// example = extrude(exampleSketch, length = 10)
/// ```
@(impl = std_rust, feature_tree = false)
export fn arc(
  /// Which sketch should this path be added to?
  @sketch: Sketch,
  /// Where along the circle should this arc start?
  @(includeInSnippet = true)
  angleStart?: number(Angle),
  /// Where along the circle should this arc end?
  @(includeInSnippet = true)
  angleEnd?: number(Angle),
  /// How large should the circle be? Incompatible with `diameter`.
  radius?: number(Length),
  /// How large should the circle be? Incompatible with `radius`.
  @(includeInSnippet = true)
  diameter?: number(Length),
  /// Any point between the arc's start and end? Requires `endAbsolute`. Incompatible with `angleStart` or `angleEnd`.
  interiorAbsolute?: Point2d,
  /// Where should this arc end? Requires `interiorAbsolute`. Incompatible with `angleStart` or `angleEnd`.
  endAbsolute?: Point2d,
  /// Create a new tag which refers to this arc.
  tag?: TagDecl,
): Sketch {}

/// Starting at the current sketch's origin, draw a curved line segment along
/// some part of an imaginary circle until it reaches the desired (x, y)
/// coordinates.
///
/// This is part of sketch v1 and is soft deprecated in favor of
/// [sketch-solve](/docs/kcl-std/modules/std-solver).
///
/// When using radius and angle, draw a curved line segment along part of an
/// imaginary circle. The arc is constructed such that the last line segment is
/// placed tangent to the imaginary circle of the specified radius. The
/// resulting arc is the segment of the imaginary circle from that tangent point
/// for 'angle' degrees along the imaginary circle.
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> angledLine(
///     angle = 45deg,
///     length = 10,
///   )
///   |> tangentialArc(end = [0, -10])
///   |> line(end = [-10, 0])
///   |> close()
///
/// example = extrude(exampleSketch, length = 10)
/// ```
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> angledLine(
///     angle = 60deg,
///     length = 10,
///   )
///   |> tangentialArc(endAbsolute = [15, 15])
///   |> line(end = [10, -15])
///   |> close()
///
/// example = extrude(exampleSketch, length = 10)
/// ```
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> angledLine(
///     angle = 60deg,
///     length = 10,
///   )
///   |> tangentialArc(radius = 10, angle = -120deg)
///   |> angledLine(
///     angle = -60deg,
///     length = 10,
///   )
///   |> close()
///
/// example = extrude(exampleSketch, length = 10)
/// ```
@(impl = std_rust, feature_tree = false)
export fn tangentialArc(
  /// Which sketch should this path be added to?
  @sketch: Sketch,
  /// Which absolute point should this arc go to? Incompatible with `end`, `radius`, and `offset`.
  endAbsolute?: Point2d,
  /// How far away (along the X and Y axes) should this arc go? Incompatible with `endAbsolute`, `radius`, and `offset`.
  @(includeInSnippet = true)
  end?: Point2d,
  /// Radius of the imaginary circle. `angle` must be given. Incompatible with `end` and `endAbsolute` and `diameter`.
  radius?: number(Length),
  /// Diameter of the imaginary circle. `angle` must be given. Incompatible with `end` and `endAbsolute` and `radius`.
  diameter?: number(Length),
  /// Offset of the arc. `radius` must be given. Incompatible with `end` and `endAbsolute`.
  angle?: number(Angle),
  /// Create a new tag which refers to this arc.
  tag?: TagDecl,
): Sketch {}

/// Draw a smooth, continuous, curved line segment from the current origin to
/// the desired (x, y), using a number of control points to shape the curve's
/// shape.
///
/// This is part of sketch v1 and is soft deprecated in favor of
/// [sketch-solve](/docs/kcl-std/modules/std-solver). The sketch-solve version
/// of bezier curve is still under development.
///
/// ```kcl,legacySketch
/// // Example using relative control points.
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> line(end = [0, 10])
///   |> bezierCurve(
///        control1 = [5, 0],
///        control2 = [5, 10],
///        end = [10, 10],
///      )
///   |> line(endAbsolute = [10, 0])
///   |> close()
///
/// example = extrude(exampleSketch, length = 10)
/// ```
///
/// ```kcl,legacySketch
/// // Example using absolute control points.
/// startSketchOn(XY)
///   |> startProfile(at = [300, 300])
///   |> bezierCurve(control1Absolute = [600, 300], control2Absolute = [-300, -100], endAbsolute = [600, 600])
///   |> close()
///   |> extrude(length = 10)
/// ```
@(impl = std_rust, feature_tree = false)
export fn bezierCurve(
  /// Which sketch should this path be added to?
  @sketch: Sketch,
  /// First control point for the cubic.
  control1?: Point2d,
  /// Second control point for the cubic.
  control2?: Point2d,
  /// How far away (along the X and Y axes) should this line go?
  end?: Point2d,
  /// First control point for the cubic. Absolute point.
  control1Absolute?: Point2d,
  /// Second control point for the cubic. Absolute point.
  control2Absolute?: Point2d,
  /// Coordinate on the plane at which this line should end.
  endAbsolute?: Point2d,
  /// Create a new tag which refers to this line.
  tag?: TagDecl,
): Sketch {}

/// Use a 2-dimensional sketch to cut a hole in another 2-dimensional sketch.
///
/// This is part of sketch v1 and is soft deprecated in favor of
/// [sketch-solve](/docs/kcl-std/modules/std-solver).
///
/// ```kcl,legacySketch
/// exampleSketch = startSketchOn(XY)
///   |> startProfile(at = [0, 0])
///   |> line(end = [0, 5])
///   |> line(end = [5, 0])
///   |> line(end = [0, -5])
///   |> close()
///   |> subtract2d(tool =circle( center = [1, 1], radius = .25 ))
///   |> subtract2d(tool =circle( center = [1, 4], radius = .25 ))
///
/// example = extrude(exampleSketch, length = 1)
/// ```
///
/// ```kcl,legacySketch
/// fn squareHoleSketch() {
///   squareSketch = startSketchOn(-XZ)
///     |> startProfile(at = [-1, -1])
///     |> line(end = [2, 0])
///     |> line(end = [0, 2])
///     |> line(end = [-2, 0])
///     |> close()
///   return squareSketch
/// }
///
/// exampleSketch = startSketchOn(-XZ)
///     |> circle( center = [0, 0], radius = 3 )
///     |> subtract2d(tool = squareHoleSketch())
/// example = extrude(exampleSketch, length = 1)
/// ```
@(impl = std_rust, feature_tree = true)
export fn subtract2d(
  /// Which sketch should this path be added to?
  @sketch: Sketch,
  /// The shape(s) which should be cut out of the sketch.
  tool: [Sketch; 1+],
): Sketch {}

/// Add a conic section to an existing sketch.
///
/// This is part of sketch v1 and is soft deprecated in favor of
/// [sketch-solve](/docs/kcl-std/modules/std-solver). The sketch-solve version
/// of conic is still under development.
///
/// ```kcl,legacySketch
/// @settings(experimentalFeatures = allow)
///
/// exampleSketch = startSketchOn(XZ)
///   |> startProfile(at = [0, 0])
///   |> conic(
///         end = [20,0],
///         endTangent = [1,1],
///         interior = [5,5],
///         startTangent = [0, -1],
///      )
///   |> close()
/// example = extrude(exampleSketch, length = 10)
/// ```
@(impl = std_rust, experimental = true, feature_tree = true)
export fn conic(
  /// Which sketch should this path be added to?
  @sketch: Sketch,
  /// Any point between the segment's start and end. Requires `endAbsolute`. Incompatible with `interior` or `end`.
  interiorAbsolute?: Point2d,
  /// Where should this segment end? Requires `interiorAbsolute`. Incompatible with `interior` or `end`.
  endAbsolute?: Point2d,
  /// Any point between the segment's start and end. This point is relative to the start point. Requires `end`. Incompatible with `interiorAbsolute` or `endAbsolute`.
  interior?: Point2d,
  /// Where should this segment end? This point is relative to the start point. Requires `interior`. Incompatible with `interiorAbsolute` or `endAbsolute`.
  end?: Point2d,
  /// The coefficients [a, b, c, d, e, f] of the generic conic equation ax^2 + by^2 + cxy + dx + ey + f = 0. If provided the start and end tangents will be calculated using this equation. Incompatible with `startTangent` and `endTangent`.
  coefficients?: [number; 6],
  /// The tangent of the conic section at the start. If not provided the tangent of the previous path segment is used. Incompatible with `coefficients`.
  startTangent?: Point2d,
  /// The tangent of the conic section at the end. Incompatible with `coefficients`.
  endTangent?: Point2d,
  /// Create a new tag which refers to this segment.
  tag?: TagDecl,
  ): Sketch {}

/// Add a parabolic segment to an existing sketch.
///
/// This is part of sketch v1 and is soft deprecated in favor of
/// [sketch-solve](/docs/kcl-std/modules/std-solver). The sketch-solve version
/// of parabolic is still under development.
///
/// ```kcl,legacySketch
/// @settings(experimentalFeatures = allow)
///
/// exampleSketch = startSketchOn(XY)
///   |> startProfile(at = [0,0])
///   |> parabolic(
///         end = [10,0],
///         coefficients = [2, 0, 0],
///   )
///   |>close()
///```
@(impl = std_rust, experimental = true, feature_tree = true)
export fn parabolic(
  /// Which sketch should this path be added to?
  @sketch: Sketch,
  /// Where should the path end? Relative to the start point. Incompatible with `interiorAbsolute` or `endAbsolute`.
  end: Point2d,
  /// Where should this segment end? Requires `interiorAbsolute`. Incompatible with `interior` or `end`.
  endAbsolute?: Point2d,
  /// The coefficients [a, b, c] of the parabolic equation y = ax^2 + bx + c. Incompatible with `interior`.
  coefficients?: [number; 3],
  /// A point between the segment's start and end that lies on the parabola. Incompatible with `coefficients` or `interiorAbsolute` or `endAbsolute`.
  interior?: Point2d,
  /// Any point between the segment's start and end. Requires `endAbsolute`. Incompatible with `coefficients` or `interior` or `end`.
  interiorAbsolute?: Point2d,
  /// Create a new tag which refers to this segment.
  tag?: TagDecl,
): Sketch {}

/// Calculate the point (x, y) on a parabola given x or y and the coefficients [a, b, c] of the parabola.
///
/// ```kcl,sketchSyntaxAgnostic
/// point001 = parabolicPoint(x = 5, coefficients = [0.1, 0, 0])
/// point002 = parabolicPoint(y = 2.5, coefficients = [0.1, 0, 0])
/// assert(point001[0], isEqualTo = point002[0])
/// assert(point001[1], isEqualTo = point002[1])
///```
@(impl = std_rust, feature_tree = false)
export fn parabolicPoint(
  /// The coefficients [a, b, c] of the parabolic equation y = ax^2 + bx + c.
  coefficients: [number; 3],
  /// The x value. Calculates y and returns (x, y). Incompatible with `y`.
  x?: number(Length),
  /// The y value. Calculates x and returns (x, y). Incompatible with `x`.
  y?: number(Length),
): Point2d {}

/// Add a hyperbolic section to an existing sketch.
///
/// This is part of sketch v1 and is soft deprecated in favor of
/// [sketch-solve](/docs/kcl-std/modules/std-solver). The sketch-solve version
/// of hyperbolic is still under development.
///
/// ```kcl,legacySketch
/// @settings(experimentalFeatures = allow)
///
/// exampleSketch = startSketchOn(XY)
///   |> startProfile(at = [0,0])
///   |> hyperbolic(
///         end = [10,0],
///         semiMajor = 2,
///         semiMinor = 1,
///         interior = [0,0]
///   )
///   |>close()
///```
@(impl = std_rust, experimental = true, feature_tree = true)
export fn hyperbolic(
  /// Which sketch should this path be added to?
  @sketch: Sketch,
  /// The semi major value, a, of the hyperbolic equation x^2 / a ^ 2 - y^2 / b^2 = 1.
  semiMajor: number(Length),
  ///  The semi minor value, b, of the hyperbolic equation x^2 / a ^ 2 - y^2 / b^2 = 1.
  semiMinor: number(Length),
  /// Any point between the segment's start and end. Requires `endAbsolute`. Incompatible with `interior` or `end`.
  interiorAbsolute?: Point2d,
  /// Where should this segment end? Requires `interiorAbsolute`. Incompatible with `interior` or `end`.
  endAbsolute?: Point2d,
  /// Any point between the segment's start and end. This point is relative to the start point. Requires `end`. Incompatible with `interiorAbsolute` or `endAbsolute`.
  interior?: Point2d,
  /// Where should this segment end? This point is relative to the start point. Requires `interior`. Incompatible with `interiorAbsolute` or `endAbsolute`.
  end?: Point2d,
  /// Create a new tag which refers to this arc.
  tag?: TagDecl,
): Sketch {}

/// Calculate the point (x, y) on a hyperbola given x or y and the semi major/minor values of the hyperbolic.
///
/// ```kcl,sketchSyntaxAgnostic
/// point = hyperbolicPoint(x = 5, semiMajor = 2, semiMinor = 1)
///```
@(impl = std_rust, feature_tree = false)
export fn hyperbolicPoint(
  /// The semi major value, a, of the hyperbolic equation x^2 / a ^ 2 - y^2 / b^2 = 1.
  semiMajor: number,
  ///  The semi minor value, b, of the hyperbolic equation x^2 / a ^ 2 - y^2 / b^2 = 1.
  semiMinor: number,
  /// The x value. Calculates y and returns (x, y). Incompatible with `y`.
  x?: number(Length),
  /// The y value. Calculates x and returns (x, y). Incompatible with `x`.
  y?: number(Length),
): Point2d {}

/// Add an elliptic section to an existing sketch.
///
/// This is part of sketch v1 and is soft deprecated in favor of
/// [sketch-solve](/docs/kcl-std/modules/std-solver). The sketch-solve version
/// of elliptic is still under development.
///
/// ```kcl,legacySketch
/// @settings(experimentalFeatures = allow)
///
/// majorRadius = 2
/// minorRadius = 1
/// ellip = ellipticPoint(majorRadius, minorRadius, x = 2)
///
/// exampleSketch = startSketchOn(XY)
///    |> startProfile(at = ellip, tag = $start)
///    |> elliptic(center = [0, 0], angleStart = segAng(start), angleEnd = 160deg, majorRadius, minorRadius)
///    |> close()
/// example = extrude(exampleSketch, length = 10)
/// ```
@(impl = std_rust, experimental = true, feature_tree = true)
export fn elliptic(
  /// Which sketch should this path be added to?
  @sketch: Sketch,
  /// The center of the ellipse.
  @(snippetArray = ["0", "0"])
  center: Point2d,
  /// Where along the ellptic should this segment start?
  @(includeInSnippet = true)
  angleStart: number(Angle),
  /// Where along the ellptic should this segment end?
  @(includeInSnippet = true)
  angleEnd: number(Angle),
  /// The minor radius, b, of the elliptic equation x^2 / a^2 + y^2 / b^2 = 1.
  @(includeInSnippet = true)
  minorRadius: number(Length),
  /// The major radius, a, of the elliptic equation x^2 / a^2 + y^2 / b^2 = 1. Equivalent to majorAxis = [majorRadius, 0].
  majorRadius?: number(Length),
  /// The major axis of the elliptic.
  @(includeInSnippet = true)
  majorAxis?: Point2d,
  /// Create a new tag which refers to this arc.
  tag?: TagDecl,
): Sketch {}

/// Calculate the point (x, y) on an ellipse given x or y and the center and major/minor radii of the ellipse.
///
/// ```kcl,sketchSyntaxAgnostic
/// point001 = ellipticPoint(x = 2, majorRadius = 2, minorRadius = 1)
/// point002 = ellipticPoint(y = 0, majorRadius = 2, minorRadius = 1)
/// assert(point001[0], isEqualTo = point002[0])
/// assert(point001[1], isEqualTo = point002[1])
///```
@(impl = std_rust, feature_tree = false)
export fn ellipticPoint(
  /// The major radius, a, of the elliptic equation x^2 / a ^ 2 + y^2 / b^2 = 1.
  majorRadius: number,
  ///  The minor radius, b, of the hyperbolic equation x^2 / a ^ 2 + y^2 / b^2 = 1.
  minorRadius: number,
  /// The x value. Calculates y and returns (x, y). Incompatible with `y`.
  x?: number(Length),
  /// The y value. Calculates x and returns (x, y). Incompatible with `x`.
  y?: number(Length),
): Point2d {}

/// Find the plane a face lies on.
/// Returns an error if the face doesn't lie on any plane (for example, the curved face of a cylinder)
///```kcl,legacySketch
/// triangle = startSketchOn(XY)
/// |> polygon(radius = 3, numSides = 3, center = [0, 0])
/// |> extrude(length = 2)
///
/// // Find the plane of the triangle's top face.
/// topPlane = planeOf(triangle, face = END)
///
/// // Create a new plane, above the triangle's top face.
/// startSketchOn(offsetPlane(topPlane, offset = 2))
/// |> circle(radius = 1, center = [0,0])
/// |> extrude(length = 1)
/// ```
/// ```kcl,sketchSolve
/// baseProfile = sketch(on = XY) {
///   line1 = line(start = [var 0mm, var 0mm], end = [var 6mm, var 0mm])
///   line2 = line(start = [var 6mm, var 0mm], end = [var 6mm, var 4mm])
///   line3 = line(start = [var 6mm, var 4mm], end = [var 0mm, var 4mm])
///   line4 = line(start = [var 0mm, var 4mm], end = [var 0mm, var 0mm])
///   coincident([line1.end, line2.start])
///   coincident([line2.end, line3.start])
///   coincident([line3.end, line4.start])
///   coincident([line4.end, line1.start])
///   horizontal(line1)
///   vertical(line2)
///   horizontal(line3)
///   vertical(line4)
/// }
///
/// baseRegion = region(point = [3mm, 2mm], sketch = baseProfile)
/// block = extrude(baseRegion, length = 4mm, tagEnd = $top)
/// sidePlane = planeOf(block, face = top)
///
/// rib = startSketchOn(offsetPlane(sidePlane, offset = 1mm))
///   |> startProfile(at = [0mm, 0mm])
///   |> line(end = [2mm, 0mm])
///   |> line(end = [0mm, 1mm])
///   |> line(end = [-2mm, 0mm])
///   |> close()
///   |> extrude(length = 1mm)
/// ```
@(impl = std_rust, feature_tree = false)
export fn planeOf(
  /// The solid whose face is being queried.
  @solid: Solid,
  /// Find the plane which this face lies on.
  face: TaggedFace | Segment,
): Plane {}

/// Get the face of a solid.
///```kcl,sketchSolve
/// triangle = startSketchOn(XY)
///   |> startProfile(at = [0, 0])
///   |> line(end = [2, 0])
///   |> line(end = [0, 2], tag = $side)
///   |> line(end = [-2, -2])
///   |> close()
///   |> extrude(length = 2)
///
/// // Get the face of the triangle's side face.
/// sideFace = faceOf(triangle, face = side)
///
/// // Create a new sketch, on the triangle's side face.
/// //sketch(on = sideFace) {}
/// ```
/// ```kcl,sketchSolve
/// triangle = sketch(on = XY) {
///   line1 = line(start = [var -0.05mm, var -0.01mm], end = [var 3.88mm, var 0.81mm])
///   line2 = line(start = [var 3.88mm, var 0.81mm], end = [var 0.92mm, var 4.67mm])
///   coincident([line1.end, line2.start])
///   line3 = line(start = [var 0.92mm, var 4.67mm], end = [var -0.03mm, var -0.04mm])
///   coincident([line2.end, line3.start])
///   coincident([line1.start, line3.end])
///   horizontal(line1)
///   equalLength([line2, line3])
/// }
///
/// triangleRegion = region(point = [1.86mm, 3.82mm], sketch = triangle)
/// prism = extrude(triangleRegion, length = 2)
///
/// face001 = faceOf(prism, face = triangleRegion.tags.line1)
/// ```
@(impl = std_rust, feature_tree = false)
export fn faceOf(
  /// The solid that has the face.
  @solid: Solid,
  /// Which face of the solid.
  face: TaggedFace | Segment,
): Face {}

/// Create a region from closed segments.
///
/// Form the region from sketch block segments that have a given point within a
/// closed boundary. When using a 2D point, not a point from the sketch, the
/// `sketch` parameter is required to specify which sketch the region is from.
///
/// Alternatively, form the region by tracing the first segment from its start
/// point to the intersection with the second segment, and turn at each
/// intersection using the `direction` until returning back to the first
/// segment.
///
/// Important: Creating a region using the `segments` parameter is currently
/// only supported when there is a single closed region in the sketch. If the
/// sketch may have multiple regions, use the `point` parameter instead. Until
/// this limitation is lifted, using a point to select a region is preferred.
///
/// To help allow the region's point to move with the sketch, which may be
/// created parametrically, consider creating a construction point in the sketch
/// and constraining it into place. Then you can refer to the point to create
/// the region.
///
/// ```kcl,sketchSolve
/// triangle = sketch(on = XY) {
///   line1 = line(start = [var -0.05mm, var -0.01mm], end = [var 3.88mm, var 0.81mm])
///   line2 = line(start = [var 3.88mm, var 0.81mm], end = [var 0.92mm, var 4.67mm])
///   coincident([line1.end, line2.start])
///   line3 = line(start = [var 0.92mm, var 4.67mm], end = [var -0.03mm, var -0.04mm])
///   coincident([line2.end, line3.start])
///   coincident([line1.start, line3.end])
///   horizontal(line1)
///   equalLength([line2, line3])
/// }
///
/// r = region(point = [0.5mm, 0.5mm], sketch = triangle)
/// extrude(r, length = 5)
/// ```
///
/// ```kcl,sketchSolve
/// trapezoid = sketch(on = XY) {
///   line1 = line(start = [var 0mm, var 0mm], end = [var 4mm, var 0mm])
///   line2 = line(start = [var 4mm, var 0mm], end = [var 4mm, var 3mm])
///   line3 = line(start = [var 4mm, var 3mm], end = [var 0mm, var 3mm])
///   line4 = line(start = [var 0mm, var 3mm], end = [var 0mm, var 0mm])
///   coincident([line1.end, line2.start])
///   coincident([line2.end, line3.start])
///   coincident([line3.end, line4.start])
///   coincident([line4.end, line1.start])
///   vertical(line2)
///   horizontal(line3)
///   parallel([line1, line3])
/// }
///
/// r = region(point = [1mm, 1mm], sketch = trapezoid)
/// extrude(r, length = 3)
/// ```
///
/// ```kcl,sketchSolve
/// s = sketch(on = XY) {
///   line1 = line(start = [var -5mm, var 0mm], end = [var 5mm, var 0mm])
///   arc1 = arc(start = [var 5mm, var 0mm], end = [var -5mm, var 0mm], center = [var 0mm, var 6mm])
///   coincident([line1.end, arc1.start])
///   coincident([line1.start, arc1.end])
/// }
///
/// r = region(point = s.arc1.center)
/// extrude(r, length = 2)
/// ```
@(impl = std_rust, feature_tree = true)
export fn region(
  /// A point that is within the region's boundary.
  point?: Point2d | Segment,
  /// The first two segments that form the region's boundary. In case of a circle, the one circle segment that forms the region.
  /// This parameter is currently only supported when there is only one region
  /// in the sketch. If the sketch may have multiple regions, use the `point`
  /// parameter instead.
  segments?: [Segment; 1+],
  /// Index of the intersection of the first segment with the second segment to
  /// use as the region's boundary. The default is `-1`, which uses the last
  /// intersection. This is only used when the `segments` argument is provided.
  intersectionIndex?: number(Count),
  /// `CCW` for counterclockwise, `CW` for clockwise. Default is `CCW`. This is
  /// only used when the `segments` argument is provided.
  direction?: string = "ccw",
  /// The sketch that the region is from. This is required when point is a `Point2d`.
  sketch?: any,
): Sketch {}