Skip to content

Commit d54b4e8

Browse files
committed
Change KCL docs to use startProfile() with explicit argument
1 parent 3297f23 commit d54b4e8

File tree

2 files changed

+96
-131
lines changed

2 files changed

+96
-131
lines changed

rust/kcl-lib/std/solid.kcl

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ import Face from "std::types"
1919
/// filletRadius = 2
2020
///
2121
/// mountingPlateSketch = startSketchOn(XY)
22-
/// |> startProfile(at = [-width/2, -length/2])
22+
/// mountingPlateProfile = startProfile(mountingPlateSketch, at = [-width/2, -length/2])
2323
/// |> line(endAbsolute = [width/2, -length/2], tag = $edge1)
2424
/// |> line(endAbsolute = [width/2, length/2], tag = $edge2)
2525
/// |> line(endAbsolute = [-width/2, length/2], tag = $edge3)
2626
/// |> close(tag = $edge4)
2727
///
28-
/// mountingPlate = extrude(mountingPlateSketch, length = thickness)
28+
/// mountingPlate = extrude(mountingPlateProfile, length = thickness)
2929
/// |> fillet(
3030
/// radius = filletRadius,
3131
/// tags = [
@@ -44,13 +44,13 @@ import Face from "std::types"
4444
/// filletRadius = 1
4545
///
4646
/// mountingPlateSketch = startSketchOn(XY)
47-
/// |> startProfile(at = [-width/2, -length/2])
47+
/// mountingPlateProfile = startProfile(mountingPlateSketch, at = [-width/2, -length/2])
4848
/// |> line(endAbsolute = [width/2, -length/2], tag = $edge1)
4949
/// |> line(endAbsolute = [width/2, length/2], tag = $edge2)
5050
/// |> line(endAbsolute = [-width/2, length/2], tag = $edge3)
5151
/// |> close(tag = $edge4)
5252
///
53-
/// mountingPlate = extrude(mountingPlateSketch, length = thickness)
53+
/// mountingPlate = extrude(mountingPlateProfile, length = thickness)
5454
/// |> fillet(
5555
/// radius = filletRadius,
5656
/// tolerance = 0.000001,
@@ -90,13 +90,13 @@ export fn fillet(
9090
/// chamferLength = 2
9191
///
9292
/// mountingPlateSketch = startSketchOn(XY)
93-
/// |> startProfile(at = [-width/2, -length/2])
93+
/// mountingPlateProfile = startProfile(mountingPlateSketch, at = [-width/2, -length/2])
9494
/// |> line(endAbsolute = [width/2, -length/2], tag = $edge1)
9595
/// |> line(endAbsolute = [width/2, length/2], tag = $edge2)
9696
/// |> line(endAbsolute = [-width/2, length/2], tag = $edge3)
9797
/// |> close(tag = $edge4)
9898
///
99-
/// mountingPlate = extrude(mountingPlateSketch, length = thickness)
99+
/// mountingPlate = extrude(mountingPlateProfile, length = thickness)
100100
/// |> chamfer(
101101
/// length = chamferLength,
102102
/// tags = [
@@ -111,13 +111,13 @@ export fn fillet(
111111
/// ```
112112
/// // Sketch on the face of a chamfer.
113113
/// fn cube(pos, scale) {
114-
/// sg = startSketchOn(XY)
115-
/// |> startProfile(at = pos)
114+
/// cubeSketch = startSketchOn(XY)
115+
/// cubeProfile = startProfile(cubeSketch, at = pos)
116116
/// |> line(end = [0, scale])
117117
/// |> line(end = [scale, 0])
118118
/// |> line(end = [0, -scale])
119119
///
120-
/// return sg
120+
/// return cubeProfile
121121
/// }
122122
///
123123
/// part001 = cube(pos = [0,0], scale = 20)
@@ -131,7 +131,7 @@ export fn fillet(
131131
/// )
132132
///
133133
/// sketch001 = startSketchOn(part001, face = chamfer1)
134-
/// |> startProfile(at = [10, 10])
134+
/// profile001 = startProfile(sketch001, at = [10, 10])
135135
/// |> line(end = [2, 0])
136136
/// |> line(end = [0, 2])
137137
/// |> line(end = [-2, 0])
@@ -414,7 +414,7 @@ export fn hollow(
414414
///
415415
/// // Sketch 4 cylinders.
416416
/// sketch001 = startSketchOn(XZ)
417-
/// |> circle(center = [0, 0], radius = 2)
417+
/// extrude001 = circle(sketch001, center = [0, 0], radius = 2)
418418
/// |> extrude(length = 5)
419419
/// |> patternTransform(instances = 4, transform = transform)
420420
/// ```
@@ -428,7 +428,7 @@ export fn hollow(
428428
/// }
429429
///
430430
/// sketch001 = startSketchOn(XZ)
431-
/// |> circle(center = [0, 0], radius = 2)
431+
/// extrude001 = circle(sketch001, center = [0, 0], radius = 2)
432432
/// |> extrude(length = 5)
433433
/// |> patternTransform(instances = 4, transform = transform)
434434
/// ```
@@ -572,13 +572,13 @@ export fn patternTransform(
572572
/// /// Pattern using a named axis.
573573
///
574574
/// exampleSketch = startSketchOn(XZ)
575-
/// |> startProfile(at = [0, 0])
575+
/// exampleProfile = startProfile(exampleSketch, at = [0, 0])
576576
/// |> line(end = [0, 2])
577577
/// |> line(end = [3, 1])
578578
/// |> line(end = [0, -4])
579579
/// |> close()
580580
///
581-
/// example = extrude(exampleSketch, length = 1)
581+
/// example = extrude(exampleProfile, length = 1)
582582
/// |> patternLinear3d(
583583
/// axis = X,
584584
/// instances = 7,
@@ -590,13 +590,13 @@ export fn patternTransform(
590590
/// /// Pattern using a raw axis.
591591
///
592592
/// exampleSketch = startSketchOn(XZ)
593-
/// |> startProfile(at = [0, 0])
593+
/// exampleProfile = startProfile(exampleSketch, at = [0, 0])
594594
/// |> line(end = [0, 2])
595595
/// |> line(end = [3, 1])
596596
/// |> line(end = [0, -4])
597597
/// |> close()
598598
///
599-
/// example = extrude(exampleSketch, length = 1)
599+
/// example = extrude(exampleProfile, length = 1)
600600
/// |> patternLinear3d(
601601
/// axis = [1, 0, 1],
602602
/// instances = 7,
@@ -607,8 +607,8 @@ export fn patternTransform(
607607
/// ```kcl
608608
/// // Pattern a whole sketch on face.
609609
/// size = 100
610-
/// case = startSketchOn(XY)
611-
/// |> startProfile(at = [-size, -size])
610+
/// caseSketch = startSketchOn(XY)
611+
/// case = startProfile(caseSketch, at = [-size, -size])
612612
/// |> line(end = [2 * size, 0])
613613
/// |> line(end = [0, 2 * size])
614614
/// |> tangentialArc(endAbsolute = [-size, size])
@@ -635,8 +635,8 @@ export fn patternTransform(
635635
/// ```kcl
636636
/// // Pattern an object on a face.
637637
/// size = 100
638-
/// case = startSketchOn(XY)
639-
/// |> startProfile(at = [-size, -size])
638+
/// caseSketch = startSketchOn(XY)
639+
/// case = startProfile(caseSketch, at = [-size, -size])
640640
/// |> line(end = [2 * size, 0])
641641
/// |> line(end = [0, 2 * size])
642642
/// |> tangentialArc(endAbsolute = [-size, size])
@@ -732,8 +732,8 @@ export fn patternCircular3d(
732732
/// // Union two cubes using the stdlib functions.
733733
///
734734
/// fn cube(center, size) {
735-
/// return startSketchOn(XY)
736-
/// |> startProfile(at = [center[0] - size, center[1] - size])
735+
/// cubeSketch = startSketchOn(XY)
736+
/// return startProfile(cubeSketch, at = [center[0] - size, center[1] - size])
737737
/// |> line(endAbsolute = [center[0] + size, center[1] - size])
738738
/// |> line(endAbsolute = [center[0] + size, center[1] + size])
739739
/// |> line(endAbsolute = [center[0] - size, center[1] + size])
@@ -754,8 +754,8 @@ export fn patternCircular3d(
754754
/// // Codemods will generate the stdlib function call instead.
755755
///
756756
/// fn cube(center, size) {
757-
/// return startSketchOn(XY)
758-
/// |> startProfile(at = [center[0] - size, center[1] - size])
757+
/// cubeSketch = startSketchOn(XY)
758+
/// return startProfile(cubeSketch, at = [center[0] - size, center[1] - size])
759759
/// |> line(endAbsolute = [center[0] + size, center[1] - size])
760760
/// |> line(endAbsolute = [center[0] + size, center[1] + size])
761761
/// |> line(endAbsolute = [center[0] - size, center[1] + size])
@@ -777,8 +777,8 @@ export fn patternCircular3d(
777777
/// // Codemods will generate the stdlib function call instead.
778778
///
779779
/// fn cube(center, size) {
780-
/// return startSketchOn(XY)
781-
/// |> startProfile(at = [center[0] - size, center[1] - size])
780+
/// cubeSketch = startSketchOn(XY)
781+
/// return startProfile(cubeSketch, at = [center[0] - size, center[1] - size])
782782
/// |> line(endAbsolute = [center[0] + size, center[1] - size])
783783
/// |> line(endAbsolute = [center[0] + size, center[1] + size])
784784
/// |> line(endAbsolute = [center[0] - size, center[1] + size])
@@ -815,8 +815,8 @@ export fn union(
815815
/// // Intersect two cubes using the stdlib functions.
816816
///
817817
/// fn cube(center, size) {
818-
/// return startSketchOn(XY)
819-
/// |> startProfile(at = [center[0] - size, center[1] - size])
818+
/// cubeSketch = startSketchOn(XY)
819+
/// return startProfile(cubeSketch, at = [center[0] - size, center[1] - size])
820820
/// |> line(endAbsolute = [center[0] + size, center[1] - size])
821821
/// |> line(endAbsolute = [center[0] + size, center[1] + size])
822822
/// |> line(endAbsolute = [center[0] - size, center[1] + size])
@@ -837,8 +837,8 @@ export fn union(
837837
/// // Codemods will generate the stdlib function call instead.
838838
///
839839
/// fn cube(center, size) {
840-
/// return startSketchOn(XY)
841-
/// |> startProfile(at = [center[0] - size, center[1] - size])
840+
/// cubeSketch = startSketchOn(XY)
841+
/// return startProfile(cubeSketch, at = [center[0] - size, center[1] - size])
842842
/// |> line(endAbsolute = [center[0] + size, center[1] - size])
843843
/// |> line(endAbsolute = [center[0] + size, center[1] + size])
844844
/// |> line(endAbsolute = [center[0] - size, center[1] + size])
@@ -873,8 +873,8 @@ export fn intersect(
873873
/// // Subtract a cylinder from a cube using the stdlib functions.
874874
///
875875
/// fn cube(center, size) {
876-
/// return startSketchOn(XY)
877-
/// |> startProfile(at = [center[0] - size, center[1] - size])
876+
/// cubeSketch = startSketchOn(XY)
877+
/// return startProfile(cubeSketch, at = [center[0] - size, center[1] - size])
878878
/// |> line(endAbsolute = [center[0] + size, center[1] - size])
879879
/// |> line(endAbsolute = [center[0] + size, center[1] + size])
880880
/// |> line(endAbsolute = [center[0] - size, center[1] + size])
@@ -895,8 +895,8 @@ export fn intersect(
895895
/// // Codemods will generate the stdlib function call instead.
896896
///
897897
/// fn cube(center, size) {
898-
/// return startSketchOn(XY)
899-
/// |> startProfile(at = [center[0] - size, center[1] - size])
898+
/// cubeSketch = startSketchOn(XY)
899+
/// return startProfile(cubeSketch, at = [center[0] - size, center[1] - size])
900900
/// |> line(endAbsolute = [center[0] + size, center[1] - size])
901901
/// |> line(endAbsolute = [center[0] + size, center[1] + size])
902902
/// |> line(endAbsolute = [center[0] - size, center[1] + size])
@@ -928,21 +928,21 @@ export fn subtract(
928928
/// ```kcl
929929
/// // Add color to an extruded solid.
930930
/// exampleSketch = startSketchOn(XZ)
931-
/// |> startProfile(at = [0, 0])
931+
/// exampleProfile = startProfile(exampleSketch, at = [0, 0])
932932
/// |> line(endAbsolute = [10, 0])
933933
/// |> line(endAbsolute = [0, 10])
934934
/// |> line(endAbsolute = [-10, 0])
935935
/// |> close()
936936
///
937-
/// example = extrude(exampleSketch, length = 5)
937+
/// example = extrude(exampleProfile, length = 5)
938938
/// // There are other options besides 'color', but they're optional.
939939
/// |> appearance(color='#ff0000')
940940
/// ```
941941
///
942942
/// ```kcl
943943
/// // Add color to a revolved solid.
944944
/// sketch001 = startSketchOn(XY)
945-
/// |> circle( center = [15, 0], radius = 5 )
945+
/// profile001 = circle( sketch001, center = [15, 0], radius = 5 )
946946
/// |> revolve( angle = 360deg, axis = Y)
947947
/// |> appearance(
948948
/// color = '#ff0000',
@@ -954,13 +954,13 @@ export fn subtract(
954954
/// ```kcl
955955
/// // Add color to different solids.
956956
/// fn cube(center) {
957-
/// return startSketchOn(XY)
958-
/// |> startProfile(at = [center[0] - 10, center[1] - 10])
959-
/// |> line(endAbsolute = [center[0] + 10, center[1] - 10])
957+
/// cubeSketch = startSketchOn(XY)
958+
/// return startProfile(cubeSketch, at = [center[0] - 10, center[1] - 10])
959+
/// |> line(endAbsolute = [center[0] + 10, center[1] - 10])
960960
/// |> line(endAbsolute = [center[0] + 10, center[1] + 10])
961961
/// |> line(endAbsolute = [center[0] - 10, center[1] + 10])
962962
/// |> close()
963-
/// |> extrude(length = 10)
963+
/// |> extrude(length = 10)
964964
/// }
965965
///
966966
/// example0 = cube(center = [0, 0])
@@ -975,15 +975,15 @@ export fn subtract(
975975
/// // You can set the appearance before or after you shell it will yield the same result.
976976
/// // This example shows setting the appearance _after_ the shell.
977977
/// firstSketch = startSketchOn(XY)
978-
/// |> startProfile(at = [-12, 12])
978+
/// firstSolid = startProfile(firstSketch, at = [-12, 12])
979979
/// |> line(end = [24, 0])
980980
/// |> line(end = [0, -24])
981981
/// |> line(end = [-24, 0])
982982
/// |> close()
983983
/// |> extrude(length = 6)
984984
///
985985
/// shell(
986-
/// firstSketch,
986+
/// firstSolid,
987987
/// faces = [END],
988988
/// thickness = 0.25,
989989
/// )
@@ -1021,13 +1021,13 @@ export fn subtract(
10211021
/// // Setting the appearance of a 3D pattern can be done _before_ or _after_ the pattern.
10221022
/// // This example shows _before_ the pattern.
10231023
/// exampleSketch = startSketchOn(XZ)
1024-
/// |> startProfile(at = [0, 0])
1024+
/// exampleProfile = startProfile(exampleSketch, at = [0, 0])
10251025
/// |> line(end = [0, 2])
10261026
/// |> line(end = [3, 1])
10271027
/// |> line(end = [0, -4])
10281028
/// |> close()
10291029
///
1030-
/// example = extrude(exampleSketch, length = 1)
1030+
/// example = extrude(exampleProfile, length = 1)
10311031
/// |> appearance(
10321032
/// color = '#ff0000',
10331033
/// metalness = 90,

0 commit comments

Comments
 (0)