Kwargs: startProfileAt (#6424)
Previous: ``` startProfileAt([x, y], %) startProfileAt([x, y], sketch001) ``` New: ``` startProfile(%, at = [x, y]) startProfile(sketch001, at = [x, y]) ```
This commit is contained in:
@ -81,7 +81,7 @@ pub async fn appearance(exec_state: &mut ExecState, args: Args) -> Result<KclVal
|
||||
/// ```no_run
|
||||
/// // Add color to an extruded solid.
|
||||
/// exampleSketch = startSketchOn(XZ)
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(endAbsolute = [10, 0])
|
||||
/// |> line(endAbsolute = [0, 10])
|
||||
/// |> line(endAbsolute = [-10, 0])
|
||||
@ -108,7 +108,7 @@ pub async fn appearance(exec_state: &mut ExecState, args: Args) -> Result<KclVal
|
||||
/// // Add color to different solids.
|
||||
/// fn cube(center) {
|
||||
/// return startSketchOn(XY)
|
||||
/// |> startProfileAt([center[0] - 10, center[1] - 10], %)
|
||||
/// |> startProfile(at = [center[0] - 10, center[1] - 10])
|
||||
/// |> line(endAbsolute = [center[0] + 10, center[1] - 10])
|
||||
/// |> line(endAbsolute = [center[0] + 10, center[1] + 10])
|
||||
/// |> line(endAbsolute = [center[0] - 10, center[1] + 10])
|
||||
@ -128,7 +128,7 @@ pub async fn appearance(exec_state: &mut ExecState, args: Args) -> Result<KclVal
|
||||
/// // You can set the appearance before or after you shell it will yield the same result.
|
||||
/// // This example shows setting the appearance _after_ the shell.
|
||||
/// firstSketch = startSketchOn(XY)
|
||||
/// |> startProfileAt([-12, 12], %)
|
||||
/// |> startProfile(at = [-12, 12])
|
||||
/// |> line(end = [24, 0])
|
||||
/// |> line(end = [0, -24])
|
||||
/// |> line(end = [-24, 0])
|
||||
@ -151,7 +151,7 @@ pub async fn appearance(exec_state: &mut ExecState, args: Args) -> Result<KclVal
|
||||
/// // You can set the appearance before or after you shell it will yield the same result.
|
||||
/// // This example shows setting the appearance _before_ the shell.
|
||||
/// firstSketch = startSketchOn(XY)
|
||||
/// |> startProfileAt([-12, 12], %)
|
||||
/// |> startProfile(at = [-12, 12])
|
||||
/// |> line(end = [24, 0])
|
||||
/// |> line(end = [0, -24])
|
||||
/// |> line(end = [-24, 0])
|
||||
@ -174,7 +174,7 @@ pub async fn appearance(exec_state: &mut ExecState, args: Args) -> Result<KclVal
|
||||
/// // Setting the appearance of a 3D pattern can be done _before_ or _after_ the pattern.
|
||||
/// // This example shows _before_ the pattern.
|
||||
/// exampleSketch = startSketchOn(XZ)
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [0, 2])
|
||||
/// |> line(end = [3, 1])
|
||||
/// |> line(end = [0, -4])
|
||||
@ -197,7 +197,7 @@ pub async fn appearance(exec_state: &mut ExecState, args: Args) -> Result<KclVal
|
||||
/// // Setting the appearance of a 3D pattern can be done _before_ or _after_ the pattern.
|
||||
/// // This example shows _after_ the pattern.
|
||||
/// exampleSketch = startSketchOn(XZ)
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [0, 2])
|
||||
/// |> line(end = [3, 1])
|
||||
/// |> line(end = [0, -4])
|
||||
@ -219,7 +219,7 @@ pub async fn appearance(exec_state: &mut ExecState, args: Args) -> Result<KclVal
|
||||
/// ```no_run
|
||||
/// // Color the result of a 2D pattern that was extruded.
|
||||
/// exampleSketch = startSketchOn(XZ)
|
||||
/// |> startProfileAt([.5, 25], %)
|
||||
/// |> startProfile(at = [.5, 25])
|
||||
/// |> line(end = [0, 5])
|
||||
/// |> line(end = [-1, 0])
|
||||
/// |> line(end = [0, -5])
|
||||
@ -244,7 +244,7 @@ pub async fn appearance(exec_state: &mut ExecState, args: Args) -> Result<KclVal
|
||||
///
|
||||
/// // Create a path for the sweep.
|
||||
/// sweepPath = startSketchOn(XZ)
|
||||
/// |> startProfileAt([0.05, 0.05], %)
|
||||
/// |> startProfile(at = [0.05, 0.05])
|
||||
/// |> line(end = [0, 7])
|
||||
/// |> tangentialArc(angle = 90, radius = 5)
|
||||
/// |> line(end = [-3, 0])
|
||||
|
@ -659,10 +659,6 @@ impl Args {
|
||||
Ok((sketches, sketch))
|
||||
}
|
||||
|
||||
pub(crate) fn get_data_and_sketch_surface(&self) -> Result<([TyF64; 2], SketchSurface, Option<TagNode>), KclError> {
|
||||
FromArgs::from_args(self, 0)
|
||||
}
|
||||
|
||||
pub(crate) async fn get_adjacent_face_to_tag(
|
||||
&self,
|
||||
exec_state: &mut ExecState,
|
||||
|
@ -138,7 +138,7 @@ pub async fn reduce(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
||||
///
|
||||
/// // Start the decagon sketch at this point.
|
||||
/// startOfDecagonSketch = startSketchOn('XY')
|
||||
/// |> startProfileAt([(cos(0)*radius), (sin(0) * radius)], %)
|
||||
/// |> startProfile(at = [(cos(0)*radius), (sin(0) * radius)])
|
||||
///
|
||||
/// // Use a `reduce` to draw the remaining decagon sides.
|
||||
/// // For each number in the array 1..10, run the given function,
|
||||
@ -159,7 +159,7 @@ pub async fn reduce(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
||||
/// fn decagon(radius):
|
||||
/// stepAngle = (1/10) * TAU
|
||||
/// plane = startSketchOn('XY')
|
||||
/// startOfDecagonSketch = startProfileAt([(cos(0)*radius), (sin(0) * radius)], plane)
|
||||
/// startOfDecagonSketch = startProfile(plane, at = [(cos(0)*radius), (sin(0) * radius)])
|
||||
///
|
||||
/// // Here's the reduce part.
|
||||
/// partialDecagon = startOfDecagonSketch
|
||||
|
@ -46,7 +46,7 @@ pub async fn chamfer(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
||||
/// chamferLength = 2
|
||||
///
|
||||
/// mountingPlateSketch = startSketchOn(XY)
|
||||
/// |> startProfileAt([-width/2, -length/2], %)
|
||||
/// |> startProfile(at = [-width/2, -length/2])
|
||||
/// |> line(endAbsolute = [width/2, -length/2], tag = $edge1)
|
||||
/// |> line(endAbsolute = [width/2, length/2], tag = $edge2)
|
||||
/// |> line(endAbsolute = [-width/2, length/2], tag = $edge3)
|
||||
@ -68,7 +68,7 @@ pub async fn chamfer(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
||||
/// // Sketch on the face of a chamfer.
|
||||
/// fn cube(pos, scale) {
|
||||
/// sg = startSketchOn(XY)
|
||||
/// |> startProfileAt(pos, %)
|
||||
/// |> startProfile(at = pos)
|
||||
/// |> line(end = [0, scale])
|
||||
/// |> line(end = [scale, 0])
|
||||
/// |> line(end = [0, -scale])
|
||||
@ -87,7 +87,7 @@ pub async fn chamfer(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
||||
/// )
|
||||
///
|
||||
/// sketch001 = startSketchOn(part001, face = chamfer1)
|
||||
/// |> startProfileAt([10, 10], %)
|
||||
/// |> startProfile(at = [10, 10])
|
||||
/// |> line(end = [2, 0])
|
||||
/// |> line(end = [0, 2])
|
||||
/// |> line(end = [-2, 0])
|
||||
|
@ -54,7 +54,7 @@ pub async fn clone(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
/// ```no_run
|
||||
/// // Clone a basic sketch and move it and extrude it.
|
||||
/// exampleSketch = startSketchOn(XY)
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [10, 0])
|
||||
/// |> line(end = [0, 10])
|
||||
/// |> line(end = [-10, 0])
|
||||
@ -78,7 +78,7 @@ pub async fn clone(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
/// // Clone a basic solid and move it.
|
||||
///
|
||||
/// exampleSketch = startSketchOn(XY)
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [10, 0])
|
||||
/// |> line(end = [0, 10])
|
||||
/// |> line(end = [-10, 0])
|
||||
@ -95,7 +95,7 @@ pub async fn clone(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
/// // Translate and rotate a cloned sketch to create a loft.
|
||||
///
|
||||
/// sketch001 = startSketchOn(XY)
|
||||
/// |> startProfileAt([-10, 10], %)
|
||||
/// |> startProfile(at = [-10, 10])
|
||||
/// |> xLine(length = 20)
|
||||
/// |> yLine(length = -20)
|
||||
/// |> xLine(length = -20)
|
||||
@ -112,7 +112,7 @@ pub async fn clone(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
/// // Translate a cloned solid. Fillet only the clone.
|
||||
///
|
||||
/// sketch001 = startSketchOn(XY)
|
||||
/// |> startProfileAt([-10, 10], %)
|
||||
/// |> startProfile(at = [-10, 10])
|
||||
/// |> xLine(length = 20)
|
||||
/// |> yLine(length = -20)
|
||||
/// |> xLine(length = -20, tag = $filletTag)
|
||||
@ -132,7 +132,7 @@ pub async fn clone(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
/// // You can reuse the tags from the original geometry with the cloned geometry.
|
||||
///
|
||||
/// sketch001 = startSketchOn(XY)
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [10, 0])
|
||||
/// |> line(end = [0, 10], tag = $sketchingFace)
|
||||
/// |> line(end = [-10, 0])
|
||||
@ -143,7 +143,7 @@ pub async fn clone(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
/// |> extrude(length = 5)
|
||||
///
|
||||
/// startSketchOn(sketch002, face = sketchingFace)
|
||||
/// |> startProfileAt([1, 1], %)
|
||||
/// |> startProfile(at = [1, 1])
|
||||
/// |> line(end = [8, 0])
|
||||
/// |> line(end = [0, 8])
|
||||
/// |> line(end = [-8, 0])
|
||||
@ -160,7 +160,7 @@ pub async fn clone(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
/// filletRadius = 2
|
||||
///
|
||||
/// mountingPlateSketch = startSketchOn(XY)
|
||||
/// |> startProfileAt([-width/2, -length/2], %)
|
||||
/// |> startProfile(at = [-width/2, -length/2])
|
||||
/// |> line(endAbsolute = [width/2, -length/2], tag = $edge1)
|
||||
/// |> line(endAbsolute = [width/2, length/2], tag = $edge2)
|
||||
/// |> line(endAbsolute = [-width/2, length/2], tag = $edge3)
|
||||
@ -222,7 +222,7 @@ pub async fn clone(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
/// // This shows the cloned geometry will have the same tags as the original geometry.
|
||||
///
|
||||
/// exampleSketch = startSketchOn(XY)
|
||||
/// |> startProfileAt([4, 12], %)
|
||||
/// |> startProfile(at = [4, 12])
|
||||
/// |> line(end = [2, 0])
|
||||
/// |> line(end = [0, -6])
|
||||
/// |> line(end = [4, -6])
|
||||
@ -239,7 +239,7 @@ pub async fn clone(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
///
|
||||
/// // Sketch on the cloned face.
|
||||
/// // exampleSketch002 = startSketchOn(example002, face = end01)
|
||||
/// // |> startProfileAt([4.5, -5], %)
|
||||
/// // |> startProfile(at = [4.5, -5])
|
||||
/// // |> line(end = [0, 5])
|
||||
/// // |> line(end = [5, 0])
|
||||
/// // |> line(end = [0, -5])
|
||||
@ -520,7 +520,7 @@ mod tests {
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn kcl_test_clone_sketch() {
|
||||
let code = r#"cube = startSketchOn(XY)
|
||||
|> startProfileAt([0,0], %)
|
||||
|> startProfile(at = [0,0])
|
||||
|> line(end = [0, 10])
|
||||
|> line(end = [10, 0])
|
||||
|> line(end = [0, -10])
|
||||
@ -568,7 +568,7 @@ clonedCube = clone(cube)
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn kcl_test_clone_solid() {
|
||||
let code = r#"cube = startSketchOn(XY)
|
||||
|> startProfileAt([0,0], %)
|
||||
|> startProfile(at = [0,0])
|
||||
|> line(end = [0, 10])
|
||||
|> line(end = [10, 0])
|
||||
|> line(end = [0, -10])
|
||||
@ -627,7 +627,7 @@ clonedCube = clone(cube)
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn kcl_test_clone_sketch_with_tags() {
|
||||
let code = r#"cube = startSketchOn(XY)
|
||||
|> startProfileAt([0,0], %) // tag this one
|
||||
|> startProfile(at = [0,0]) // tag this one
|
||||
|> line(end = [0, 10], tag = $tag02)
|
||||
|> line(end = [10, 0], tag = $tag03)
|
||||
|> line(end = [0, -10], tag = $tag04)
|
||||
@ -682,7 +682,7 @@ clonedCube = clone(cube)
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn kcl_test_clone_solid_with_tags() {
|
||||
let code = r#"cube = startSketchOn(XY)
|
||||
|> startProfileAt([0,0], %) // tag this one
|
||||
|> startProfile(at = [0,0]) // tag this one
|
||||
|> line(end = [0, 10], tag = $tag02)
|
||||
|> line(end = [10, 0], tag = $tag03)
|
||||
|> line(end = [0, -10], tag = $tag04)
|
||||
@ -751,7 +751,7 @@ clonedCube = clone(cube)
|
||||
let code = r#"// Clone a basic solid and move it.
|
||||
|
||||
exampleSketch = startSketchOn(XY)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(end = [10, 0])
|
||||
|> line(end = [0, 10])
|
||||
|> line(end = [-10, 0])
|
||||
@ -826,7 +826,7 @@ clonedCube = clone(cube)
|
||||
#[ignore = "this test is not working yet, need to fix the edge cut ids"]
|
||||
async fn kcl_test_clone_solid_with_edge_cuts() {
|
||||
let code = r#"cube = startSketchOn(XY)
|
||||
|> startProfileAt([0,0], %) // tag this one
|
||||
|> startProfile(at = [0,0]) // tag this one
|
||||
|> line(end = [0, 10], tag = $tag02)
|
||||
|> line(end = [10, 0], tag = $tag03)
|
||||
|> line(end = [0, -10], tag = $tag04)
|
||||
|
@ -42,7 +42,7 @@ pub async fn union(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
///
|
||||
/// fn cube(center, size) {
|
||||
/// return startSketchOn('XY')
|
||||
/// |> startProfileAt([center[0] - size, center[1] - size], %)
|
||||
/// |> startProfile(at = [center[0] - size, center[1] - size])
|
||||
/// |> line(endAbsolute = [center[0] + size, center[1] - size])
|
||||
/// |> line(endAbsolute = [center[0] + size, center[1] + size])
|
||||
/// |> line(endAbsolute = [center[0] - size, center[1] + size])
|
||||
@ -64,7 +64,7 @@ pub async fn union(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
///
|
||||
/// fn cube(center, size) {
|
||||
/// return startSketchOn('XY')
|
||||
/// |> startProfileAt([center[0] - size, center[1] - size], %)
|
||||
/// |> startProfile(at = [center[0] - size, center[1] - size])
|
||||
/// |> line(endAbsolute = [center[0] + size, center[1] - size])
|
||||
/// |> line(endAbsolute = [center[0] + size, center[1] + size])
|
||||
/// |> line(endAbsolute = [center[0] - size, center[1] + size])
|
||||
@ -87,7 +87,7 @@ pub async fn union(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
///
|
||||
/// fn cube(center, size) {
|
||||
/// return startSketchOn('XY')
|
||||
/// |> startProfileAt([center[0] - size, center[1] - size], %)
|
||||
/// |> startProfile(at = [center[0] - size, center[1] - size])
|
||||
/// |> line(endAbsolute = [center[0] + size, center[1] - size])
|
||||
/// |> line(endAbsolute = [center[0] + size, center[1] + size])
|
||||
/// |> line(endAbsolute = [center[0] - size, center[1] + size])
|
||||
@ -192,7 +192,7 @@ pub async fn intersect(exec_state: &mut ExecState, args: Args) -> Result<KclValu
|
||||
///
|
||||
/// fn cube(center, size) {
|
||||
/// return startSketchOn('XY')
|
||||
/// |> startProfileAt([center[0] - size, center[1] - size], %)
|
||||
/// |> startProfile(at = [center[0] - size, center[1] - size])
|
||||
/// |> line(endAbsolute = [center[0] + size, center[1] - size])
|
||||
/// |> line(endAbsolute = [center[0] + size, center[1] + size])
|
||||
/// |> line(endAbsolute = [center[0] - size, center[1] + size])
|
||||
@ -214,7 +214,7 @@ pub async fn intersect(exec_state: &mut ExecState, args: Args) -> Result<KclValu
|
||||
///
|
||||
/// fn cube(center, size) {
|
||||
/// return startSketchOn('XY')
|
||||
/// |> startProfileAt([center[0] - size, center[1] - size], %)
|
||||
/// |> startProfile(at = [center[0] - size, center[1] - size])
|
||||
/// |> line(endAbsolute = [center[0] + size, center[1] - size])
|
||||
/// |> line(endAbsolute = [center[0] + size, center[1] + size])
|
||||
/// |> line(endAbsolute = [center[0] - size, center[1] + size])
|
||||
@ -325,7 +325,7 @@ pub async fn subtract(exec_state: &mut ExecState, args: Args) -> Result<KclValue
|
||||
///
|
||||
/// fn cube(center, size) {
|
||||
/// return startSketchOn('XY')
|
||||
/// |> startProfileAt([center[0] - size, center[1] - size], %)
|
||||
/// |> startProfile(at = [center[0] - size, center[1] - size])
|
||||
/// |> line(endAbsolute = [center[0] + size, center[1] - size])
|
||||
/// |> line(endAbsolute = [center[0] + size, center[1] + size])
|
||||
/// |> line(endAbsolute = [center[0] - size, center[1] + size])
|
||||
@ -347,7 +347,7 @@ pub async fn subtract(exec_state: &mut ExecState, args: Args) -> Result<KclValue
|
||||
///
|
||||
/// fn cube(center, size) {
|
||||
/// return startSketchOn('XY')
|
||||
/// |> startProfileAt([center[0] - size, center[1] - size], %)
|
||||
/// |> startProfile(at = [center[0] - size, center[1] - size])
|
||||
/// |> line(endAbsolute = [center[0] + size, center[1] - size])
|
||||
/// |> line(endAbsolute = [center[0] + size, center[1] + size])
|
||||
/// |> line(endAbsolute = [center[0] - size, center[1] + size])
|
||||
|
@ -27,7 +27,7 @@ pub async fn get_opposite_edge(exec_state: &mut ExecState, args: Args) -> Result
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn('XZ')
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [10, 0])
|
||||
/// |> angledLine(
|
||||
/// angle = 60,
|
||||
@ -110,7 +110,7 @@ pub async fn get_next_adjacent_edge(exec_state: &mut ExecState, args: Args) -> R
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn('XZ')
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [10, 0])
|
||||
/// |> angledLine(
|
||||
/// angle = 60,
|
||||
@ -202,7 +202,7 @@ pub async fn get_previous_adjacent_edge(exec_state: &mut ExecState, args: Args)
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn('XZ')
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [10, 0])
|
||||
/// |> angledLine(
|
||||
/// angle = 60,
|
||||
@ -296,7 +296,7 @@ pub async fn get_common_edge(exec_state: &mut ExecState, args: Args) -> Result<K
|
||||
///
|
||||
/// scale = 20
|
||||
/// part001 = startSketchOn('XY')
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [0, scale])
|
||||
/// |> line(end = [scale, 0])
|
||||
/// |> line(end = [0, -scale])
|
||||
|
@ -62,7 +62,7 @@ pub async fn extrude(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
||||
///
|
||||
/// ```no_run
|
||||
/// example = startSketchOn('XZ')
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [10, 0])
|
||||
/// |> arc(
|
||||
/// angleStart = 120,
|
||||
@ -83,7 +83,7 @@ pub async fn extrude(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn('XZ')
|
||||
/// |> startProfileAt([-10, 0], %)
|
||||
/// |> startProfile(at = [-10, 0])
|
||||
/// |> arc(
|
||||
/// angleStart = 120,
|
||||
/// angleEnd = -60,
|
||||
@ -105,7 +105,7 @@ pub async fn extrude(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn('XZ')
|
||||
/// |> startProfileAt([-10, 0], %)
|
||||
/// |> startProfile(at = [-10, 0])
|
||||
/// |> arc(
|
||||
/// angleStart = 120,
|
||||
/// angleEnd = -60,
|
||||
@ -127,7 +127,7 @@ pub async fn extrude(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn('XZ')
|
||||
/// |> startProfileAt([-10, 0], %)
|
||||
/// |> startProfile(at = [-10, 0])
|
||||
/// |> arc(
|
||||
/// angleStart = 120,
|
||||
/// angleEnd = -60,
|
||||
|
@ -88,7 +88,7 @@ pub async fn fillet(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
||||
/// filletRadius = 2
|
||||
///
|
||||
/// mountingPlateSketch = startSketchOn("XY")
|
||||
/// |> startProfileAt([-width/2, -length/2], %)
|
||||
/// |> startProfile(at = [-width/2, -length/2])
|
||||
/// |> line(endAbsolute = [width/2, -length/2], tag = $edge1)
|
||||
/// |> line(endAbsolute = [width/2, length/2], tag = $edge2)
|
||||
/// |> line(endAbsolute = [-width/2, length/2], tag = $edge3)
|
||||
@ -113,7 +113,7 @@ pub async fn fillet(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
||||
/// filletRadius = 1
|
||||
///
|
||||
/// mountingPlateSketch = startSketchOn("XY")
|
||||
/// |> startProfileAt([-width/2, -length/2], %)
|
||||
/// |> startProfile(at = [-width/2, -length/2])
|
||||
/// |> line(endAbsolute = [width/2, -length/2], tag = $edge1)
|
||||
/// |> line(endAbsolute = [width/2, length/2], tag = $edge2)
|
||||
/// |> line(endAbsolute = [-width/2, length/2], tag = $edge3)
|
||||
|
@ -59,7 +59,7 @@ pub async fn loft(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
|
||||
/// ```no_run
|
||||
/// // Loft a square and a triangle.
|
||||
/// squareSketch = startSketchOn('XY')
|
||||
/// |> startProfileAt([-100, 200], %)
|
||||
/// |> startProfile(at = [-100, 200])
|
||||
/// |> line(end = [200, 0])
|
||||
/// |> line(end = [0, -200])
|
||||
/// |> line(end = [-200, 0])
|
||||
@ -67,7 +67,7 @@ pub async fn loft(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
|
||||
/// |> close()
|
||||
///
|
||||
/// triangleSketch = startSketchOn(offsetPlane('XY', offset = 75))
|
||||
/// |> startProfileAt([0, 125], %)
|
||||
/// |> startProfile(at = [0, 125])
|
||||
/// |> line(end = [-15, -30])
|
||||
/// |> line(end = [30, 0])
|
||||
/// |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
@ -79,7 +79,7 @@ pub async fn loft(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
|
||||
/// ```no_run
|
||||
/// // Loft a square, a circle, and another circle.
|
||||
/// squareSketch = startSketchOn('XY')
|
||||
/// |> startProfileAt([-100, 200], %)
|
||||
/// |> startProfile(at = [-100, 200])
|
||||
/// |> line(end = [200, 0])
|
||||
/// |> line(end = [0, -200])
|
||||
/// |> line(end = [-200, 0])
|
||||
@ -98,7 +98,7 @@ pub async fn loft(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
|
||||
/// ```no_run
|
||||
/// // Loft a square, a circle, and another circle with options.
|
||||
/// squareSketch = startSketchOn('XY')
|
||||
/// |> startProfileAt([-100, 200], %)
|
||||
/// |> startProfile(at = [-100, 200])
|
||||
/// |> line(end = [200, 0])
|
||||
/// |> line(end = [0, -200])
|
||||
/// |> line(end = [-200, 0])
|
||||
|
@ -157,7 +157,7 @@ pub async fn sqrt(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn("XZ")
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> angledLine(
|
||||
/// angle = 50,
|
||||
/// length = sqrt(2500),
|
||||
@ -189,7 +189,7 @@ pub async fn abs(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
|
||||
/// myAngle = -120
|
||||
///
|
||||
/// sketch001 = startSketchOn('XZ')
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [8, 0])
|
||||
/// |> angledLine(
|
||||
/// angle = abs(myAngle),
|
||||
@ -224,7 +224,7 @@ pub async fn round(_exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
||||
///
|
||||
/// ```no_run
|
||||
/// sketch001 = startSketchOn('XZ')
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(endAbsolute = [12, 10])
|
||||
/// |> line(end = [round(7.02986), 0])
|
||||
/// |> yLine(endAbsolute = 0)
|
||||
@ -252,7 +252,7 @@ pub async fn floor(_exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
||||
///
|
||||
/// ```no_run
|
||||
/// sketch001 = startSketchOn('XZ')
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(endAbsolute = [12, 10])
|
||||
/// |> line(end = [floor(7.02986), 0])
|
||||
/// |> yLine(endAbsolute = 0)
|
||||
@ -280,7 +280,7 @@ pub async fn ceil(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
///
|
||||
/// ```no_run
|
||||
/// sketch001 = startSketchOn('XZ')
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(endAbsolute = [12, 10])
|
||||
/// |> line(end = [ceil(7.02986), 0])
|
||||
/// |> yLine(endAbsolute = 0)
|
||||
@ -315,7 +315,7 @@ pub async fn min(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kcl
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn("XZ")
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> angledLine(
|
||||
/// angle = 70,
|
||||
/// length = min(15, 31, 4, 13, 22)
|
||||
@ -359,7 +359,7 @@ pub async fn max(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kcl
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn("XZ")
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> angledLine(
|
||||
/// angle = 70,
|
||||
/// length = max(15, 31, 4, 13, 22)
|
||||
@ -410,7 +410,7 @@ pub async fn pow(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kcl
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn("XZ")
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> angledLine(
|
||||
/// angle = 50,
|
||||
/// length = pow(5, 2),
|
||||
@ -452,7 +452,7 @@ pub async fn acos(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
|
||||
///
|
||||
/// ```no_run
|
||||
/// sketch001 = startSketchOn('XZ')
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> angledLine(
|
||||
/// angle = toDegrees(acos(0.5)),
|
||||
/// length = 10,
|
||||
@ -495,7 +495,7 @@ pub async fn asin(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
|
||||
///
|
||||
/// ```no_run
|
||||
/// sketch001 = startSketchOn('XZ')
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> angledLine(
|
||||
/// angle = toDegrees(asin(0.5)),
|
||||
/// length = 20,
|
||||
@ -537,7 +537,7 @@ pub async fn atan(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
|
||||
///
|
||||
/// ```no_run
|
||||
/// sketch001 = startSketchOn('XZ')
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> angledLine(
|
||||
/// angle = toDegrees(atan(1.25)),
|
||||
/// length = 20,
|
||||
@ -569,7 +569,7 @@ pub async fn atan2(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
///
|
||||
/// ```no_run
|
||||
/// sketch001 = startSketchOn(XZ)
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> angledLine(
|
||||
/// angle = toDegrees(atan2(y = 1.25, x = 2)),
|
||||
/// length = 20,
|
||||
@ -626,7 +626,7 @@ pub async fn log(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kcl
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn("XZ")
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [log(100, 5), 0])
|
||||
/// |> line(end = [5, 8])
|
||||
/// |> line(end = [-10, 0])
|
||||
@ -654,7 +654,7 @@ pub async fn log2(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn("XZ")
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [log2(100), 0])
|
||||
/// |> line(end = [5, 8])
|
||||
/// |> line(end = [-10, 0])
|
||||
@ -682,7 +682,7 @@ pub async fn log10(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn("XZ")
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [log10(100), 0])
|
||||
/// |> line(end = [5, 8])
|
||||
/// |> line(end = [-10, 0])
|
||||
@ -710,7 +710,7 @@ pub async fn ln(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclE
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn("XZ")
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [ln(100), 15])
|
||||
/// |> line(end = [5, -6])
|
||||
/// |> line(end = [-10, -10])
|
||||
@ -739,7 +739,7 @@ pub async fn e(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclE
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn("XZ")
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> angledLine(
|
||||
/// angle = 30,
|
||||
/// length = 2 * e() ^ 2,
|
||||
@ -771,7 +771,7 @@ pub async fn tau(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn("XZ")
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> angledLine(
|
||||
/// angle = 50,
|
||||
/// length = 10 * tau(),
|
||||
|
@ -81,7 +81,7 @@ lazy_static! {
|
||||
Box::new(crate::std::sketch::AngledLine),
|
||||
Box::new(crate::std::sketch::AngledLineThatIntersects),
|
||||
Box::new(crate::std::sketch::StartSketchOn),
|
||||
Box::new(crate::std::sketch::StartProfileAt),
|
||||
Box::new(crate::std::sketch::StartProfile),
|
||||
Box::new(crate::std::sketch::ProfileStartX),
|
||||
Box::new(crate::std::sketch::ProfileStartY),
|
||||
Box::new(crate::std::sketch::ProfileStart),
|
||||
|
@ -147,7 +147,7 @@ pub async fn pattern_transform_2d(exec_state: &mut ExecState, args: Args) -> Res
|
||||
/// p3 = [ l + x, -l + y]
|
||||
///
|
||||
/// return startSketchOn('XY')
|
||||
/// |> startProfileAt(p0, %)
|
||||
/// |> startProfile(at = p0)
|
||||
/// |> line(endAbsolute = p1)
|
||||
/// |> line(endAbsolute = p2)
|
||||
/// |> line(endAbsolute = p3)
|
||||
@ -187,7 +187,7 @@ pub async fn pattern_transform_2d(exec_state: &mut ExecState, args: Args) -> Res
|
||||
/// p3 = [ l + x, -l + y]
|
||||
///
|
||||
/// return startSketchOn('XY')
|
||||
/// |> startProfileAt(p0, %)
|
||||
/// |> startProfile(at = p0)
|
||||
/// |> line(endAbsolute = p1)
|
||||
/// |> line(endAbsolute = p2)
|
||||
/// |> line(endAbsolute = p3)
|
||||
@ -244,7 +244,7 @@ pub async fn pattern_transform_2d(exec_state: &mut ExecState, args: Args) -> Res
|
||||
/// ]
|
||||
/// }
|
||||
/// startSketchOn('XY')
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> polygon(
|
||||
/// radius = 10,
|
||||
/// numSides = 4,
|
||||
@ -812,7 +812,7 @@ pub async fn pattern_linear_3d(exec_state: &mut ExecState, args: Args) -> Result
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn('XZ')
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [0, 2])
|
||||
/// |> line(end = [3, 1])
|
||||
/// |> line(end = [0, -4])
|
||||
@ -831,7 +831,7 @@ pub async fn pattern_linear_3d(exec_state: &mut ExecState, args: Args) -> Result
|
||||
/// // Pattern a whole sketch on face.
|
||||
/// let size = 100
|
||||
/// const case = startSketchOn('XY')
|
||||
/// |> startProfileAt([-size, -size], %)
|
||||
/// |> startProfile(at = [-size, -size])
|
||||
/// |> line(end = [2 * size, 0])
|
||||
/// |> line(end = [0, 2 * size])
|
||||
/// |> tangentialArc(endAbsolute = [-size, size])
|
||||
@ -859,7 +859,7 @@ pub async fn pattern_linear_3d(exec_state: &mut ExecState, args: Args) -> Result
|
||||
/// // Pattern an object on a face.
|
||||
/// let size = 100
|
||||
/// const case = startSketchOn('XY')
|
||||
/// |> startProfileAt([-size, -size], %)
|
||||
/// |> startProfile(at = [-size, -size])
|
||||
/// |> line(end = [2 * size, 0])
|
||||
/// |> line(end = [0, 2 * size])
|
||||
/// |> tangentialArc(endAbsolute = [-size, size])
|
||||
@ -1063,7 +1063,7 @@ pub async fn pattern_circular_2d(exec_state: &mut ExecState, args: Args) -> Resu
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn('XZ')
|
||||
/// |> startProfileAt([.5, 25], %)
|
||||
/// |> startProfile(at = [.5, 25])
|
||||
/// |> line(end = [0, 5])
|
||||
/// |> line(end = [-1, 0])
|
||||
/// |> line(end = [0, -5])
|
||||
|
@ -27,7 +27,7 @@ pub async fn segment_end(exec_state: &mut ExecState, args: Args) -> Result<KclVa
|
||||
/// ```no_run
|
||||
/// w = 15
|
||||
/// cube = startSketchOn('XY')
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [w, 0], tag = $line1)
|
||||
/// |> line(end = [0, w], tag = $line2)
|
||||
/// |> line(end = [-w, 0], tag = $line3)
|
||||
@ -37,7 +37,7 @@ pub async fn segment_end(exec_state: &mut ExecState, args: Args) -> Result<KclVa
|
||||
///
|
||||
/// fn cylinder(radius, tag) {
|
||||
/// return startSketchOn('XY')
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> circle(radius = radius, center = segEnd(tag) )
|
||||
/// |> extrude(length = radius)
|
||||
/// }
|
||||
@ -79,7 +79,7 @@ pub async fn segment_end_x(exec_state: &mut ExecState, args: Args) -> Result<Kcl
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn('XZ')
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [20, 0], tag = $thing)
|
||||
/// |> line(end = [0, 5])
|
||||
/// |> line(end = [segEndX(thing), 0])
|
||||
@ -120,7 +120,7 @@ pub async fn segment_end_y(exec_state: &mut ExecState, args: Args) -> Result<Kcl
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn('XZ')
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [20, 0])
|
||||
/// |> line(end = [0, 3], tag = $thing)
|
||||
/// |> line(end = [-10, 0])
|
||||
@ -163,7 +163,7 @@ pub async fn segment_start(exec_state: &mut ExecState, args: Args) -> Result<Kcl
|
||||
/// ```no_run
|
||||
/// w = 15
|
||||
/// cube = startSketchOn('XY')
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [w, 0], tag = $line1)
|
||||
/// |> line(end = [0, w], tag = $line2)
|
||||
/// |> line(end = [-w, 0], tag = $line3)
|
||||
@ -173,7 +173,7 @@ pub async fn segment_start(exec_state: &mut ExecState, args: Args) -> Result<Kcl
|
||||
///
|
||||
/// fn cylinder(radius, tag) {
|
||||
/// return startSketchOn('XY')
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> circle( radius = radius, center = segStart(tag) )
|
||||
/// |> extrude(length = radius)
|
||||
/// }
|
||||
@ -215,7 +215,7 @@ pub async fn segment_start_x(exec_state: &mut ExecState, args: Args) -> Result<K
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn('XZ')
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [20, 0], tag = $thing)
|
||||
/// |> line(end = [0, 5])
|
||||
/// |> line(end = [20 - segStartX(thing), 0])
|
||||
@ -256,7 +256,7 @@ pub async fn segment_start_y(exec_state: &mut ExecState, args: Args) -> Result<K
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn('XZ')
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [20, 0])
|
||||
/// |> line(end = [0, 3], tag = $thing)
|
||||
/// |> line(end = [-10, 0])
|
||||
@ -299,7 +299,7 @@ pub async fn last_segment_x(exec_state: &mut ExecState, args: Args) -> Result<Kc
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn("XZ")
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [5, 0])
|
||||
/// |> line(end = [20, 5])
|
||||
/// |> line(end = [lastSegX(%), 0])
|
||||
@ -345,7 +345,7 @@ pub async fn last_segment_y(exec_state: &mut ExecState, args: Args) -> Result<Kc
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn("XZ")
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [5, 0])
|
||||
/// |> line(end = [20, 5])
|
||||
/// |> line(end = [0, lastSegY(%)])
|
||||
@ -388,7 +388,7 @@ pub async fn segment_length(exec_state: &mut ExecState, args: Args) -> Result<Kc
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn("XZ")
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> angledLine(
|
||||
/// angle = 60,
|
||||
/// length = 10,
|
||||
@ -435,7 +435,7 @@ pub async fn segment_angle(exec_state: &mut ExecState, args: Args) -> Result<Kcl
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn('XZ')
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [10, 0])
|
||||
/// |> line(end = [5, 10], tag = $seg01)
|
||||
/// |> line(end = [-10, 0])
|
||||
@ -481,7 +481,7 @@ pub async fn tangent_to_end(exec_state: &mut ExecState, args: Args) -> Result<Kc
|
||||
/// ```no_run
|
||||
/// // Horizontal pill.
|
||||
/// pillSketch = startSketchOn('XZ')
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [20, 0])
|
||||
/// |> tangentialArc(end = [0, 10], tag = $arc1)
|
||||
/// |> angledLine(
|
||||
@ -497,7 +497,7 @@ pub async fn tangent_to_end(exec_state: &mut ExecState, args: Args) -> Result<Kc
|
||||
/// ```no_run
|
||||
/// // Vertical pill. Use absolute coordinate for arc.
|
||||
/// pillSketch = startSketchOn('XZ')
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [0, 20])
|
||||
/// |> tangentialArc(endAbsolute = [10, 20], tag = $arc1)
|
||||
/// |> angledLine(
|
||||
@ -512,7 +512,7 @@ pub async fn tangent_to_end(exec_state: &mut ExecState, args: Args) -> Result<Kc
|
||||
///
|
||||
/// ```no_run
|
||||
/// rectangleSketch = startSketchOn('XZ')
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [10, 0], tag = $seg1)
|
||||
/// |> angledLine(
|
||||
/// angle = tangentToEnd(seg1),
|
||||
@ -527,7 +527,7 @@ pub async fn tangent_to_end(exec_state: &mut ExecState, args: Args) -> Result<Kc
|
||||
///
|
||||
/// ```no_run
|
||||
/// bottom = startSketchOn("XY")
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> arc(
|
||||
/// endAbsolute = [10, 10],
|
||||
/// interiorAbsolute = [5, 1],
|
||||
@ -542,7 +542,7 @@ pub async fn tangent_to_end(exec_state: &mut ExecState, args: Args) -> Result<Kc
|
||||
/// |> circle( center= [0, 0], radius= 3 , tag= $circ)
|
||||
///
|
||||
/// triangleSketch = startSketchOn("XY")
|
||||
/// |> startProfileAt([-5, 0], %)
|
||||
/// |> startProfile(at = [-5, 0])
|
||||
/// |> angledLine(angle = tangentToEnd(circ), length = 10)
|
||||
/// |> line(end = [-15, 0])
|
||||
/// |> close()
|
||||
|
@ -72,7 +72,7 @@ async fn inner_circle(
|
||||
let from_t = [TyF64::new(from[0], ty.clone()), TyF64::new(from[1], ty)];
|
||||
|
||||
let sketch =
|
||||
crate::std::sketch::inner_start_profile_at(from_t, sketch_surface, None, exec_state, args.clone()).await?;
|
||||
crate::std::sketch::inner_start_profile(sketch_surface, from_t, None, exec_state, args.clone()).await?;
|
||||
|
||||
let angle_start = Angle::zero();
|
||||
let angle_end = Angle::turn();
|
||||
@ -189,8 +189,7 @@ async fn inner_circle_three_point(
|
||||
TyF64::new(center[1], ty.clone()),
|
||||
];
|
||||
let sketch =
|
||||
crate::std::sketch::inner_start_profile_at(from.clone(), sketch_surface, None, exec_state, args.clone())
|
||||
.await?;
|
||||
crate::std::sketch::inner_start_profile(sketch_surface, from.clone(), None, exec_state, args.clone()).await?;
|
||||
|
||||
let angle_start = Angle::zero();
|
||||
let angle_end = Angle::turn();
|
||||
@ -366,9 +365,9 @@ async fn inner_polygon(
|
||||
})
|
||||
.collect();
|
||||
|
||||
let mut sketch = crate::std::sketch::inner_start_profile_at(
|
||||
point_to_typed(vertices[0], units),
|
||||
let mut sketch = crate::std::sketch::inner_start_profile(
|
||||
sketch_surface,
|
||||
point_to_typed(vertices[0], units),
|
||||
None,
|
||||
exec_state,
|
||||
args.clone(),
|
||||
|
@ -30,7 +30,7 @@ pub async fn shell(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
/// ```no_run
|
||||
/// // Remove the end face for the extrusion.
|
||||
/// firstSketch = startSketchOn(XY)
|
||||
/// |> startProfileAt([-12, 12], %)
|
||||
/// |> startProfile(at = [-12, 12])
|
||||
/// |> line(end = [24, 0])
|
||||
/// |> line(end = [0, -24])
|
||||
/// |> line(end = [-24, 0])
|
||||
@ -48,7 +48,7 @@ pub async fn shell(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
/// ```no_run
|
||||
/// // Remove the start face for the extrusion.
|
||||
/// firstSketch = startSketchOn(-XZ)
|
||||
/// |> startProfileAt([-12, 12], %)
|
||||
/// |> startProfile(at = [-12, 12])
|
||||
/// |> line(end = [24, 0])
|
||||
/// |> line(end = [0, -24])
|
||||
/// |> line(end = [-24, 0])
|
||||
@ -66,7 +66,7 @@ pub async fn shell(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
/// ```no_run
|
||||
/// // Remove a tagged face and the end face for the extrusion.
|
||||
/// firstSketch = startSketchOn(XY)
|
||||
/// |> startProfileAt([-12, 12], %)
|
||||
/// |> startProfile(at = [-12, 12])
|
||||
/// |> line(end = [24, 0])
|
||||
/// |> line(end = [0, -24])
|
||||
/// |> line(end = [-24, 0], tag = $myTag)
|
||||
@ -84,7 +84,7 @@ pub async fn shell(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
/// ```no_run
|
||||
/// // Remove multiple faces at once.
|
||||
/// firstSketch = startSketchOn(XY)
|
||||
/// |> startProfileAt([-12, 12], %)
|
||||
/// |> startProfile(at = [-12, 12])
|
||||
/// |> line(end = [24, 0])
|
||||
/// |> line(end = [0, -24])
|
||||
/// |> line(end = [-24, 0], tag = $myTag)
|
||||
@ -103,7 +103,7 @@ pub async fn shell(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
/// // Shell a sketch on face.
|
||||
/// size = 100
|
||||
/// case = startSketchOn(-XZ)
|
||||
/// |> startProfileAt([-size, -size], %)
|
||||
/// |> startProfile(at = [-size, -size])
|
||||
/// |> line(end = [2 * size, 0])
|
||||
/// |> line(end = [0, 2 * size])
|
||||
/// |> tangentialArc(endAbsolute = [-size, size])
|
||||
@ -126,7 +126,7 @@ pub async fn shell(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
/// // Shell a sketch on face object on the end face.
|
||||
/// size = 100
|
||||
/// case = startSketchOn(XY)
|
||||
/// |> startProfileAt([-size, -size], %)
|
||||
/// |> startProfile(at = [-size, -size])
|
||||
/// |> line(end = [2 * size, 0])
|
||||
/// |> line(end = [0, 2 * size])
|
||||
/// |> tangentialArc(endAbsolute = [-size, size])
|
||||
@ -151,7 +151,7 @@ pub async fn shell(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
///
|
||||
/// size = 100
|
||||
/// case = startSketchOn(XY)
|
||||
/// |> startProfileAt([-size, -size], %)
|
||||
/// |> startProfile(at = [-size, -size])
|
||||
/// |> line(end = [2 * size, 0])
|
||||
/// |> line(end = [0, 2 * size])
|
||||
/// |> tangentialArc(endAbsolute = [-size, size])
|
||||
@ -262,7 +262,7 @@ pub async fn hollow(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
||||
/// ```no_run
|
||||
/// // Hollow a basic sketch.
|
||||
/// firstSketch = startSketchOn(XY)
|
||||
/// |> startProfileAt([-12, 12], %)
|
||||
/// |> startProfile(at = [-12, 12])
|
||||
/// |> line(end = [24, 0])
|
||||
/// |> line(end = [0, -24])
|
||||
/// |> line(end = [-24, 0])
|
||||
@ -274,7 +274,7 @@ pub async fn hollow(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
||||
/// ```no_run
|
||||
/// // Hollow a basic sketch.
|
||||
/// firstSketch = startSketchOn(-XZ)
|
||||
/// |> startProfileAt([-12, 12], %)
|
||||
/// |> startProfile(at = [-12, 12])
|
||||
/// |> line(end = [24, 0])
|
||||
/// |> line(end = [0, -24])
|
||||
/// |> line(end = [-24, 0])
|
||||
@ -287,7 +287,7 @@ pub async fn hollow(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
||||
/// // Hollow a sketch on face object.
|
||||
/// size = 100
|
||||
/// case = startSketchOn(-XZ)
|
||||
/// |> startProfileAt([-size, -size], %)
|
||||
/// |> startProfile(at = [-size, -size])
|
||||
/// |> line(end = [2 * size, 0])
|
||||
/// |> line(end = [0, 2 * size])
|
||||
/// |> tangentialArc(endAbsolute = [-size, size])
|
||||
|
@ -134,7 +134,7 @@ fn involute_curve(radius: f64, angle: f64) -> (f64, f64) {
|
||||
/// a = 10
|
||||
/// b = 14
|
||||
/// startSketchOn(XZ)
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> involuteCircular(startRadius = a, endRadius = b, angle = 60)
|
||||
/// |> involuteCircular(startRadius = a, endRadius = b, angle = 60, reverse = true)
|
||||
/// ```
|
||||
@ -236,7 +236,7 @@ pub async fn line(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
|
||||
///
|
||||
/// ```no_run
|
||||
/// triangle = startSketchOn(XZ)
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> 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.
|
||||
@ -247,7 +247,7 @@ pub async fn line(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
|
||||
/// |> extrude(length = 5)
|
||||
///
|
||||
/// box = startSketchOn(XZ)
|
||||
/// |> startProfileAt([10, 10], %)
|
||||
/// |> 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])
|
||||
@ -406,7 +406,7 @@ pub async fn x_line(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn(XZ)
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> xLine(length = 15)
|
||||
/// |> angledLine(
|
||||
/// angle = 80,
|
||||
@ -475,7 +475,7 @@ pub async fn y_line(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn(XZ)
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> yLine(length = 15)
|
||||
/// |> angledLine(
|
||||
/// angle = 30,
|
||||
@ -556,7 +556,7 @@ pub async fn angled_line(exec_state: &mut ExecState, args: Args) -> Result<KclVa
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn(XZ)
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> yLine(endAbsolute = 15)
|
||||
/// |> angledLine(
|
||||
/// angle = 30,
|
||||
@ -854,7 +854,7 @@ pub async fn angled_line_that_intersects(exec_state: &mut ExecState, args: Args)
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn(XZ)
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(endAbsolute = [5, 10])
|
||||
/// |> line(endAbsolute = [-10, 10], tag = $lineToIntersect)
|
||||
/// |> line(endAbsolute = [0, 20])
|
||||
@ -1000,7 +1000,7 @@ pub async fn start_sketch_on(exec_state: &mut ExecState, args: Args) -> Result<K
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn(XY)
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [10, 0])
|
||||
/// |> line(end = [0, 10])
|
||||
/// |> line(end = [-10, 0])
|
||||
@ -1009,7 +1009,7 @@ pub async fn start_sketch_on(exec_state: &mut ExecState, args: Args) -> Result<K
|
||||
/// example = extrude(exampleSketch, length = 5)
|
||||
///
|
||||
/// exampleSketch002 = startSketchOn(example, face = END)
|
||||
/// |> startProfileAt([1, 1], %)
|
||||
/// |> startProfile(at = [1, 1])
|
||||
/// |> line(end = [8, 0])
|
||||
/// |> line(end = [0, 8])
|
||||
/// |> line(end = [-8, 0])
|
||||
@ -1018,7 +1018,7 @@ pub async fn start_sketch_on(exec_state: &mut ExecState, args: Args) -> Result<K
|
||||
/// example002 = extrude(exampleSketch002, length = 5)
|
||||
///
|
||||
/// exampleSketch003 = startSketchOn(example002, face = END)
|
||||
/// |> startProfileAt([2, 2], %)
|
||||
/// |> startProfile(at = [2, 2])
|
||||
/// |> line(end = [6, 0])
|
||||
/// |> line(end = [0, 6])
|
||||
/// |> line(end = [-6, 0])
|
||||
@ -1031,7 +1031,7 @@ pub async fn start_sketch_on(exec_state: &mut ExecState, args: Args) -> Result<K
|
||||
/// // Sketch on the end of an extruded face by tagging the end face.
|
||||
///
|
||||
/// exampleSketch = startSketchOn(XY)
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [10, 0])
|
||||
/// |> line(end = [0, 10])
|
||||
/// |> line(end = [-10, 0])
|
||||
@ -1040,7 +1040,7 @@ pub async fn start_sketch_on(exec_state: &mut ExecState, args: Args) -> Result<K
|
||||
/// example = extrude(exampleSketch, length = 5, tagEnd = $end01)
|
||||
///
|
||||
/// exampleSketch002 = startSketchOn(example, face = end01)
|
||||
/// |> startProfileAt([1, 1], %)
|
||||
/// |> startProfile(at = [1, 1])
|
||||
/// |> line(end = [8, 0])
|
||||
/// |> line(end = [0, 8])
|
||||
/// |> line(end = [-8, 0])
|
||||
@ -1049,7 +1049,7 @@ pub async fn start_sketch_on(exec_state: &mut ExecState, args: Args) -> Result<K
|
||||
/// example002 = extrude(exampleSketch002, length = 5, tagEnd = $end02)
|
||||
///
|
||||
/// exampleSketch003 = startSketchOn(example002, face = end02)
|
||||
/// |> startProfileAt([2, 2], %)
|
||||
/// |> startProfile(at = [2, 2])
|
||||
/// |> line(end = [6, 0])
|
||||
/// |> line(end = [0, 6])
|
||||
/// |> line(end = [-6, 0])
|
||||
@ -1060,7 +1060,7 @@ pub async fn start_sketch_on(exec_state: &mut ExecState, args: Args) -> Result<K
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn(XY)
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [10, 0])
|
||||
/// |> line(end = [0, 10], tag = $sketchingFace)
|
||||
/// |> line(end = [-10, 0])
|
||||
@ -1069,7 +1069,7 @@ pub async fn start_sketch_on(exec_state: &mut ExecState, args: Args) -> Result<K
|
||||
/// example = extrude(exampleSketch, length = 10)
|
||||
///
|
||||
/// exampleSketch002 = startSketchOn(example, face = sketchingFace)
|
||||
/// |> startProfileAt([1, 1], %)
|
||||
/// |> startProfile(at = [1, 1])
|
||||
/// |> line(end = [8, 0])
|
||||
/// |> line(end = [0, 8])
|
||||
/// |> line(end = [-8, 0])
|
||||
@ -1078,7 +1078,7 @@ pub async fn start_sketch_on(exec_state: &mut ExecState, args: Args) -> Result<K
|
||||
/// example002 = extrude(exampleSketch002, length = 10)
|
||||
///
|
||||
/// exampleSketch003 = startSketchOn(example002, face = sketchingFace002)
|
||||
/// |> startProfileAt([-8, 12], %)
|
||||
/// |> startProfile(at = [-8, 12])
|
||||
/// |> line(end = [0, 6])
|
||||
/// |> line(end = [6, 0])
|
||||
/// |> line(end = [0, -6])
|
||||
@ -1089,7 +1089,7 @@ pub async fn start_sketch_on(exec_state: &mut ExecState, args: Args) -> Result<K
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn(XY)
|
||||
/// |> startProfileAt([4, 12], %)
|
||||
/// |> startProfile(at = [4, 12])
|
||||
/// |> line(end = [2, 0])
|
||||
/// |> line(end = [0, -6])
|
||||
/// |> line(end = [4, -6])
|
||||
@ -1102,7 +1102,7 @@ pub async fn start_sketch_on(exec_state: &mut ExecState, args: Args) -> Result<K
|
||||
/// example = revolve(exampleSketch, axis = Y, angle = 180)
|
||||
///
|
||||
/// exampleSketch002 = startSketchOn(example, face = END)
|
||||
/// |> startProfileAt([4.5, -5], %)
|
||||
/// |> startProfile(at = [4.5, -5])
|
||||
/// |> line(end = [0, 5])
|
||||
/// |> line(end = [5, 0])
|
||||
/// |> line(end = [0, -5])
|
||||
@ -1115,7 +1115,7 @@ pub async fn start_sketch_on(exec_state: &mut ExecState, args: Args) -> Result<K
|
||||
/// // Sketch on the end of a revolved face by tagging the end face.
|
||||
///
|
||||
/// exampleSketch = startSketchOn(XY)
|
||||
/// |> startProfileAt([4, 12], %)
|
||||
/// |> startProfile(at = [4, 12])
|
||||
/// |> line(end = [2, 0])
|
||||
/// |> line(end = [0, -6])
|
||||
/// |> line(end = [4, -6])
|
||||
@ -1128,7 +1128,7 @@ pub async fn start_sketch_on(exec_state: &mut ExecState, args: Args) -> Result<K
|
||||
/// example = revolve(exampleSketch, axis = Y, angle = 180, tagEnd = $end01)
|
||||
///
|
||||
/// exampleSketch002 = startSketchOn(example, face = end01)
|
||||
/// |> startProfileAt([4.5, -5], %)
|
||||
/// |> startProfile(at = [4.5, -5])
|
||||
/// |> line(end = [0, 5])
|
||||
/// |> line(end = [5, 0])
|
||||
/// |> line(end = [0, -5])
|
||||
@ -1144,7 +1144,7 @@ pub async fn start_sketch_on(exec_state: &mut ExecState, args: Args) -> Result<K
|
||||
/// yAxis = { x = 0, y = 1, z = 0 },
|
||||
/// zAxis = { x = 0, y = 0, z = 1 }
|
||||
/// })
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [100.0, 0])
|
||||
/// |> yLine(length = -100.0)
|
||||
/// |> xLine(length = -100.0)
|
||||
@ -1260,10 +1260,13 @@ async fn make_sketch_plane_from_orientation(
|
||||
}
|
||||
|
||||
/// Start a new profile at a given point.
|
||||
pub async fn start_profile_at(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||
let (start, sketch_surface, tag) = args.get_data_and_sketch_surface()?;
|
||||
pub async fn start_profile(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||
// let (start, sketch_surface, tag) = args.get_data_and_sketch_surface()?;
|
||||
let sketch_surface = args.get_unlabeled_kw_arg("startProfileOn")?;
|
||||
let start: [TyF64; 2] = args.get_kw_arg("at")?;
|
||||
let tag = args.get_kw_arg_opt(NEW_TAG_KW)?;
|
||||
|
||||
let sketch = inner_start_profile_at(start, sketch_surface, tag, exec_state, args).await?;
|
||||
let sketch = inner_start_profile(sketch_surface, start, tag, exec_state, args).await?;
|
||||
Ok(KclValue::Sketch {
|
||||
value: Box::new(sketch),
|
||||
})
|
||||
@ -1273,7 +1276,7 @@ pub async fn start_profile_at(exec_state: &mut ExecState, args: Args) -> Result<
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn(XZ)
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [10, 0])
|
||||
/// |> line(end = [0, 10])
|
||||
/// |> line(end = [-10, 0])
|
||||
@ -1284,7 +1287,7 @@ pub async fn start_profile_at(exec_state: &mut ExecState, args: Args) -> Result<
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn(-XZ)
|
||||
/// |> startProfileAt([10, 10], %)
|
||||
/// |> startProfile(at = [10, 10])
|
||||
/// |> line(end = [10, 0])
|
||||
/// |> line(end = [0, 10])
|
||||
/// |> line(end = [-10, 0])
|
||||
@ -1295,7 +1298,7 @@ pub async fn start_profile_at(exec_state: &mut ExecState, args: Args) -> Result<
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn(-XZ)
|
||||
/// |> startProfileAt([-10, 23], %)
|
||||
/// |> startProfile(at = [-10, 23])
|
||||
/// |> line(end = [10, 0])
|
||||
/// |> line(end = [0, 10])
|
||||
/// |> line(end = [-10, 0])
|
||||
@ -1304,11 +1307,18 @@ pub async fn start_profile_at(exec_state: &mut ExecState, args: Args) -> Result<
|
||||
/// example = extrude(exampleSketch, length = 5)
|
||||
/// ```
|
||||
#[stdlib {
|
||||
name = "startProfileAt",
|
||||
name = "startProfile",
|
||||
keywords = true,
|
||||
unlabeled_first = true,
|
||||
args = {
|
||||
sketch_surface = { docs = "What to start the profile on" },
|
||||
at = { docs = "Where to start the profile. An absolute point." },
|
||||
tag = { docs = "Tag this first starting point" },
|
||||
}
|
||||
}]
|
||||
pub(crate) async fn inner_start_profile_at(
|
||||
to: [TyF64; 2],
|
||||
pub(crate) async fn inner_start_profile(
|
||||
sketch_surface: SketchSurface,
|
||||
at: [TyF64; 2],
|
||||
tag: Option<TagNode>,
|
||||
exec_state: &mut ExecState,
|
||||
args: Args,
|
||||
@ -1364,7 +1374,7 @@ pub(crate) async fn inner_start_profile_at(
|
||||
ModelingCmdReq {
|
||||
cmd: ModelingCmd::from(mcmd::MovePathPen {
|
||||
path: path_id.into(),
|
||||
to: KPoint2d::from(point_to_mm(to.clone())).with_z(0.0).map(LengthUnit),
|
||||
to: KPoint2d::from(point_to_mm(at.clone())).with_z(0.0).map(LengthUnit),
|
||||
}),
|
||||
cmd_id: move_pen_id.into(),
|
||||
},
|
||||
@ -1375,7 +1385,7 @@ pub(crate) async fn inner_start_profile_at(
|
||||
])
|
||||
.await?;
|
||||
|
||||
let (to, ty) = untype_point(to);
|
||||
let (to, ty) = untype_point(at);
|
||||
let current_path = BasePath {
|
||||
from: to,
|
||||
to,
|
||||
@ -1431,7 +1441,7 @@ pub async fn profile_start_x(exec_state: &mut ExecState, args: Args) -> Result<K
|
||||
///
|
||||
/// ```no_run
|
||||
/// sketch001 = startSketchOn(XY)
|
||||
/// |> startProfileAt([5, 2], %)
|
||||
/// |> startProfile(at = [5, 2])
|
||||
/// |> angledLine(angle = -26.6, length = 50)
|
||||
/// |> angledLine(angle = 90, length = 50)
|
||||
/// |> angledLine(angle = 30, endAbsoluteX = profileStartX(%))
|
||||
@ -1461,7 +1471,7 @@ pub async fn profile_start_y(exec_state: &mut ExecState, args: Args) -> Result<K
|
||||
///
|
||||
/// ```no_run
|
||||
/// sketch001 = startSketchOn(XY)
|
||||
/// |> startProfileAt([5, 2], %)
|
||||
/// |> startProfile(at = [5, 2])
|
||||
/// |> angledLine(angle = -60, length = 14 )
|
||||
/// |> angledLine(angle = 30, endAbsoluteY = profileStartY(%))
|
||||
/// ```
|
||||
@ -1490,7 +1500,7 @@ pub async fn profile_start(exec_state: &mut ExecState, args: Args) -> Result<Kcl
|
||||
///
|
||||
/// ```no_run
|
||||
/// sketch001 = startSketchOn(XY)
|
||||
/// |> startProfileAt([5, 2], %)
|
||||
/// |> startProfile(at = [5, 2])
|
||||
/// |> angledLine(angle = 120, length = 50 , tag = $seg01)
|
||||
/// |> angledLine(angle = segAng(seg01) + 120, length = 50 )
|
||||
/// |> line(end = profileStart(%))
|
||||
@ -1525,7 +1535,7 @@ pub async fn close(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
///
|
||||
/// ```no_run
|
||||
/// startSketchOn(XZ)
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [10, 10])
|
||||
/// |> line(end = [10, 0])
|
||||
/// |> close()
|
||||
@ -1534,7 +1544,7 @@ pub async fn close(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn(-XZ)
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [10, 0])
|
||||
/// |> line(end = [0, 10])
|
||||
/// |> close()
|
||||
@ -1630,7 +1640,7 @@ pub async fn arc(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kcl
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn(XZ)
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [10, 0])
|
||||
/// |> arc(
|
||||
/// angleStart = 0,
|
||||
@ -1642,7 +1652,7 @@ pub async fn arc(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kcl
|
||||
/// ```
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn(XZ)
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> arc(
|
||||
/// endAbsolute = [10,0],
|
||||
/// interiorAbsolute = [5,5]
|
||||
@ -1852,7 +1862,7 @@ pub async fn tangential_arc(exec_state: &mut ExecState, args: Args) -> Result<Kc
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn(XZ)
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> angledLine(
|
||||
/// angle = 45,
|
||||
/// length = 10,
|
||||
@ -1866,7 +1876,7 @@ pub async fn tangential_arc(exec_state: &mut ExecState, args: Args) -> Result<Kc
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn(XZ)
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> angledLine(
|
||||
/// angle = 60,
|
||||
/// length = 10,
|
||||
@ -1880,7 +1890,7 @@ pub async fn tangential_arc(exec_state: &mut ExecState, args: Args) -> Result<Kc
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn(XZ)
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> angledLine(
|
||||
/// angle = 60,
|
||||
/// length = 10,
|
||||
@ -2161,7 +2171,7 @@ pub async fn bezier_curve(exec_state: &mut ExecState, args: Args) -> Result<KclV
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn(XZ)
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [0, 10])
|
||||
/// |> bezierCurve(
|
||||
/// control1 = [5, 0],
|
||||
@ -2256,7 +2266,7 @@ pub async fn hole(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
|
||||
///
|
||||
/// ```no_run
|
||||
/// exampleSketch = startSketchOn(XY)
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> startProfile(at = [0, 0])
|
||||
/// |> line(end = [0, 5])
|
||||
/// |> line(end = [5, 0])
|
||||
/// |> line(end = [0, -5])
|
||||
@ -2270,7 +2280,7 @@ pub async fn hole(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
|
||||
/// ```no_run
|
||||
/// fn squareHoleSketch() {
|
||||
/// squareSketch = startSketchOn(-XZ)
|
||||
/// |> startProfileAt([-1, -1], %)
|
||||
/// |> startProfile(at = [-1, -1])
|
||||
/// |> line(end = [2, 0])
|
||||
/// |> line(end = [0, 2])
|
||||
/// |> line(end = [-2, 0])
|
||||
|
@ -63,7 +63,7 @@ pub async fn sweep(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
///
|
||||
/// // Create a path for the sweep.
|
||||
/// sweepPath = startSketchOn(XZ)
|
||||
/// |> startProfileAt([0.05, 0.05], %)
|
||||
/// |> startProfile(at = [0.05, 0.05])
|
||||
/// |> line(end = [0, 7])
|
||||
/// |> tangentialArc(angle = 90, radius = 5)
|
||||
/// |> line(end = [-3, 0])
|
||||
@ -110,7 +110,7 @@ pub async fn sweep(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
/// // Sweep two sketches along the same path.
|
||||
///
|
||||
/// sketch001 = startSketchOn(XY)
|
||||
/// rectangleSketch = startProfileAt([-200, 23.86], sketch001)
|
||||
/// rectangleSketch = startProfile(sketch001, at = [-200, 23.86])
|
||||
/// |> angledLine(angle = 0, length = 73.47, tag = $rectangleSegmentA001)
|
||||
/// |> angledLine(
|
||||
/// angle = segAng(rectangleSegmentA001) - 90,
|
||||
@ -126,7 +126,7 @@ pub async fn sweep(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
/// circleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)
|
||||
///
|
||||
/// sketch002 = startSketchOn(YZ)
|
||||
/// sweepPath = startProfileAt([0, 0], sketch002)
|
||||
/// sweepPath = startProfile(sketch002, at = [0, 0])
|
||||
/// |> yLine(length = 231.81)
|
||||
/// |> tangentialArc(radius = 80, angle = -90)
|
||||
/// |> xLine(length = 384.93)
|
||||
@ -140,7 +140,7 @@ pub async fn sweep(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
/// circleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)
|
||||
///
|
||||
/// sketch002 = startSketchOn('YZ')
|
||||
/// sweepPath = startProfileAt([0, 0], sketch002)
|
||||
/// sweepPath = startProfile(sketch002, at = [0, 0])
|
||||
/// |> yLine(length = 231.81)
|
||||
/// |> tangentialArc(radius = 80, angle = -90)
|
||||
/// |> xLine(length = 384.93)
|
||||
|
@ -76,7 +76,7 @@ pub async fn scale(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
///
|
||||
/// // Create a path for the sweep.
|
||||
/// sweepPath = startSketchOn('XZ')
|
||||
/// |> startProfileAt([0.05, 0.05], %)
|
||||
/// |> startProfile(at = [0.05, 0.05])
|
||||
/// |> line(end = [0, 7])
|
||||
/// |> tangentialArc(angle = 90, radius = 5)
|
||||
/// |> line(end = [-3, 0])
|
||||
@ -117,7 +117,7 @@ pub async fn scale(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
/// // Sweep two sketches along the same path.
|
||||
///
|
||||
/// sketch001 = startSketchOn('XY')
|
||||
/// rectangleSketch = startProfileAt([-200, 23.86], sketch001)
|
||||
/// rectangleSketch = startProfile(sketch001, at = [-200, 23.86])
|
||||
/// |> angledLine(angle = 0, length = 73.47, tag = $rectangleSegmentA001)
|
||||
/// |> angledLine(
|
||||
/// angle = segAng(rectangleSegmentA001) - 90,
|
||||
@ -133,7 +133,7 @@ pub async fn scale(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
/// circleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)
|
||||
///
|
||||
/// sketch002 = startSketchOn('YZ')
|
||||
/// sweepPath = startProfileAt([0, 0], sketch002)
|
||||
/// sweepPath = startProfile(sketch002, at = [0, 0])
|
||||
/// |> yLine(length = 231.81)
|
||||
/// |> tangentialArc(radius = 80, angle = -90)
|
||||
/// |> xLine(length = 384.93)
|
||||
@ -242,7 +242,7 @@ pub async fn translate(exec_state: &mut ExecState, args: Args) -> Result<KclValu
|
||||
///
|
||||
/// // Create a path for the sweep.
|
||||
/// sweepPath = startSketchOn('XZ')
|
||||
/// |> startProfileAt([0.05, 0.05], %)
|
||||
/// |> startProfile(at = [0.05, 0.05])
|
||||
/// |> line(end = [0, 7])
|
||||
/// |> tangentialArc(angle = 90, radius = 5)
|
||||
/// |> line(end = [-3, 0])
|
||||
@ -297,7 +297,7 @@ pub async fn translate(exec_state: &mut ExecState, args: Args) -> Result<KclValu
|
||||
/// // Sweep two sketches along the same path.
|
||||
///
|
||||
/// sketch001 = startSketchOn('XY')
|
||||
/// rectangleSketch = startProfileAt([-200, 23.86], sketch001)
|
||||
/// rectangleSketch = startProfile(sketch001, at = [-200, 23.86])
|
||||
/// |> angledLine(angle = 0, length = 73.47, tag = $rectangleSegmentA001)
|
||||
/// |> angledLine(
|
||||
/// angle = segAng(rectangleSegmentA001) - 90,
|
||||
@ -313,7 +313,7 @@ pub async fn translate(exec_state: &mut ExecState, args: Args) -> Result<KclValu
|
||||
/// circleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)
|
||||
///
|
||||
/// sketch002 = startSketchOn('YZ')
|
||||
/// sweepPath = startProfileAt([0, 0], sketch002)
|
||||
/// sweepPath = startProfile(sketch002, at = [0, 0])
|
||||
/// |> yLine(length = 231.81)
|
||||
/// |> tangentialArc(radius = 80, angle = -90)
|
||||
/// |> xLine(length = 384.93)
|
||||
@ -335,7 +335,7 @@ pub async fn translate(exec_state: &mut ExecState, args: Args) -> Result<KclValu
|
||||
/// p3 = [l, -l]
|
||||
///
|
||||
/// return startSketchOn(XY)
|
||||
/// |> startProfileAt(p0, %)
|
||||
/// |> startProfile(at = p0)
|
||||
/// |> line(endAbsolute = p1)
|
||||
/// |> line(endAbsolute = p2)
|
||||
/// |> line(endAbsolute = p3)
|
||||
@ -357,7 +357,7 @@ pub async fn translate(exec_state: &mut ExecState, args: Args) -> Result<KclValu
|
||||
/// sketch001 = startSketchOn('XY')
|
||||
///
|
||||
/// fn square() {
|
||||
/// return startProfileAt([-10, 10], sketch001)
|
||||
/// return startProfile(sketch001, at = [-10, 10])
|
||||
/// |> xLine(length = 20)
|
||||
/// |> yLine(length = -20)
|
||||
/// |> xLine(length = -20)
|
||||
@ -581,7 +581,7 @@ pub async fn rotate(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
||||
///
|
||||
/// // Create a path for the sweep.
|
||||
/// sweepPath = startSketchOn('XZ')
|
||||
/// |> startProfileAt([0.05, 0.05], %)
|
||||
/// |> startProfile(at = [0.05, 0.05])
|
||||
/// |> line(end = [0, 7])
|
||||
/// |> tangentialArc(angle = 90, radius = 5)
|
||||
/// |> line(end = [-3, 0])
|
||||
@ -614,7 +614,7 @@ pub async fn rotate(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
||||
///
|
||||
/// // Create a path for the sweep.
|
||||
/// sweepPath = startSketchOn('XZ')
|
||||
/// |> startProfileAt([0.05, 0.05], %)
|
||||
/// |> startProfile(at = [0.05, 0.05])
|
||||
/// |> line(end = [0, 7])
|
||||
/// |> tangentialArc(angle = 90, radius = 5)
|
||||
/// |> line(end = [-3, 0])
|
||||
@ -645,7 +645,7 @@ pub async fn rotate(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
||||
///
|
||||
/// // Create a path for the sweep.
|
||||
/// sweepPath = startSketchOn('XZ')
|
||||
/// |> startProfileAt([0.05, 0.05], %)
|
||||
/// |> startProfile(at = [0.05, 0.05])
|
||||
/// |> line(end = [0, 7])
|
||||
/// |> tangentialArc(angle = 90, radius = 5)
|
||||
/// |> line(end = [-3, 0])
|
||||
@ -688,7 +688,7 @@ pub async fn rotate(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
||||
/// // Sweep two sketches along the same path.
|
||||
///
|
||||
/// sketch001 = startSketchOn('XY')
|
||||
/// rectangleSketch = startProfileAt([-200, 23.86], sketch001)
|
||||
/// rectangleSketch = startProfile(sketch001, at = [-200, 23.86])
|
||||
/// |> angledLine(angle = 0, length = 73.47, tag = $rectangleSegmentA001)
|
||||
/// |> angledLine(
|
||||
/// angle = segAng(rectangleSegmentA001) - 90,
|
||||
@ -704,7 +704,7 @@ pub async fn rotate(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
||||
/// circleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)
|
||||
///
|
||||
/// sketch002 = startSketchOn('YZ')
|
||||
/// sweepPath = startProfileAt([0, 0], sketch002)
|
||||
/// sweepPath = startProfile(sketch002, at = [0, 0])
|
||||
/// |> yLine(length = 231.81)
|
||||
/// |> tangentialArc(radius = 80, angle = -90)
|
||||
/// |> xLine(length = 384.93)
|
||||
@ -720,7 +720,7 @@ pub async fn rotate(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
||||
/// sketch001 = startSketchOn('XY')
|
||||
///
|
||||
/// fn square() {
|
||||
/// return startProfileAt([-10, 10], sketch001)
|
||||
/// return startProfile(sketch001, at = [-10, 10])
|
||||
/// |> xLine(length = 20)
|
||||
/// |> yLine(length = -20)
|
||||
/// |> xLine(length = -20)
|
||||
@ -832,7 +832,7 @@ mod tests {
|
||||
use crate::execution::parse_execute;
|
||||
|
||||
const PIPE: &str = r#"sweepPath = startSketchOn('XZ')
|
||||
|> startProfileAt([0.05, 0.05], %)
|
||||
|> startProfile(at = [0.05, 0.05])
|
||||
|> line(end = [0, 7])
|
||||
|> tangentialArc(angle = 90, radius = 5)
|
||||
|> line(end = [-3, 0])
|
||||
|
Reference in New Issue
Block a user