BREAKING: Change array functions to call user function with keyword args (#6779)
* Change array functions to call user function with keyword args * Fix KCL to use keyword params * Remove unneeded positional call code * Update docs * Update output
This commit is contained in:
		| @ -50,7 +50,7 @@ r = 10 // radius | ||||
| // Call `map`, using an anonymous function instead of a named one. | ||||
| circles = map( | ||||
|   [1..3], | ||||
|   f = fn(id) { | ||||
|   f = fn(@id) { | ||||
|     return startSketchOn(XY) | ||||
|       |> circle(center = [id * 2 * r, 0], radius = r) | ||||
|   }, | ||||
|  | ||||
| @ -34,8 +34,8 @@ reduce( | ||||
|  | ||||
| ```kcl | ||||
| // This function adds two numbers. | ||||
| fn add(a, b) { | ||||
|   return a + b | ||||
| fn add(@a, accum) { | ||||
|   return a + accum | ||||
| } | ||||
|  | ||||
| // This function adds an array of numbers. | ||||
| @ -49,7 +49,7 @@ fn sum(@arr) { | ||||
| fn sum(arr): | ||||
|     sumSoFar = 0 | ||||
|     for i in arr: | ||||
|         sumSoFar = add(sumSoFar, i) | ||||
|         sumSoFar = add(i, sumSoFar) | ||||
|     return sumSoFar */ | ||||
|  | ||||
| // We use `assert` to check that our `sum` function gives the | ||||
| @ -72,8 +72,8 @@ arr = [1, 2, 3] | ||||
| sum = reduce( | ||||
|   arr, | ||||
|   initial = 0, | ||||
|   f = fn(i, result_so_far) { | ||||
|     return i + result_so_far | ||||
|   f = fn(@i, accum) { | ||||
|     return i + accum | ||||
|   }, | ||||
| ) | ||||
|  | ||||
| @ -105,11 +105,11 @@ fn decagon(@radius) { | ||||
|   fullDecagon = reduce( | ||||
|     [1..10], | ||||
|     initial = startOfDecagonSketch, | ||||
|     f = fn(i, partialDecagon) { | ||||
|     f = fn(@i, accum) { | ||||
|       // Draw one edge of the decagon. | ||||
|       x = cos(stepAngle * i) * radius | ||||
|       y = sin(stepAngle * i) * radius | ||||
|       return line(partialDecagon, end = [x, y]) | ||||
|       return line(accum, end = [x, y]) | ||||
|     }, | ||||
|   ) | ||||
|  | ||||
|  | ||||
| @ -133826,7 +133826,7 @@ | ||||
|         false | ||||
|       ], | ||||
|       [ | ||||
|         "r = 10 // radius\n// Call `map`, using an anonymous function instead of a named one.\ncircles = map(\n  [1..3],\n  f = fn(id) {\n    return startSketchOn(XY)\n      |> circle(center = [id * 2 * r, 0], radius = r)\n  },\n)", | ||||
|         "r = 10 // radius\n// Call `map`, using an anonymous function instead of a named one.\ncircles = map(\n  [1..3],\n  f = fn(@id) {\n    return startSketchOn(XY)\n      |> circle(center = [id * 2 * r, 0], radius = r)\n  },\n)", | ||||
|         false | ||||
|       ] | ||||
|     ] | ||||
| @ -232586,15 +232586,15 @@ | ||||
|     "deprecated": false, | ||||
|     "examples": [ | ||||
|       [ | ||||
|         "// This function adds two numbers.\nfn add(a, b) {\n  return a + b\n}\n\n// This function adds an array of numbers.\n// It uses the `reduce` function, to call the `add` function on every\n// element of the `arr` parameter. The starting value is 0.\nfn sum(@arr) {\n  return reduce(arr, initial = 0, f = add)\n}\n\n/* The above is basically like this pseudo-code:\nfn sum(arr):\n    sumSoFar = 0\n    for i in arr:\n        sumSoFar = add(sumSoFar, i)\n    return sumSoFar */\n\n// We use `assert` to check that our `sum` function gives the\n// expected result. It's good to check your work!\nassert(\n  sum([1, 2, 3]),\n  isEqualTo = 6,\n  tolerance = 0.1,\n  error = \"1 + 2 + 3 summed is 6\",\n)", | ||||
|         "// This function adds two numbers.\nfn add(@a, accum) {\n  return a + accum\n}\n\n// This function adds an array of numbers.\n// It uses the `reduce` function, to call the `add` function on every\n// element of the `arr` parameter. The starting value is 0.\nfn sum(@arr) {\n  return reduce(arr, initial = 0, f = add)\n}\n\n/* The above is basically like this pseudo-code:\nfn sum(arr):\n    sumSoFar = 0\n    for i in arr:\n        sumSoFar = add(i, sumSoFar)\n    return sumSoFar */\n\n// We use `assert` to check that our `sum` function gives the\n// expected result. It's good to check your work!\nassert(\n  sum([1, 2, 3]),\n  isEqualTo = 6,\n  tolerance = 0.1,\n  error = \"1 + 2 + 3 summed is 6\",\n)", | ||||
|         false | ||||
|       ], | ||||
|       [ | ||||
|         "// This example works just like the previous example above, but it uses\n// an anonymous `add` function as its parameter, instead of declaring a\n// named function outside.\narr = [1, 2, 3]\nsum = reduce(\n  arr,\n  initial = 0,\n  f = fn(i, result_so_far) {\n    return i + result_so_far\n  },\n)\n\n// We use `assert` to check that our `sum` function gives the\n// expected result. It's good to check your work!\nassert(\n  sum,\n  isEqualTo = 6,\n  tolerance = 0.1,\n  error = \"1 + 2 + 3 summed is 6\",\n)", | ||||
|         "// This example works just like the previous example above, but it uses\n// an anonymous `add` function as its parameter, instead of declaring a\n// named function outside.\narr = [1, 2, 3]\nsum = reduce(\n  arr,\n  initial = 0,\n  f = fn(@i, accum) {\n    return i + accum\n  },\n)\n\n// We use `assert` to check that our `sum` function gives the\n// expected result. It's good to check your work!\nassert(\n  sum,\n  isEqualTo = 6,\n  tolerance = 0.1,\n  error = \"1 + 2 + 3 summed is 6\",\n)", | ||||
|         false | ||||
|       ], | ||||
|       [ | ||||
|         "// Declare a function that sketches a decagon.\nfn decagon(@radius) {\n  // Each side of the decagon is turned this many radians from the previous angle.\n  stepAngle = (1 / 10 * TAU): number(rad)\n\n  // Start the decagon sketch at this point.\n  startOfDecagonSketch = startSketchOn(XY)\n    |> startProfile(at = [cos(0) * radius, sin(0) * radius])\n\n    // Use a `reduce` to draw the remaining decagon sides.\n    // For each number in the array 1..10, run the given function,\n  // which takes a partially-sketched decagon and adds one more edge to it.\n  fullDecagon = reduce(\n    [1..10],\n    initial = startOfDecagonSketch,\n    f = fn(i, partialDecagon) {\n      // Draw one edge of the decagon.\n      x = cos(stepAngle * i) * radius\n      y = sin(stepAngle * i) * radius\n      return line(partialDecagon, end = [x, y])\n    },\n  )\n\n  return fullDecagon\n}\n\n/* The `decagon` above is basically like this pseudo-code:\nfn decagon(radius):\n    stepAngle = ((1/10) * TAU): number(rad)\n    plane = startSketchOn(XY)\n    startOfDecagonSketch = startProfile(plane, at = [(cos(0)*radius), (sin(0) * radius)])\n\n    // Here's the reduce part.\n    partialDecagon = startOfDecagonSketch\n    for i in [1..10]:\n        x = cos(stepAngle * i) * radius\n        y = sin(stepAngle * i) * radius\n        partialDecagon = line(partialDecagon, end = [x, y])\n    fullDecagon = partialDecagon // it's now full\n    return fullDecagon */\n\n// Use the `decagon` function declared above, to sketch a decagon with radius 5.\ndecagon(5.0)\n  |> close()", | ||||
|         "// Declare a function that sketches a decagon.\nfn decagon(@radius) {\n  // Each side of the decagon is turned this many radians from the previous angle.\n  stepAngle = (1 / 10 * TAU): number(rad)\n\n  // Start the decagon sketch at this point.\n  startOfDecagonSketch = startSketchOn(XY)\n    |> startProfile(at = [cos(0) * radius, sin(0) * radius])\n\n    // Use a `reduce` to draw the remaining decagon sides.\n    // For each number in the array 1..10, run the given function,\n  // which takes a partially-sketched decagon and adds one more edge to it.\n  fullDecagon = reduce(\n    [1..10],\n    initial = startOfDecagonSketch,\n    f = fn(@i, accum) {\n      // Draw one edge of the decagon.\n      x = cos(stepAngle * i) * radius\n      y = sin(stepAngle * i) * radius\n      return line(accum, end = [x, y])\n    },\n  )\n\n  return fullDecagon\n}\n\n/* The `decagon` above is basically like this pseudo-code:\nfn decagon(radius):\n    stepAngle = ((1/10) * TAU): number(rad)\n    plane = startSketchOn(XY)\n    startOfDecagonSketch = startProfile(plane, at = [(cos(0)*radius), (sin(0) * radius)])\n\n    // Here's the reduce part.\n    partialDecagon = startOfDecagonSketch\n    for i in [1..10]:\n        x = cos(stepAngle * i) * radius\n        y = sin(stepAngle * i) * radius\n        partialDecagon = line(partialDecagon, end = [x, y])\n    fullDecagon = partialDecagon // it's now full\n    return fullDecagon */\n\n// Use the `decagon` function declared above, to sketch a decagon with radius 5.\ndecagon(5.0)\n  |> close()", | ||||
|         false | ||||
|       ] | ||||
|     ] | ||||
|  | ||||
| @ -51,7 +51,7 @@ faceRotations = [ | ||||
| // Create faces by mapping over the rotations array | ||||
| dodecFaces = map( | ||||
|   faceRotations, | ||||
|   f = fn(rotation) { | ||||
|   f = fn(@rotation) { | ||||
|     return createFaceTemplate(rotation[3]) | ||||
|       |> rotate( | ||||
|            pitch = rotation[0], | ||||
| @ -66,15 +66,15 @@ fn calculateArrayLength(@arr) { | ||||
|   return reduce( | ||||
|     arr, | ||||
|     initial = 0, | ||||
|     f = fn(item, accumulator) { | ||||
|       return accumulator + 1 | ||||
|     f = fn(@item, accum) { | ||||
|       return accum + 1 | ||||
|     }, | ||||
|   ) | ||||
| } | ||||
|  | ||||
| fn createIntersection(@solids) { | ||||
|   fn reduceIntersect(previous, current) { | ||||
|     return intersect([previous, current]) | ||||
|   fn reduceIntersect(@previous, accum) { | ||||
|     return intersect([previous, accum]) | ||||
|   } | ||||
|   lastIndex = calculateArrayLength(solids) - 1 | ||||
|   lastSolid = solids[lastIndex] | ||||
|  | ||||
| @ -19,7 +19,7 @@ gearHeight = 3 | ||||
| cmo = 101 | ||||
| rs = map( | ||||
|   [0..cmo], | ||||
|   f = fn(i) { | ||||
|   f = fn(@i) { | ||||
|     return baseDiameter / 2 + i / cmo * (tipDiameter - baseDiameter) / 2 | ||||
|   }, | ||||
| ) | ||||
| @ -27,7 +27,7 @@ rs = map( | ||||
| // Calculate operating pressure angle | ||||
| angles = map( | ||||
|   rs, | ||||
|   f = fn(r) { | ||||
|   f = fn(@r) { | ||||
|     return units::toDegrees(acos(baseDiameter / 2 / r)) | ||||
|   }, | ||||
| ) | ||||
| @ -35,7 +35,7 @@ angles = map( | ||||
| // Calculate the involute function | ||||
| invas = map( | ||||
|   angles, | ||||
|   f = fn(a) { | ||||
|   f = fn(@a) { | ||||
|     return tan(a) - units::toRadians(a) | ||||
|   }, | ||||
| ) | ||||
| @ -43,14 +43,14 @@ invas = map( | ||||
| // Map the involute curve | ||||
| xs = map( | ||||
|   [0..cmo], | ||||
|   f = fn(i) { | ||||
|   f = fn(@i) { | ||||
|     return rs[i] * cos(invas[i]: number(rad)) | ||||
|   }, | ||||
| ) | ||||
|  | ||||
| ys = map( | ||||
|   [0..cmo], | ||||
|   f = fn(i) { | ||||
|   f = fn(@i) { | ||||
|     return rs[i] * sin(invas[i]: number(rad)) | ||||
|   }, | ||||
| ) | ||||
| @ -63,15 +63,15 @@ body = startSketchOn(XY) | ||||
| toothAngle = 360 / nTeeth / 1.5 | ||||
|  | ||||
| // Plot the involute curve | ||||
| fn leftInvolute(i, sg) { | ||||
| fn leftInvolute(@i, accum) { | ||||
|   j = 100 - i // iterate backwards | ||||
|   return line(sg, endAbsolute = [xs[j], ys[j]]) | ||||
|   return line(accum, endAbsolute = [xs[j], ys[j]]) | ||||
| } | ||||
|  | ||||
| fn rightInvolute(i, sg) { | ||||
| fn rightInvolute(@i, accum) { | ||||
|   x = rs[i] * cos(-toothAngle + units::toDegrees(atan(ys[i] / xs[i]))) | ||||
|   y = -rs[i] * sin(-toothAngle + units::toDegrees(atan(ys[i] / xs[i]))) | ||||
|   return line(sg, endAbsolute = [x, y]) | ||||
|   return line(accum, endAbsolute = [x, y]) | ||||
| } | ||||
|  | ||||
| // Draw gear teeth | ||||
|  | ||||
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB | 
| @ -1835,89 +1835,6 @@ impl Node<PipeExpression> { | ||||
|     } | ||||
| } | ||||
|  | ||||
| /// For each argument given, | ||||
| /// assign it to a parameter of the function, in the given block of function memory. | ||||
| /// Returns Err if too few/too many arguments were given for the function. | ||||
| fn assign_args_to_params( | ||||
|     function_expression: NodeRef<'_, FunctionExpression>, | ||||
|     args: Vec<Arg>, | ||||
|     exec_state: &mut ExecState, | ||||
| ) -> Result<(), KclError> { | ||||
|     let num_args = function_expression.number_of_args(); | ||||
|     let (min_params, max_params) = num_args.into_inner(); | ||||
|     let n = args.len(); | ||||
|  | ||||
|     // Check if the user supplied too many arguments | ||||
|     // (we'll check for too few arguments below). | ||||
|     let err_wrong_number_args = KclError::Semantic(KclErrorDetails { | ||||
|         message: if min_params == max_params { | ||||
|             format!("Expected {min_params} arguments, got {n}") | ||||
|         } else { | ||||
|             format!("Expected {min_params}-{max_params} arguments, got {n}") | ||||
|         }, | ||||
|         source_ranges: vec![function_expression.into()], | ||||
|     }); | ||||
|     if n > max_params { | ||||
|         return Err(err_wrong_number_args); | ||||
|     } | ||||
|  | ||||
|     // Add the arguments to the memory.  A new call frame should have already | ||||
|     // been created. | ||||
|     for (index, param) in function_expression.params.iter().enumerate() { | ||||
|         if let Some(arg) = args.get(index) { | ||||
|             // Argument was provided. | ||||
|  | ||||
|             if let Some(ty) = ¶m.type_ { | ||||
|                 let value = arg | ||||
|                         .value | ||||
|                         .coerce( | ||||
|                             &RuntimeType::from_parsed(ty.inner.clone(), exec_state, arg.source_range).unwrap(), | ||||
|                             exec_state, | ||||
|                         ) | ||||
|                         .map_err(|e| { | ||||
|                             let mut message = format!( | ||||
|                                 "Argument requires a value with type `{}`, but found {}", | ||||
|                                 ty.inner, | ||||
|                                 arg.value.human_friendly_type(), | ||||
|                             ); | ||||
|                             if let Some(ty) = e.explicit_coercion { | ||||
|                                 // TODO if we have access to the AST for the argument we could choose which example to suggest. | ||||
|                                 message = format!("{message}\n\nYou may need to add information about the type of the argument, for example:\n  using a numeric suffix: `42{ty}`\n  or using type ascription: `foo(): number({ty})`"); | ||||
|                             } | ||||
|                             KclError::Semantic(KclErrorDetails { | ||||
|                                 message, | ||||
|                                 source_ranges: vec![arg.source_range], | ||||
|                             }) | ||||
|                         })?; | ||||
|                 exec_state | ||||
|                     .mut_stack() | ||||
|                     .add(param.identifier.name.clone(), value, (¶m.identifier).into())?; | ||||
|             } else { | ||||
|                 exec_state.mut_stack().add( | ||||
|                     param.identifier.name.clone(), | ||||
|                     arg.value.clone(), | ||||
|                     (¶m.identifier).into(), | ||||
|                 )?; | ||||
|             } | ||||
|         } else { | ||||
|             // Argument was not provided. | ||||
|             if let Some(ref default_val) = param.default_value { | ||||
|                 // If the corresponding parameter is optional, | ||||
|                 // then it's fine, the user doesn't need to supply it. | ||||
|                 let value = KclValue::from_default_param(default_val.clone(), exec_state); | ||||
|                 exec_state | ||||
|                     .mut_stack() | ||||
|                     .add(param.identifier.name.clone(), value, (¶m.identifier).into())?; | ||||
|             } else { | ||||
|                 // But if the corresponding parameter was required, | ||||
|                 // then the user has called with too few arguments. | ||||
|                 return Err(err_wrong_number_args); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|     Ok(()) | ||||
| } | ||||
|  | ||||
| fn type_check_params_kw( | ||||
|     fn_name: Option<&str>, | ||||
|     function_expression: NodeRef<'_, FunctionExpression>, | ||||
| @ -2102,42 +2019,6 @@ fn coerce_result_type( | ||||
|     } | ||||
| } | ||||
|  | ||||
| async fn call_user_defined_function( | ||||
|     args: Vec<Arg>, | ||||
|     memory: EnvironmentRef, | ||||
|     function_expression: NodeRef<'_, FunctionExpression>, | ||||
|     exec_state: &mut ExecState, | ||||
|     ctx: &ExecutorContext, | ||||
| ) -> Result<Option<KclValue>, KclError> { | ||||
|     // Create a new environment to execute the function body in so that local | ||||
|     // variables shadow variables in the parent scope.  The new environment's | ||||
|     // parent should be the environment of the closure. | ||||
|     exec_state.mut_stack().push_new_env_for_call(memory); | ||||
|     if let Err(e) = assign_args_to_params(function_expression, args, exec_state) { | ||||
|         exec_state.mut_stack().pop_env(); | ||||
|         return Err(e); | ||||
|     } | ||||
|  | ||||
|     // Execute the function body using the memory we just created. | ||||
|     let result = ctx | ||||
|         .exec_block(&function_expression.body, exec_state, BodyType::Block) | ||||
|         .await; | ||||
|     let mut result = result.map(|_| { | ||||
|         exec_state | ||||
|             .stack() | ||||
|             .get(memory::RETURN_NAME, function_expression.as_source_range()) | ||||
|             .ok() | ||||
|             .cloned() | ||||
|     }); | ||||
|  | ||||
|     result = coerce_result_type(result, function_expression, exec_state); | ||||
|  | ||||
|     // Restore the previous memory. | ||||
|     exec_state.mut_stack().pop_env(); | ||||
|  | ||||
|     result | ||||
| } | ||||
|  | ||||
| async fn call_user_defined_function_kw( | ||||
|     fn_name: Option<&str>, | ||||
|     args: crate::std::args::KwArgs, | ||||
| @ -2176,41 +2057,6 @@ async fn call_user_defined_function_kw( | ||||
| } | ||||
|  | ||||
| impl FunctionSource { | ||||
|     pub async fn call( | ||||
|         &self, | ||||
|         fn_name: Option<String>, | ||||
|         exec_state: &mut ExecState, | ||||
|         ctx: &ExecutorContext, | ||||
|         mut args: Vec<Arg>, | ||||
|         callsite: SourceRange, | ||||
|     ) -> Result<Option<KclValue>, KclError> { | ||||
|         match self { | ||||
|             FunctionSource::Std { props, .. } => { | ||||
|                 if args.len() <= 1 { | ||||
|                     let args = crate::std::Args::new_kw( | ||||
|                         KwArgs { | ||||
|                             unlabeled: args.pop(), | ||||
|                             labeled: IndexMap::new(), | ||||
|                         }, | ||||
|                         callsite, | ||||
|                         ctx.clone(), | ||||
|                         exec_state.pipe_value().map(|v| Arg::new(v.clone(), callsite)), | ||||
|                     ); | ||||
|                     self.call_kw(fn_name, exec_state, ctx, args, callsite).await | ||||
|                 } else { | ||||
|                     Err(KclError::Semantic(KclErrorDetails { | ||||
|                         message: format!("{} requires its arguments to be labelled", props.name), | ||||
|                         source_ranges: vec![callsite], | ||||
|                     })) | ||||
|                 } | ||||
|             } | ||||
|             FunctionSource::User { ast, memory, .. } => { | ||||
|                 call_user_defined_function(args, *memory, ast, exec_state, ctx).await | ||||
|             } | ||||
|             FunctionSource::None => unreachable!(), | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     pub async fn call_kw( | ||||
|         &self, | ||||
|         fn_name: Option<String>, | ||||
| @ -2404,7 +2250,7 @@ mod test { | ||||
|             ( | ||||
|                 "all params required, and all given, should be OK", | ||||
|                 vec![req_param("x")], | ||||
|                 vec![mem(1)], | ||||
|                 vec![("x", mem(1))], | ||||
|                 Ok(additional_program_memory(&[("x".to_owned(), mem(1))])), | ||||
|             ), | ||||
|             ( | ||||
| @ -2413,7 +2259,7 @@ mod test { | ||||
|                 vec![], | ||||
|                 Err(KclError::Semantic(KclErrorDetails { | ||||
|                     source_ranges: vec![SourceRange::default()], | ||||
|                     message: "Expected 1 arguments, got 0".to_owned(), | ||||
|                     message: "This function requires a parameter x, but you haven't passed it one.".to_owned(), | ||||
|                 })), | ||||
|             ), | ||||
|             ( | ||||
| @ -2428,13 +2274,13 @@ mod test { | ||||
|                 vec![], | ||||
|                 Err(KclError::Semantic(KclErrorDetails { | ||||
|                     source_ranges: vec![SourceRange::default()], | ||||
|                     message: "Expected 1-2 arguments, got 0".to_owned(), | ||||
|                     message: "This function requires a parameter x, but you haven't passed it one.".to_owned(), | ||||
|                 })), | ||||
|             ), | ||||
|             ( | ||||
|                 "mixed params, minimum given, should be OK", | ||||
|                 vec![req_param("x"), opt_param("y")], | ||||
|                 vec![mem(1)], | ||||
|                 vec![("x", mem(1))], | ||||
|                 Ok(additional_program_memory(&[ | ||||
|                     ("x".to_owned(), mem(1)), | ||||
|                     ("y".to_owned(), KclValue::none()), | ||||
| @ -2443,21 +2289,12 @@ mod test { | ||||
|             ( | ||||
|                 "mixed params, maximum given, should be OK", | ||||
|                 vec![req_param("x"), opt_param("y")], | ||||
|                 vec![mem(1), mem(2)], | ||||
|                 vec![("x", mem(1)), ("y", mem(2))], | ||||
|                 Ok(additional_program_memory(&[ | ||||
|                     ("x".to_owned(), mem(1)), | ||||
|                     ("y".to_owned(), mem(2)), | ||||
|                 ])), | ||||
|             ), | ||||
|             ( | ||||
|                 "mixed params, too many given", | ||||
|                 vec![req_param("x"), opt_param("y")], | ||||
|                 vec![mem(1), mem(2), mem(3)], | ||||
|                 Err(KclError::Semantic(KclErrorDetails { | ||||
|                     source_ranges: vec![SourceRange::default()], | ||||
|                     message: "Expected 1-2 arguments, got 3".to_owned(), | ||||
|                 })), | ||||
|             ), | ||||
|         ] { | ||||
|             // Run each test. | ||||
|             let func_expr = &Node::no_src(FunctionExpression { | ||||
| @ -2466,7 +2303,17 @@ mod test { | ||||
|                 return_type: None, | ||||
|                 digest: None, | ||||
|             }); | ||||
|             let args = args.into_iter().map(Arg::synthetic).collect(); | ||||
|             let labeled = args | ||||
|                 .iter() | ||||
|                 .map(|(name, value)| { | ||||
|                     let arg = Arg::new(value.clone(), SourceRange::default()); | ||||
|                     ((*name).to_owned(), arg) | ||||
|                 }) | ||||
|                 .collect::<IndexMap<_, _>>(); | ||||
|             let args = KwArgs { | ||||
|                 unlabeled: None, | ||||
|                 labeled, | ||||
|             }; | ||||
|             let exec_ctxt = ExecutorContext { | ||||
|                 engine: Arc::new(Box::new( | ||||
|                     crate::engine::conn_mock::EngineConnection::new().await.unwrap(), | ||||
| @ -2478,7 +2325,8 @@ mod test { | ||||
|             }; | ||||
|             let mut exec_state = ExecState::new(&exec_ctxt); | ||||
|             exec_state.mod_local.stack = Stack::new_for_tests(); | ||||
|             let actual = assign_args_to_params(func_expr, args, &mut exec_state).map(|_| exec_state.mod_local.stack); | ||||
|             let actual = | ||||
|                 assign_args_to_params_kw(None, func_expr, args, &mut exec_state).map(|_| exec_state.mod_local.stack); | ||||
|             assert_eq!( | ||||
|                 actual, expected, | ||||
|                 "failed test '{test_name}':\ngot {actual:?}\nbut expected\n{expected:?}" | ||||
|  | ||||
| @ -1,6 +1,10 @@ | ||||
| use indexmap::IndexMap; | ||||
| use kcl_derive_docs::stdlib; | ||||
|  | ||||
| use super::{args::Arg, Args}; | ||||
| use super::{ | ||||
|     args::{Arg, KwArgs}, | ||||
|     Args, | ||||
| }; | ||||
| use crate::{ | ||||
|     errors::{KclError, KclErrorDetails}, | ||||
|     execution::{ | ||||
| @ -44,7 +48,7 @@ pub async fn map(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kcl | ||||
| /// // Call `map`, using an anonymous function instead of a named one. | ||||
| /// circles = map( | ||||
| ///   [1..3], | ||||
| ///   f = fn(id) { | ||||
| ///   f = fn(@id) { | ||||
| ///     return startSketchOn(XY) | ||||
| ///       |> circle( center= [id * 2 * r, 0], radius= r) | ||||
| ///   } | ||||
| @ -81,9 +85,17 @@ async fn call_map_closure( | ||||
|     exec_state: &mut ExecState, | ||||
|     ctxt: &ExecutorContext, | ||||
| ) -> Result<KclValue, KclError> { | ||||
|     let output = map_fn | ||||
|         .call(None, exec_state, ctxt, vec![Arg::synthetic(input)], source_range) | ||||
|         .await?; | ||||
|     let kw_args = KwArgs { | ||||
|         unlabeled: Some(Arg::new(input, source_range)), | ||||
|         labeled: Default::default(), | ||||
|     }; | ||||
|     let args = Args::new_kw( | ||||
|         kw_args, | ||||
|         source_range, | ||||
|         ctxt.clone(), | ||||
|         exec_state.pipe_value().map(|v| Arg::new(v.clone(), source_range)), | ||||
|     ); | ||||
|     let output = map_fn.call_kw(None, exec_state, ctxt, args, source_range).await?; | ||||
|     let source_ranges = vec![source_range]; | ||||
|     let output = output.ok_or_else(|| { | ||||
|         KclError::Semantic(KclErrorDetails { | ||||
| @ -106,7 +118,7 @@ pub async fn reduce(exec_state: &mut ExecState, args: Args) -> Result<KclValue, | ||||
| /// using the previous value and the element. | ||||
| /// ```no_run | ||||
| /// // This function adds two numbers. | ||||
| /// fn add(a, b) { return a + b } | ||||
| /// fn add(@a, accum) { return a + accum } | ||||
| /// | ||||
| /// // This function adds an array of numbers. | ||||
| /// // It uses the `reduce` function, to call the `add` function on every | ||||
| @ -118,7 +130,7 @@ pub async fn reduce(exec_state: &mut ExecState, args: Args) -> Result<KclValue, | ||||
| /// fn sum(arr): | ||||
| ///     sumSoFar = 0 | ||||
| ///     for i in arr: | ||||
| ///         sumSoFar = add(sumSoFar, i) | ||||
| ///         sumSoFar = add(i, sumSoFar) | ||||
| ///     return sumSoFar | ||||
| /// */ | ||||
| /// | ||||
| @ -131,7 +143,7 @@ pub async fn reduce(exec_state: &mut ExecState, args: Args) -> Result<KclValue, | ||||
| /// // an anonymous `add` function as its parameter, instead of declaring a | ||||
| /// // named function outside. | ||||
| /// arr = [1, 2, 3] | ||||
| /// sum = reduce(arr, initial = 0, f = fn (i, result_so_far) { return i + result_so_far }) | ||||
| /// sum = reduce(arr, initial = 0, f = fn (@i, accum) { return i + accum }) | ||||
| /// | ||||
| /// // We use `assert` to check that our `sum` function gives the | ||||
| /// // expected result. It's good to check your work! | ||||
| @ -150,11 +162,11 @@ pub async fn reduce(exec_state: &mut ExecState, args: Args) -> Result<KclValue, | ||||
| ///   // Use a `reduce` to draw the remaining decagon sides. | ||||
| ///   // For each number in the array 1..10, run the given function, | ||||
| ///   // which takes a partially-sketched decagon and adds one more edge to it. | ||||
| ///   fullDecagon = reduce([1..10], initial = startOfDecagonSketch, f = fn(i, partialDecagon) { | ||||
| ///   fullDecagon = reduce([1..10], initial = startOfDecagonSketch, f = fn(@i, accum) { | ||||
| ///       // Draw one edge of the decagon. | ||||
| ///       x = cos(stepAngle * i) * radius | ||||
| ///       y = sin(stepAngle * i) * radius | ||||
| ///       return line(partialDecagon, end = [x, y]) | ||||
| ///       return line(accum, end = [x, y]) | ||||
| ///   }) | ||||
| /// | ||||
| ///   return fullDecagon | ||||
| @ -209,16 +221,27 @@ async fn inner_reduce<'a>( | ||||
|  | ||||
| async fn call_reduce_closure( | ||||
|     elem: KclValue, | ||||
|     start: KclValue, | ||||
|     accum: KclValue, | ||||
|     reduce_fn: &FunctionSource, | ||||
|     source_range: SourceRange, | ||||
|     exec_state: &mut ExecState, | ||||
|     ctxt: &ExecutorContext, | ||||
| ) -> Result<KclValue, KclError> { | ||||
|     // Call the reduce fn for this repetition. | ||||
|     let reduce_fn_args = vec![Arg::synthetic(elem), Arg::synthetic(start)]; | ||||
|     let mut labeled = IndexMap::with_capacity(1); | ||||
|     labeled.insert("accum".to_string(), Arg::new(accum, source_range)); | ||||
|     let kw_args = KwArgs { | ||||
|         unlabeled: Some(Arg::new(elem, source_range)), | ||||
|         labeled, | ||||
|     }; | ||||
|     let reduce_fn_args = Args::new_kw( | ||||
|         kw_args, | ||||
|         source_range, | ||||
|         ctxt.clone(), | ||||
|         exec_state.pipe_value().map(|v| Arg::new(v.clone(), source_range)), | ||||
|     ); | ||||
|     let transform_fn_return = reduce_fn | ||||
|         .call(None, exec_state, ctxt, reduce_fn_args, source_range) | ||||
|         .call_kw(None, exec_state, ctxt, reduce_fn_args, source_range) | ||||
|         .await?; | ||||
|  | ||||
|     // Unpack the returned transform object. | ||||
|  | ||||
| @ -2532,7 +2532,7 @@ sketch002 = startSketchOn({ | ||||
|         let input = r#"squares_out = reduce( | ||||
|   arr, | ||||
|   n = 0: number, | ||||
|   f = fn(i, squares) { | ||||
|   f = fn(@i, accum) { | ||||
|     return 1 | ||||
|   }, | ||||
| ) | ||||
|  | ||||
| @ -1,5 +1,150 @@ | ||||
| --- | ||||
| source: kcl/src/simulation_tests.rs | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Operations executed double_map_fn.kcl | ||||
| --- | ||||
| [] | ||||
| [ | ||||
|   { | ||||
|     "type": "GroupBegin", | ||||
|     "group": { | ||||
|       "type": "FunctionCall", | ||||
|       "name": null, | ||||
|       "functionSourceRange": [], | ||||
|       "unlabeledArg": { | ||||
|         "value": { | ||||
|           "type": "Number", | ||||
|           "value": 0.0, | ||||
|           "ty": { | ||||
|             "type": "Known", | ||||
|             "type": "Count" | ||||
|           } | ||||
|         }, | ||||
|         "sourceRange": [] | ||||
|       }, | ||||
|       "labeledArgs": {} | ||||
|     }, | ||||
|     "sourceRange": [] | ||||
|   }, | ||||
|   { | ||||
|     "type": "GroupBegin", | ||||
|     "group": { | ||||
|       "type": "FunctionCall", | ||||
|       "name": null, | ||||
|       "functionSourceRange": [], | ||||
|       "unlabeledArg": { | ||||
|         "value": { | ||||
|           "type": "Number", | ||||
|           "value": 1.0, | ||||
|           "ty": { | ||||
|             "type": "Known", | ||||
|             "type": "Count" | ||||
|           } | ||||
|         }, | ||||
|         "sourceRange": [] | ||||
|       }, | ||||
|       "labeledArgs": {} | ||||
|     }, | ||||
|     "sourceRange": [] | ||||
|   }, | ||||
|   { | ||||
|     "type": "GroupBegin", | ||||
|     "group": { | ||||
|       "type": "FunctionCall", | ||||
|       "name": null, | ||||
|       "functionSourceRange": [], | ||||
|       "unlabeledArg": { | ||||
|         "value": { | ||||
|           "type": "Number", | ||||
|           "value": 2.0, | ||||
|           "ty": { | ||||
|             "type": "Known", | ||||
|             "type": "Count" | ||||
|           } | ||||
|         }, | ||||
|         "sourceRange": [] | ||||
|       }, | ||||
|       "labeledArgs": {} | ||||
|     }, | ||||
|     "sourceRange": [] | ||||
|   }, | ||||
|   { | ||||
|     "type": "GroupBegin", | ||||
|     "group": { | ||||
|       "type": "FunctionCall", | ||||
|       "name": null, | ||||
|       "functionSourceRange": [], | ||||
|       "unlabeledArg": { | ||||
|         "value": { | ||||
|           "type": "Number", | ||||
|           "value": 1.0, | ||||
|           "ty": { | ||||
|             "type": "Known", | ||||
|             "type": "Count" | ||||
|           } | ||||
|         }, | ||||
|         "sourceRange": [] | ||||
|       }, | ||||
|       "labeledArgs": {} | ||||
|     }, | ||||
|     "sourceRange": [] | ||||
|   }, | ||||
|   { | ||||
|     "type": "GroupBegin", | ||||
|     "group": { | ||||
|       "type": "FunctionCall", | ||||
|       "name": null, | ||||
|       "functionSourceRange": [], | ||||
|       "unlabeledArg": { | ||||
|         "value": { | ||||
|           "type": "Number", | ||||
|           "value": 2.0, | ||||
|           "ty": { | ||||
|             "type": "Known", | ||||
|             "type": "Count" | ||||
|           } | ||||
|         }, | ||||
|         "sourceRange": [] | ||||
|       }, | ||||
|       "labeledArgs": {} | ||||
|     }, | ||||
|     "sourceRange": [] | ||||
|   }, | ||||
|   { | ||||
|     "type": "GroupBegin", | ||||
|     "group": { | ||||
|       "type": "FunctionCall", | ||||
|       "name": null, | ||||
|       "functionSourceRange": [], | ||||
|       "unlabeledArg": { | ||||
|         "value": { | ||||
|           "type": "Number", | ||||
|           "value": 3.0, | ||||
|           "ty": { | ||||
|             "type": "Known", | ||||
|             "type": "Count" | ||||
|           } | ||||
|         }, | ||||
|         "sourceRange": [] | ||||
|       }, | ||||
|       "labeledArgs": {} | ||||
|     }, | ||||
|     "sourceRange": [] | ||||
|   }, | ||||
|   { | ||||
|     "type": "GroupEnd" | ||||
|   }, | ||||
|   { | ||||
|     "type": "GroupEnd" | ||||
|   }, | ||||
|   { | ||||
|     "type": "GroupEnd" | ||||
|   }, | ||||
|   { | ||||
|     "type": "GroupEnd" | ||||
|   }, | ||||
|   { | ||||
|     "type": "GroupEnd" | ||||
|   }, | ||||
|   { | ||||
|     "type": "GroupEnd" | ||||
|   } | ||||
| ] | ||||
|  | ||||
| @ -1,235 +1,235 @@ | ||||
| ```mermaid | ||||
| flowchart LR | ||||
|   subgraph path5 [Path] | ||||
|     5["Path<br>[1091, 1141, 0]"] | ||||
|     8["Segment<br>[1091, 1141, 0]"] | ||||
|     5["Path<br>[1096, 1146, 0]"] | ||||
|     8["Segment<br>[1096, 1146, 0]"] | ||||
|     220[Solid2d] | ||||
|   end | ||||
|   subgraph path6 [Path] | ||||
|     6["Path<br>[1610, 1647, 0]"] | ||||
|     9["Segment<br>[1306, 1344, 0]"] | ||||
|     10["Segment<br>[1306, 1344, 0]"] | ||||
|     11["Segment<br>[1306, 1344, 0]"] | ||||
|     12["Segment<br>[1306, 1344, 0]"] | ||||
|     13["Segment<br>[1306, 1344, 0]"] | ||||
|     14["Segment<br>[1306, 1344, 0]"] | ||||
|     15["Segment<br>[1306, 1344, 0]"] | ||||
|     16["Segment<br>[1306, 1344, 0]"] | ||||
|     17["Segment<br>[1306, 1344, 0]"] | ||||
|     18["Segment<br>[1306, 1344, 0]"] | ||||
|     19["Segment<br>[1306, 1344, 0]"] | ||||
|     20["Segment<br>[1306, 1344, 0]"] | ||||
|     21["Segment<br>[1306, 1344, 0]"] | ||||
|     22["Segment<br>[1306, 1344, 0]"] | ||||
|     23["Segment<br>[1306, 1344, 0]"] | ||||
|     24["Segment<br>[1306, 1344, 0]"] | ||||
|     25["Segment<br>[1306, 1344, 0]"] | ||||
|     26["Segment<br>[1306, 1344, 0]"] | ||||
|     27["Segment<br>[1306, 1344, 0]"] | ||||
|     28["Segment<br>[1306, 1344, 0]"] | ||||
|     29["Segment<br>[1306, 1344, 0]"] | ||||
|     30["Segment<br>[1306, 1344, 0]"] | ||||
|     31["Segment<br>[1306, 1344, 0]"] | ||||
|     32["Segment<br>[1306, 1344, 0]"] | ||||
|     33["Segment<br>[1306, 1344, 0]"] | ||||
|     34["Segment<br>[1306, 1344, 0]"] | ||||
|     35["Segment<br>[1306, 1344, 0]"] | ||||
|     36["Segment<br>[1306, 1344, 0]"] | ||||
|     37["Segment<br>[1306, 1344, 0]"] | ||||
|     38["Segment<br>[1306, 1344, 0]"] | ||||
|     39["Segment<br>[1306, 1344, 0]"] | ||||
|     40["Segment<br>[1306, 1344, 0]"] | ||||
|     41["Segment<br>[1306, 1344, 0]"] | ||||
|     42["Segment<br>[1306, 1344, 0]"] | ||||
|     43["Segment<br>[1306, 1344, 0]"] | ||||
|     44["Segment<br>[1306, 1344, 0]"] | ||||
|     45["Segment<br>[1306, 1344, 0]"] | ||||
|     46["Segment<br>[1306, 1344, 0]"] | ||||
|     47["Segment<br>[1306, 1344, 0]"] | ||||
|     48["Segment<br>[1306, 1344, 0]"] | ||||
|     49["Segment<br>[1306, 1344, 0]"] | ||||
|     50["Segment<br>[1306, 1344, 0]"] | ||||
|     51["Segment<br>[1306, 1344, 0]"] | ||||
|     52["Segment<br>[1306, 1344, 0]"] | ||||
|     53["Segment<br>[1306, 1344, 0]"] | ||||
|     54["Segment<br>[1306, 1344, 0]"] | ||||
|     55["Segment<br>[1306, 1344, 0]"] | ||||
|     56["Segment<br>[1306, 1344, 0]"] | ||||
|     57["Segment<br>[1306, 1344, 0]"] | ||||
|     58["Segment<br>[1306, 1344, 0]"] | ||||
|     59["Segment<br>[1306, 1344, 0]"] | ||||
|     60["Segment<br>[1306, 1344, 0]"] | ||||
|     61["Segment<br>[1306, 1344, 0]"] | ||||
|     62["Segment<br>[1306, 1344, 0]"] | ||||
|     63["Segment<br>[1306, 1344, 0]"] | ||||
|     64["Segment<br>[1306, 1344, 0]"] | ||||
|     65["Segment<br>[1306, 1344, 0]"] | ||||
|     66["Segment<br>[1306, 1344, 0]"] | ||||
|     67["Segment<br>[1306, 1344, 0]"] | ||||
|     68["Segment<br>[1306, 1344, 0]"] | ||||
|     69["Segment<br>[1306, 1344, 0]"] | ||||
|     70["Segment<br>[1306, 1344, 0]"] | ||||
|     71["Segment<br>[1306, 1344, 0]"] | ||||
|     72["Segment<br>[1306, 1344, 0]"] | ||||
|     73["Segment<br>[1306, 1344, 0]"] | ||||
|     74["Segment<br>[1306, 1344, 0]"] | ||||
|     75["Segment<br>[1306, 1344, 0]"] | ||||
|     76["Segment<br>[1306, 1344, 0]"] | ||||
|     77["Segment<br>[1306, 1344, 0]"] | ||||
|     78["Segment<br>[1306, 1344, 0]"] | ||||
|     79["Segment<br>[1306, 1344, 0]"] | ||||
|     80["Segment<br>[1306, 1344, 0]"] | ||||
|     81["Segment<br>[1306, 1344, 0]"] | ||||
|     82["Segment<br>[1306, 1344, 0]"] | ||||
|     83["Segment<br>[1306, 1344, 0]"] | ||||
|     84["Segment<br>[1306, 1344, 0]"] | ||||
|     85["Segment<br>[1306, 1344, 0]"] | ||||
|     86["Segment<br>[1306, 1344, 0]"] | ||||
|     87["Segment<br>[1306, 1344, 0]"] | ||||
|     88["Segment<br>[1306, 1344, 0]"] | ||||
|     89["Segment<br>[1306, 1344, 0]"] | ||||
|     90["Segment<br>[1306, 1344, 0]"] | ||||
|     91["Segment<br>[1306, 1344, 0]"] | ||||
|     92["Segment<br>[1306, 1344, 0]"] | ||||
|     93["Segment<br>[1306, 1344, 0]"] | ||||
|     94["Segment<br>[1306, 1344, 0]"] | ||||
|     95["Segment<br>[1306, 1344, 0]"] | ||||
|     96["Segment<br>[1306, 1344, 0]"] | ||||
|     97["Segment<br>[1306, 1344, 0]"] | ||||
|     98["Segment<br>[1306, 1344, 0]"] | ||||
|     99["Segment<br>[1306, 1344, 0]"] | ||||
|     100["Segment<br>[1306, 1344, 0]"] | ||||
|     101["Segment<br>[1306, 1344, 0]"] | ||||
|     102["Segment<br>[1306, 1344, 0]"] | ||||
|     103["Segment<br>[1306, 1344, 0]"] | ||||
|     104["Segment<br>[1306, 1344, 0]"] | ||||
|     105["Segment<br>[1306, 1344, 0]"] | ||||
|     106["Segment<br>[1306, 1344, 0]"] | ||||
|     107["Segment<br>[1306, 1344, 0]"] | ||||
|     108["Segment<br>[1306, 1344, 0]"] | ||||
|     109["Segment<br>[1306, 1344, 0]"] | ||||
|     110["Segment<br>[1526, 1556, 0]"] | ||||
|     111["Segment<br>[1526, 1556, 0]"] | ||||
|     112["Segment<br>[1526, 1556, 0]"] | ||||
|     113["Segment<br>[1526, 1556, 0]"] | ||||
|     114["Segment<br>[1526, 1556, 0]"] | ||||
|     115["Segment<br>[1526, 1556, 0]"] | ||||
|     116["Segment<br>[1526, 1556, 0]"] | ||||
|     117["Segment<br>[1526, 1556, 0]"] | ||||
|     118["Segment<br>[1526, 1556, 0]"] | ||||
|     119["Segment<br>[1526, 1556, 0]"] | ||||
|     120["Segment<br>[1526, 1556, 0]"] | ||||
|     121["Segment<br>[1526, 1556, 0]"] | ||||
|     122["Segment<br>[1526, 1556, 0]"] | ||||
|     123["Segment<br>[1526, 1556, 0]"] | ||||
|     124["Segment<br>[1526, 1556, 0]"] | ||||
|     125["Segment<br>[1526, 1556, 0]"] | ||||
|     126["Segment<br>[1526, 1556, 0]"] | ||||
|     127["Segment<br>[1526, 1556, 0]"] | ||||
|     128["Segment<br>[1526, 1556, 0]"] | ||||
|     129["Segment<br>[1526, 1556, 0]"] | ||||
|     130["Segment<br>[1526, 1556, 0]"] | ||||
|     131["Segment<br>[1526, 1556, 0]"] | ||||
|     132["Segment<br>[1526, 1556, 0]"] | ||||
|     133["Segment<br>[1526, 1556, 0]"] | ||||
|     134["Segment<br>[1526, 1556, 0]"] | ||||
|     135["Segment<br>[1526, 1556, 0]"] | ||||
|     136["Segment<br>[1526, 1556, 0]"] | ||||
|     137["Segment<br>[1526, 1556, 0]"] | ||||
|     138["Segment<br>[1526, 1556, 0]"] | ||||
|     139["Segment<br>[1526, 1556, 0]"] | ||||
|     140["Segment<br>[1526, 1556, 0]"] | ||||
|     141["Segment<br>[1526, 1556, 0]"] | ||||
|     142["Segment<br>[1526, 1556, 0]"] | ||||
|     143["Segment<br>[1526, 1556, 0]"] | ||||
|     144["Segment<br>[1526, 1556, 0]"] | ||||
|     145["Segment<br>[1526, 1556, 0]"] | ||||
|     146["Segment<br>[1526, 1556, 0]"] | ||||
|     147["Segment<br>[1526, 1556, 0]"] | ||||
|     148["Segment<br>[1526, 1556, 0]"] | ||||
|     149["Segment<br>[1526, 1556, 0]"] | ||||
|     150["Segment<br>[1526, 1556, 0]"] | ||||
|     151["Segment<br>[1526, 1556, 0]"] | ||||
|     152["Segment<br>[1526, 1556, 0]"] | ||||
|     153["Segment<br>[1526, 1556, 0]"] | ||||
|     154["Segment<br>[1526, 1556, 0]"] | ||||
|     155["Segment<br>[1526, 1556, 0]"] | ||||
|     156["Segment<br>[1526, 1556, 0]"] | ||||
|     157["Segment<br>[1526, 1556, 0]"] | ||||
|     158["Segment<br>[1526, 1556, 0]"] | ||||
|     159["Segment<br>[1526, 1556, 0]"] | ||||
|     160["Segment<br>[1526, 1556, 0]"] | ||||
|     161["Segment<br>[1526, 1556, 0]"] | ||||
|     162["Segment<br>[1526, 1556, 0]"] | ||||
|     163["Segment<br>[1526, 1556, 0]"] | ||||
|     164["Segment<br>[1526, 1556, 0]"] | ||||
|     165["Segment<br>[1526, 1556, 0]"] | ||||
|     166["Segment<br>[1526, 1556, 0]"] | ||||
|     167["Segment<br>[1526, 1556, 0]"] | ||||
|     168["Segment<br>[1526, 1556, 0]"] | ||||
|     169["Segment<br>[1526, 1556, 0]"] | ||||
|     170["Segment<br>[1526, 1556, 0]"] | ||||
|     171["Segment<br>[1526, 1556, 0]"] | ||||
|     172["Segment<br>[1526, 1556, 0]"] | ||||
|     173["Segment<br>[1526, 1556, 0]"] | ||||
|     174["Segment<br>[1526, 1556, 0]"] | ||||
|     175["Segment<br>[1526, 1556, 0]"] | ||||
|     176["Segment<br>[1526, 1556, 0]"] | ||||
|     177["Segment<br>[1526, 1556, 0]"] | ||||
|     178["Segment<br>[1526, 1556, 0]"] | ||||
|     179["Segment<br>[1526, 1556, 0]"] | ||||
|     180["Segment<br>[1526, 1556, 0]"] | ||||
|     181["Segment<br>[1526, 1556, 0]"] | ||||
|     182["Segment<br>[1526, 1556, 0]"] | ||||
|     183["Segment<br>[1526, 1556, 0]"] | ||||
|     184["Segment<br>[1526, 1556, 0]"] | ||||
|     185["Segment<br>[1526, 1556, 0]"] | ||||
|     186["Segment<br>[1526, 1556, 0]"] | ||||
|     187["Segment<br>[1526, 1556, 0]"] | ||||
|     188["Segment<br>[1526, 1556, 0]"] | ||||
|     189["Segment<br>[1526, 1556, 0]"] | ||||
|     190["Segment<br>[1526, 1556, 0]"] | ||||
|     191["Segment<br>[1526, 1556, 0]"] | ||||
|     192["Segment<br>[1526, 1556, 0]"] | ||||
|     193["Segment<br>[1526, 1556, 0]"] | ||||
|     194["Segment<br>[1526, 1556, 0]"] | ||||
|     195["Segment<br>[1526, 1556, 0]"] | ||||
|     196["Segment<br>[1526, 1556, 0]"] | ||||
|     197["Segment<br>[1526, 1556, 0]"] | ||||
|     198["Segment<br>[1526, 1556, 0]"] | ||||
|     199["Segment<br>[1526, 1556, 0]"] | ||||
|     200["Segment<br>[1526, 1556, 0]"] | ||||
|     201["Segment<br>[1526, 1556, 0]"] | ||||
|     202["Segment<br>[1526, 1556, 0]"] | ||||
|     203["Segment<br>[1526, 1556, 0]"] | ||||
|     204["Segment<br>[1526, 1556, 0]"] | ||||
|     205["Segment<br>[1526, 1556, 0]"] | ||||
|     206["Segment<br>[1526, 1556, 0]"] | ||||
|     207["Segment<br>[1526, 1556, 0]"] | ||||
|     208["Segment<br>[1526, 1556, 0]"] | ||||
|     209["Segment<br>[1526, 1556, 0]"] | ||||
|     210["Segment<br>[1526, 1556, 0]"] | ||||
|     211["Segment<br>[1713, 1811, 0]"] | ||||
|     212["Segment<br>[1871, 1878, 0]"] | ||||
|     6["Path<br>[1629, 1666, 0]"] | ||||
|     9["Segment<br>[1315, 1356, 0]"] | ||||
|     10["Segment<br>[1315, 1356, 0]"] | ||||
|     11["Segment<br>[1315, 1356, 0]"] | ||||
|     12["Segment<br>[1315, 1356, 0]"] | ||||
|     13["Segment<br>[1315, 1356, 0]"] | ||||
|     14["Segment<br>[1315, 1356, 0]"] | ||||
|     15["Segment<br>[1315, 1356, 0]"] | ||||
|     16["Segment<br>[1315, 1356, 0]"] | ||||
|     17["Segment<br>[1315, 1356, 0]"] | ||||
|     18["Segment<br>[1315, 1356, 0]"] | ||||
|     19["Segment<br>[1315, 1356, 0]"] | ||||
|     20["Segment<br>[1315, 1356, 0]"] | ||||
|     21["Segment<br>[1315, 1356, 0]"] | ||||
|     22["Segment<br>[1315, 1356, 0]"] | ||||
|     23["Segment<br>[1315, 1356, 0]"] | ||||
|     24["Segment<br>[1315, 1356, 0]"] | ||||
|     25["Segment<br>[1315, 1356, 0]"] | ||||
|     26["Segment<br>[1315, 1356, 0]"] | ||||
|     27["Segment<br>[1315, 1356, 0]"] | ||||
|     28["Segment<br>[1315, 1356, 0]"] | ||||
|     29["Segment<br>[1315, 1356, 0]"] | ||||
|     30["Segment<br>[1315, 1356, 0]"] | ||||
|     31["Segment<br>[1315, 1356, 0]"] | ||||
|     32["Segment<br>[1315, 1356, 0]"] | ||||
|     33["Segment<br>[1315, 1356, 0]"] | ||||
|     34["Segment<br>[1315, 1356, 0]"] | ||||
|     35["Segment<br>[1315, 1356, 0]"] | ||||
|     36["Segment<br>[1315, 1356, 0]"] | ||||
|     37["Segment<br>[1315, 1356, 0]"] | ||||
|     38["Segment<br>[1315, 1356, 0]"] | ||||
|     39["Segment<br>[1315, 1356, 0]"] | ||||
|     40["Segment<br>[1315, 1356, 0]"] | ||||
|     41["Segment<br>[1315, 1356, 0]"] | ||||
|     42["Segment<br>[1315, 1356, 0]"] | ||||
|     43["Segment<br>[1315, 1356, 0]"] | ||||
|     44["Segment<br>[1315, 1356, 0]"] | ||||
|     45["Segment<br>[1315, 1356, 0]"] | ||||
|     46["Segment<br>[1315, 1356, 0]"] | ||||
|     47["Segment<br>[1315, 1356, 0]"] | ||||
|     48["Segment<br>[1315, 1356, 0]"] | ||||
|     49["Segment<br>[1315, 1356, 0]"] | ||||
|     50["Segment<br>[1315, 1356, 0]"] | ||||
|     51["Segment<br>[1315, 1356, 0]"] | ||||
|     52["Segment<br>[1315, 1356, 0]"] | ||||
|     53["Segment<br>[1315, 1356, 0]"] | ||||
|     54["Segment<br>[1315, 1356, 0]"] | ||||
|     55["Segment<br>[1315, 1356, 0]"] | ||||
|     56["Segment<br>[1315, 1356, 0]"] | ||||
|     57["Segment<br>[1315, 1356, 0]"] | ||||
|     58["Segment<br>[1315, 1356, 0]"] | ||||
|     59["Segment<br>[1315, 1356, 0]"] | ||||
|     60["Segment<br>[1315, 1356, 0]"] | ||||
|     61["Segment<br>[1315, 1356, 0]"] | ||||
|     62["Segment<br>[1315, 1356, 0]"] | ||||
|     63["Segment<br>[1315, 1356, 0]"] | ||||
|     64["Segment<br>[1315, 1356, 0]"] | ||||
|     65["Segment<br>[1315, 1356, 0]"] | ||||
|     66["Segment<br>[1315, 1356, 0]"] | ||||
|     67["Segment<br>[1315, 1356, 0]"] | ||||
|     68["Segment<br>[1315, 1356, 0]"] | ||||
|     69["Segment<br>[1315, 1356, 0]"] | ||||
|     70["Segment<br>[1315, 1356, 0]"] | ||||
|     71["Segment<br>[1315, 1356, 0]"] | ||||
|     72["Segment<br>[1315, 1356, 0]"] | ||||
|     73["Segment<br>[1315, 1356, 0]"] | ||||
|     74["Segment<br>[1315, 1356, 0]"] | ||||
|     75["Segment<br>[1315, 1356, 0]"] | ||||
|     76["Segment<br>[1315, 1356, 0]"] | ||||
|     77["Segment<br>[1315, 1356, 0]"] | ||||
|     78["Segment<br>[1315, 1356, 0]"] | ||||
|     79["Segment<br>[1315, 1356, 0]"] | ||||
|     80["Segment<br>[1315, 1356, 0]"] | ||||
|     81["Segment<br>[1315, 1356, 0]"] | ||||
|     82["Segment<br>[1315, 1356, 0]"] | ||||
|     83["Segment<br>[1315, 1356, 0]"] | ||||
|     84["Segment<br>[1315, 1356, 0]"] | ||||
|     85["Segment<br>[1315, 1356, 0]"] | ||||
|     86["Segment<br>[1315, 1356, 0]"] | ||||
|     87["Segment<br>[1315, 1356, 0]"] | ||||
|     88["Segment<br>[1315, 1356, 0]"] | ||||
|     89["Segment<br>[1315, 1356, 0]"] | ||||
|     90["Segment<br>[1315, 1356, 0]"] | ||||
|     91["Segment<br>[1315, 1356, 0]"] | ||||
|     92["Segment<br>[1315, 1356, 0]"] | ||||
|     93["Segment<br>[1315, 1356, 0]"] | ||||
|     94["Segment<br>[1315, 1356, 0]"] | ||||
|     95["Segment<br>[1315, 1356, 0]"] | ||||
|     96["Segment<br>[1315, 1356, 0]"] | ||||
|     97["Segment<br>[1315, 1356, 0]"] | ||||
|     98["Segment<br>[1315, 1356, 0]"] | ||||
|     99["Segment<br>[1315, 1356, 0]"] | ||||
|     100["Segment<br>[1315, 1356, 0]"] | ||||
|     101["Segment<br>[1315, 1356, 0]"] | ||||
|     102["Segment<br>[1315, 1356, 0]"] | ||||
|     103["Segment<br>[1315, 1356, 0]"] | ||||
|     104["Segment<br>[1315, 1356, 0]"] | ||||
|     105["Segment<br>[1315, 1356, 0]"] | ||||
|     106["Segment<br>[1315, 1356, 0]"] | ||||
|     107["Segment<br>[1315, 1356, 0]"] | ||||
|     108["Segment<br>[1315, 1356, 0]"] | ||||
|     109["Segment<br>[1315, 1356, 0]"] | ||||
|     110["Segment<br>[1542, 1575, 0]"] | ||||
|     111["Segment<br>[1542, 1575, 0]"] | ||||
|     112["Segment<br>[1542, 1575, 0]"] | ||||
|     113["Segment<br>[1542, 1575, 0]"] | ||||
|     114["Segment<br>[1542, 1575, 0]"] | ||||
|     115["Segment<br>[1542, 1575, 0]"] | ||||
|     116["Segment<br>[1542, 1575, 0]"] | ||||
|     117["Segment<br>[1542, 1575, 0]"] | ||||
|     118["Segment<br>[1542, 1575, 0]"] | ||||
|     119["Segment<br>[1542, 1575, 0]"] | ||||
|     120["Segment<br>[1542, 1575, 0]"] | ||||
|     121["Segment<br>[1542, 1575, 0]"] | ||||
|     122["Segment<br>[1542, 1575, 0]"] | ||||
|     123["Segment<br>[1542, 1575, 0]"] | ||||
|     124["Segment<br>[1542, 1575, 0]"] | ||||
|     125["Segment<br>[1542, 1575, 0]"] | ||||
|     126["Segment<br>[1542, 1575, 0]"] | ||||
|     127["Segment<br>[1542, 1575, 0]"] | ||||
|     128["Segment<br>[1542, 1575, 0]"] | ||||
|     129["Segment<br>[1542, 1575, 0]"] | ||||
|     130["Segment<br>[1542, 1575, 0]"] | ||||
|     131["Segment<br>[1542, 1575, 0]"] | ||||
|     132["Segment<br>[1542, 1575, 0]"] | ||||
|     133["Segment<br>[1542, 1575, 0]"] | ||||
|     134["Segment<br>[1542, 1575, 0]"] | ||||
|     135["Segment<br>[1542, 1575, 0]"] | ||||
|     136["Segment<br>[1542, 1575, 0]"] | ||||
|     137["Segment<br>[1542, 1575, 0]"] | ||||
|     138["Segment<br>[1542, 1575, 0]"] | ||||
|     139["Segment<br>[1542, 1575, 0]"] | ||||
|     140["Segment<br>[1542, 1575, 0]"] | ||||
|     141["Segment<br>[1542, 1575, 0]"] | ||||
|     142["Segment<br>[1542, 1575, 0]"] | ||||
|     143["Segment<br>[1542, 1575, 0]"] | ||||
|     144["Segment<br>[1542, 1575, 0]"] | ||||
|     145["Segment<br>[1542, 1575, 0]"] | ||||
|     146["Segment<br>[1542, 1575, 0]"] | ||||
|     147["Segment<br>[1542, 1575, 0]"] | ||||
|     148["Segment<br>[1542, 1575, 0]"] | ||||
|     149["Segment<br>[1542, 1575, 0]"] | ||||
|     150["Segment<br>[1542, 1575, 0]"] | ||||
|     151["Segment<br>[1542, 1575, 0]"] | ||||
|     152["Segment<br>[1542, 1575, 0]"] | ||||
|     153["Segment<br>[1542, 1575, 0]"] | ||||
|     154["Segment<br>[1542, 1575, 0]"] | ||||
|     155["Segment<br>[1542, 1575, 0]"] | ||||
|     156["Segment<br>[1542, 1575, 0]"] | ||||
|     157["Segment<br>[1542, 1575, 0]"] | ||||
|     158["Segment<br>[1542, 1575, 0]"] | ||||
|     159["Segment<br>[1542, 1575, 0]"] | ||||
|     160["Segment<br>[1542, 1575, 0]"] | ||||
|     161["Segment<br>[1542, 1575, 0]"] | ||||
|     162["Segment<br>[1542, 1575, 0]"] | ||||
|     163["Segment<br>[1542, 1575, 0]"] | ||||
|     164["Segment<br>[1542, 1575, 0]"] | ||||
|     165["Segment<br>[1542, 1575, 0]"] | ||||
|     166["Segment<br>[1542, 1575, 0]"] | ||||
|     167["Segment<br>[1542, 1575, 0]"] | ||||
|     168["Segment<br>[1542, 1575, 0]"] | ||||
|     169["Segment<br>[1542, 1575, 0]"] | ||||
|     170["Segment<br>[1542, 1575, 0]"] | ||||
|     171["Segment<br>[1542, 1575, 0]"] | ||||
|     172["Segment<br>[1542, 1575, 0]"] | ||||
|     173["Segment<br>[1542, 1575, 0]"] | ||||
|     174["Segment<br>[1542, 1575, 0]"] | ||||
|     175["Segment<br>[1542, 1575, 0]"] | ||||
|     176["Segment<br>[1542, 1575, 0]"] | ||||
|     177["Segment<br>[1542, 1575, 0]"] | ||||
|     178["Segment<br>[1542, 1575, 0]"] | ||||
|     179["Segment<br>[1542, 1575, 0]"] | ||||
|     180["Segment<br>[1542, 1575, 0]"] | ||||
|     181["Segment<br>[1542, 1575, 0]"] | ||||
|     182["Segment<br>[1542, 1575, 0]"] | ||||
|     183["Segment<br>[1542, 1575, 0]"] | ||||
|     184["Segment<br>[1542, 1575, 0]"] | ||||
|     185["Segment<br>[1542, 1575, 0]"] | ||||
|     186["Segment<br>[1542, 1575, 0]"] | ||||
|     187["Segment<br>[1542, 1575, 0]"] | ||||
|     188["Segment<br>[1542, 1575, 0]"] | ||||
|     189["Segment<br>[1542, 1575, 0]"] | ||||
|     190["Segment<br>[1542, 1575, 0]"] | ||||
|     191["Segment<br>[1542, 1575, 0]"] | ||||
|     192["Segment<br>[1542, 1575, 0]"] | ||||
|     193["Segment<br>[1542, 1575, 0]"] | ||||
|     194["Segment<br>[1542, 1575, 0]"] | ||||
|     195["Segment<br>[1542, 1575, 0]"] | ||||
|     196["Segment<br>[1542, 1575, 0]"] | ||||
|     197["Segment<br>[1542, 1575, 0]"] | ||||
|     198["Segment<br>[1542, 1575, 0]"] | ||||
|     199["Segment<br>[1542, 1575, 0]"] | ||||
|     200["Segment<br>[1542, 1575, 0]"] | ||||
|     201["Segment<br>[1542, 1575, 0]"] | ||||
|     202["Segment<br>[1542, 1575, 0]"] | ||||
|     203["Segment<br>[1542, 1575, 0]"] | ||||
|     204["Segment<br>[1542, 1575, 0]"] | ||||
|     205["Segment<br>[1542, 1575, 0]"] | ||||
|     206["Segment<br>[1542, 1575, 0]"] | ||||
|     207["Segment<br>[1542, 1575, 0]"] | ||||
|     208["Segment<br>[1542, 1575, 0]"] | ||||
|     209["Segment<br>[1542, 1575, 0]"] | ||||
|     210["Segment<br>[1542, 1575, 0]"] | ||||
|     211["Segment<br>[1732, 1830, 0]"] | ||||
|     212["Segment<br>[1890, 1897, 0]"] | ||||
|     219[Solid2d] | ||||
|   end | ||||
|   subgraph path7 [Path] | ||||
|     7["Path<br>[2359, 2438, 0]"] | ||||
|     213["Segment<br>[2444, 2471, 0]"] | ||||
|     214["Segment<br>[2477, 2505, 0]"] | ||||
|     215["Segment<br>[2511, 2539, 0]"] | ||||
|     216["Segment<br>[2545, 2668, 0]"] | ||||
|     217["Segment<br>[2674, 2786, 0]"] | ||||
|     218["Segment<br>[2792, 2799, 0]"] | ||||
|     7["Path<br>[2378, 2457, 0]"] | ||||
|     213["Segment<br>[2463, 2490, 0]"] | ||||
|     214["Segment<br>[2496, 2524, 0]"] | ||||
|     215["Segment<br>[2530, 2558, 0]"] | ||||
|     216["Segment<br>[2564, 2687, 0]"] | ||||
|     217["Segment<br>[2693, 2805, 0]"] | ||||
|     218["Segment<br>[2811, 2818, 0]"] | ||||
|     221[Solid2d] | ||||
|   end | ||||
|   1["Plane<br>[168, 185, 0]"] | ||||
|   2["Plane<br>[1068, 1085, 0]"] | ||||
|   3["Plane<br>[1587, 1604, 0]"] | ||||
|   4["StartSketchOnFace<br>[2322, 2353, 0]"] | ||||
|   222["Sweep Extrusion<br>[1147, 1175, 0]"] | ||||
|   223["Sweep Extrusion<br>[1884, 1912, 0]"] | ||||
|   224["Sweep Extrusion<br>[2805, 2834, 0]"] | ||||
|   2["Plane<br>[1073, 1090, 0]"] | ||||
|   3["Plane<br>[1606, 1623, 0]"] | ||||
|   4["StartSketchOnFace<br>[2341, 2372, 0]"] | ||||
|   222["Sweep Extrusion<br>[1152, 1180, 0]"] | ||||
|   223["Sweep Extrusion<br>[1903, 1931, 0]"] | ||||
|   224["Sweep Extrusion<br>[2824, 2853, 0]"] | ||||
|   225[Wall] | ||||
|   226[Wall] | ||||
|   227[Wall] | ||||
|  | ||||
| @ -857,7 +857,8 @@ description: Result of parsing import_async.kcl | ||||
|                         "name": "i", | ||||
|                         "start": 0, | ||||
|                         "type": "Identifier" | ||||
|                       } | ||||
|                       }, | ||||
|                       "labeled": false | ||||
|                     } | ||||
|                   ], | ||||
|                   "start": 0, | ||||
| @ -1093,7 +1094,8 @@ description: Result of parsing import_async.kcl | ||||
|                         "name": "r", | ||||
|                         "start": 0, | ||||
|                         "type": "Identifier" | ||||
|                       } | ||||
|                       }, | ||||
|                       "labeled": false | ||||
|                     } | ||||
|                   ], | ||||
|                   "start": 0, | ||||
| @ -1324,7 +1326,8 @@ description: Result of parsing import_async.kcl | ||||
|                         "name": "a", | ||||
|                         "start": 0, | ||||
|                         "type": "Identifier" | ||||
|                       } | ||||
|                       }, | ||||
|                       "labeled": false | ||||
|                     } | ||||
|                   ], | ||||
|                   "start": 0, | ||||
| @ -1526,7 +1529,8 @@ description: Result of parsing import_async.kcl | ||||
|                         "name": "i", | ||||
|                         "start": 0, | ||||
|                         "type": "Identifier" | ||||
|                       } | ||||
|                       }, | ||||
|                       "labeled": false | ||||
|                     } | ||||
|                   ], | ||||
|                   "start": 0, | ||||
| @ -1748,7 +1752,8 @@ description: Result of parsing import_async.kcl | ||||
|                         "name": "i", | ||||
|                         "start": 0, | ||||
|                         "type": "Identifier" | ||||
|                       } | ||||
|                       }, | ||||
|                       "labeled": false | ||||
|                     } | ||||
|                   ], | ||||
|                   "start": 0, | ||||
| @ -2308,7 +2313,7 @@ description: Result of parsing import_async.kcl | ||||
|                       "name": { | ||||
|                         "commentStart": 0, | ||||
|                         "end": 0, | ||||
|                         "name": "sg", | ||||
|                         "name": "accum", | ||||
|                         "start": 0, | ||||
|                         "type": "Identifier" | ||||
|                       }, | ||||
| @ -2358,14 +2363,15 @@ description: Result of parsing import_async.kcl | ||||
|                   "name": "i", | ||||
|                   "start": 0, | ||||
|                   "type": "Identifier" | ||||
|                 } | ||||
|                 }, | ||||
|                 "labeled": false | ||||
|               }, | ||||
|               { | ||||
|                 "type": "Parameter", | ||||
|                 "identifier": { | ||||
|                   "commentStart": 0, | ||||
|                   "end": 0, | ||||
|                   "name": "sg", | ||||
|                   "name": "accum", | ||||
|                   "start": 0, | ||||
|                   "type": "Identifier" | ||||
|                 } | ||||
| @ -2924,7 +2930,7 @@ description: Result of parsing import_async.kcl | ||||
|                       "name": { | ||||
|                         "commentStart": 0, | ||||
|                         "end": 0, | ||||
|                         "name": "sg", | ||||
|                         "name": "accum", | ||||
|                         "start": 0, | ||||
|                         "type": "Identifier" | ||||
|                       }, | ||||
| @ -2956,14 +2962,15 @@ description: Result of parsing import_async.kcl | ||||
|                   "name": "i", | ||||
|                   "start": 0, | ||||
|                   "type": "Identifier" | ||||
|                 } | ||||
|                 }, | ||||
|                 "labeled": false | ||||
|               }, | ||||
|               { | ||||
|                 "type": "Parameter", | ||||
|                 "identifier": { | ||||
|                   "commentStart": 0, | ||||
|                   "end": 0, | ||||
|                   "name": "sg", | ||||
|                   "name": "accum", | ||||
|                   "start": 0, | ||||
|                   "type": "Identifier" | ||||
|                 } | ||||
|  | ||||
| @ -22,26 +22,26 @@ gearHeight = 3 | ||||
|  | ||||
| // Interpolate points along the involute curve | ||||
| cmo = 101 | ||||
| rs = map([0..cmo], f = fn(i) { | ||||
| rs = map([0..cmo], f = fn(@i) { | ||||
|   return baseDiameter / 2 + i / cmo * (tipDiameter - baseDiameter) / 2 | ||||
| }) | ||||
|  | ||||
| // Calculate operating pressure angle | ||||
| angles = map(rs, f = fn(r) { | ||||
| angles = map(rs, f = fn(@r) { | ||||
|   return units::toDegrees(  acos(baseDiameter / 2 / r)) | ||||
| }) | ||||
|  | ||||
| // Calculate the involute function | ||||
| invas = map(angles, f = fn(a) { | ||||
| invas = map(angles, f = fn(@a) { | ||||
|   return tan(units::toRadians(a)) - units::toRadians(a) | ||||
| }) | ||||
|  | ||||
| // Map the involute curve | ||||
| xs = map([0..cmo], f = fn(i) { | ||||
| xs = map([0..cmo], f = fn(@i) { | ||||
|   return rs[i] * cos(invas[i]: number(rad)) | ||||
| }) | ||||
|  | ||||
| ys = map([0..cmo], f = fn(i) { | ||||
| ys = map([0..cmo], f = fn(@i) { | ||||
|   return rs[i] * sin(invas[i]: number(rad)) | ||||
| }) | ||||
|  | ||||
| @ -53,15 +53,15 @@ body = startSketchOn(XY) | ||||
| toothAngle = 360 / nTeeth / 1.5 | ||||
|  | ||||
| // Plot the involute curve | ||||
| fn leftInvolute(i, sg) { | ||||
| fn leftInvolute(@i, accum) { | ||||
|   j = 100 - i // iterate backwards | ||||
|   return line(sg, endAbsolute = [xs[j], ys[j]]) | ||||
|   return line(accum, endAbsolute = [xs[j], ys[j]]) | ||||
| } | ||||
|  | ||||
| fn rightInvolute(i, sg) { | ||||
| fn rightInvolute(@i, accum) { | ||||
|   x = rs[i] * cos(-toothAngle + units::toDegrees(atan(ys[i] / xs[i]))) | ||||
|   y = -rs[i] * sin(-toothAngle + units::toDegrees(atan(ys[i] / xs[i]))) | ||||
|   return line(sg, endAbsolute = [x, y]) | ||||
|   return line(accum, endAbsolute = [x, y]) | ||||
| } | ||||
|  | ||||
| // Draw gear teeth | ||||
|  | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -27,7 +27,7 @@ gearHeight = 3 | ||||
| cmo = 101 | ||||
| rs = map( | ||||
|   [0..cmo], | ||||
|   f = fn(i) { | ||||
|   f = fn(@i) { | ||||
|     return baseDiameter / 2 + i / cmo * (tipDiameter - baseDiameter) / 2 | ||||
|   }, | ||||
| ) | ||||
| @ -35,7 +35,7 @@ rs = map( | ||||
| // Calculate operating pressure angle | ||||
| angles = map( | ||||
|   rs, | ||||
|   f = fn(r) { | ||||
|   f = fn(@r) { | ||||
|     return units::toDegrees(acos(baseDiameter / 2 / r)) | ||||
|   }, | ||||
| ) | ||||
| @ -43,7 +43,7 @@ angles = map( | ||||
| // Calculate the involute function | ||||
| invas = map( | ||||
|   angles, | ||||
|   f = fn(a) { | ||||
|   f = fn(@a) { | ||||
|     return tan(units::toRadians(a)) - units::toRadians(a) | ||||
|   }, | ||||
| ) | ||||
| @ -51,14 +51,14 @@ invas = map( | ||||
| // Map the involute curve | ||||
| xs = map( | ||||
|   [0..cmo], | ||||
|   f = fn(i) { | ||||
|   f = fn(@i) { | ||||
|     return rs[i] * cos(invas[i]: number(rad)) | ||||
|   }, | ||||
| ) | ||||
|  | ||||
| ys = map( | ||||
|   [0..cmo], | ||||
|   f = fn(i) { | ||||
|   f = fn(@i) { | ||||
|     return rs[i] * sin(invas[i]: number(rad)) | ||||
|   }, | ||||
| ) | ||||
| @ -71,15 +71,15 @@ body = startSketchOn(XY) | ||||
| toothAngle = 360 / nTeeth / 1.5 | ||||
|  | ||||
| // Plot the involute curve | ||||
| fn leftInvolute(i, sg) { | ||||
| fn leftInvolute(@i, accum) { | ||||
|   j = 100 - i // iterate backwards | ||||
|   return line(sg, endAbsolute = [xs[j], ys[j]]) | ||||
|   return line(accum, endAbsolute = [xs[j], ys[j]]) | ||||
| } | ||||
|  | ||||
| fn rightInvolute(i, sg) { | ||||
| fn rightInvolute(@i, accum) { | ||||
|   x = rs[i] * cos(-toothAngle + units::toDegrees(atan(ys[i] / xs[i]))) | ||||
|   y = -rs[i] * sin(-toothAngle + units::toDegrees(atan(ys[i] / xs[i]))) | ||||
|   return line(sg, endAbsolute = [x, y]) | ||||
|   return line(accum, endAbsolute = [x, y]) | ||||
| } | ||||
|  | ||||
| // Draw gear teeth | ||||
|  | ||||
| @ -120,17 +120,17 @@ flowchart LR | ||||
|   94["Sweep Extrusion<br>[771, 821, 0]"] | ||||
|   95["Sweep Extrusion<br>[771, 821, 0]"] | ||||
|   96["Sweep Extrusion<br>[771, 821, 0]"] | ||||
|   97["CompositeSolid Intersect<br>[2018, 2048, 0]"] | ||||
|   98["CompositeSolid Intersect<br>[2018, 2048, 0]"] | ||||
|   99["CompositeSolid Intersect<br>[2018, 2048, 0]"] | ||||
|   100["CompositeSolid Intersect<br>[2018, 2048, 0]"] | ||||
|   101["CompositeSolid Intersect<br>[2018, 2048, 0]"] | ||||
|   102["CompositeSolid Intersect<br>[2018, 2048, 0]"] | ||||
|   103["CompositeSolid Intersect<br>[2018, 2048, 0]"] | ||||
|   104["CompositeSolid Intersect<br>[2018, 2048, 0]"] | ||||
|   105["CompositeSolid Intersect<br>[2018, 2048, 0]"] | ||||
|   106["CompositeSolid Intersect<br>[2018, 2048, 0]"] | ||||
|   107["CompositeSolid Intersect<br>[2018, 2048, 0]"] | ||||
|   97["CompositeSolid Intersect<br>[2007, 2035, 0]"] | ||||
|   98["CompositeSolid Intersect<br>[2007, 2035, 0]"] | ||||
|   99["CompositeSolid Intersect<br>[2007, 2035, 0]"] | ||||
|   100["CompositeSolid Intersect<br>[2007, 2035, 0]"] | ||||
|   101["CompositeSolid Intersect<br>[2007, 2035, 0]"] | ||||
|   102["CompositeSolid Intersect<br>[2007, 2035, 0]"] | ||||
|   103["CompositeSolid Intersect<br>[2007, 2035, 0]"] | ||||
|   104["CompositeSolid Intersect<br>[2007, 2035, 0]"] | ||||
|   105["CompositeSolid Intersect<br>[2007, 2035, 0]"] | ||||
|   106["CompositeSolid Intersect<br>[2007, 2035, 0]"] | ||||
|   107["CompositeSolid Intersect<br>[2007, 2035, 0]"] | ||||
|   108[Wall] | ||||
|   109[Wall] | ||||
|   110[Wall] | ||||
|  | ||||
| @ -2249,7 +2249,8 @@ description: Result of parsing dodecahedron.kcl | ||||
|                         "name": "rotation", | ||||
|                         "start": 0, | ||||
|                         "type": "Identifier" | ||||
|                       } | ||||
|                       }, | ||||
|                       "labeled": false | ||||
|                     } | ||||
|                   ], | ||||
|                   "start": 0, | ||||
| @ -2372,7 +2373,7 @@ description: Result of parsing dodecahedron.kcl | ||||
|                                     "name": { | ||||
|                                       "commentStart": 0, | ||||
|                                       "end": 0, | ||||
|                                       "name": "accumulator", | ||||
|                                       "name": "accum", | ||||
|                                       "start": 0, | ||||
|                                       "type": "Identifier" | ||||
|                                     }, | ||||
| @ -2420,14 +2421,15 @@ description: Result of parsing dodecahedron.kcl | ||||
|                                 "name": "item", | ||||
|                                 "start": 0, | ||||
|                                 "type": "Identifier" | ||||
|                               } | ||||
|                               }, | ||||
|                               "labeled": false | ||||
|                             }, | ||||
|                             { | ||||
|                               "type": "Parameter", | ||||
|                               "identifier": { | ||||
|                                 "commentStart": 0, | ||||
|                                 "end": 0, | ||||
|                                 "name": "accumulator", | ||||
|                                 "name": "accum", | ||||
|                                 "start": 0, | ||||
|                                 "type": "Identifier" | ||||
|                               } | ||||
| @ -2593,7 +2595,7 @@ description: Result of parsing dodecahedron.kcl | ||||
|                                     "name": { | ||||
|                                       "commentStart": 0, | ||||
|                                       "end": 0, | ||||
|                                       "name": "current", | ||||
|                                       "name": "accum", | ||||
|                                       "start": 0, | ||||
|                                       "type": "Identifier" | ||||
|                                     }, | ||||
| @ -2631,14 +2633,15 @@ description: Result of parsing dodecahedron.kcl | ||||
|                             "name": "previous", | ||||
|                             "start": 0, | ||||
|                             "type": "Identifier" | ||||
|                           } | ||||
|                           }, | ||||
|                           "labeled": false | ||||
|                         }, | ||||
|                         { | ||||
|                           "type": "Parameter", | ||||
|                           "identifier": { | ||||
|                             "commentStart": 0, | ||||
|                             "end": 0, | ||||
|                             "name": "current", | ||||
|                             "name": "accum", | ||||
|                             "start": 0, | ||||
|                             "type": "Identifier" | ||||
|                           } | ||||
|  | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -1,234 +1,234 @@ | ||||
| ```mermaid | ||||
| flowchart LR | ||||
|   subgraph path4 [Path] | ||||
|     4["Path<br>[1431, 1481, 0]"] | ||||
|     7["Segment<br>[1431, 1481, 0]"] | ||||
|     4["Path<br>[1436, 1486, 0]"] | ||||
|     7["Segment<br>[1436, 1486, 0]"] | ||||
|     219[Solid2d] | ||||
|   end | ||||
|   subgraph path5 [Path] | ||||
|     5["Path<br>[1950, 1987, 0]"] | ||||
|     8["Segment<br>[1646, 1684, 0]"] | ||||
|     9["Segment<br>[1646, 1684, 0]"] | ||||
|     10["Segment<br>[1646, 1684, 0]"] | ||||
|     11["Segment<br>[1646, 1684, 0]"] | ||||
|     12["Segment<br>[1646, 1684, 0]"] | ||||
|     13["Segment<br>[1646, 1684, 0]"] | ||||
|     14["Segment<br>[1646, 1684, 0]"] | ||||
|     15["Segment<br>[1646, 1684, 0]"] | ||||
|     16["Segment<br>[1646, 1684, 0]"] | ||||
|     17["Segment<br>[1646, 1684, 0]"] | ||||
|     18["Segment<br>[1646, 1684, 0]"] | ||||
|     19["Segment<br>[1646, 1684, 0]"] | ||||
|     20["Segment<br>[1646, 1684, 0]"] | ||||
|     21["Segment<br>[1646, 1684, 0]"] | ||||
|     22["Segment<br>[1646, 1684, 0]"] | ||||
|     23["Segment<br>[1646, 1684, 0]"] | ||||
|     24["Segment<br>[1646, 1684, 0]"] | ||||
|     25["Segment<br>[1646, 1684, 0]"] | ||||
|     26["Segment<br>[1646, 1684, 0]"] | ||||
|     27["Segment<br>[1646, 1684, 0]"] | ||||
|     28["Segment<br>[1646, 1684, 0]"] | ||||
|     29["Segment<br>[1646, 1684, 0]"] | ||||
|     30["Segment<br>[1646, 1684, 0]"] | ||||
|     31["Segment<br>[1646, 1684, 0]"] | ||||
|     32["Segment<br>[1646, 1684, 0]"] | ||||
|     33["Segment<br>[1646, 1684, 0]"] | ||||
|     34["Segment<br>[1646, 1684, 0]"] | ||||
|     35["Segment<br>[1646, 1684, 0]"] | ||||
|     36["Segment<br>[1646, 1684, 0]"] | ||||
|     37["Segment<br>[1646, 1684, 0]"] | ||||
|     38["Segment<br>[1646, 1684, 0]"] | ||||
|     39["Segment<br>[1646, 1684, 0]"] | ||||
|     40["Segment<br>[1646, 1684, 0]"] | ||||
|     41["Segment<br>[1646, 1684, 0]"] | ||||
|     42["Segment<br>[1646, 1684, 0]"] | ||||
|     43["Segment<br>[1646, 1684, 0]"] | ||||
|     44["Segment<br>[1646, 1684, 0]"] | ||||
|     45["Segment<br>[1646, 1684, 0]"] | ||||
|     46["Segment<br>[1646, 1684, 0]"] | ||||
|     47["Segment<br>[1646, 1684, 0]"] | ||||
|     48["Segment<br>[1646, 1684, 0]"] | ||||
|     49["Segment<br>[1646, 1684, 0]"] | ||||
|     50["Segment<br>[1646, 1684, 0]"] | ||||
|     51["Segment<br>[1646, 1684, 0]"] | ||||
|     52["Segment<br>[1646, 1684, 0]"] | ||||
|     53["Segment<br>[1646, 1684, 0]"] | ||||
|     54["Segment<br>[1646, 1684, 0]"] | ||||
|     55["Segment<br>[1646, 1684, 0]"] | ||||
|     56["Segment<br>[1646, 1684, 0]"] | ||||
|     57["Segment<br>[1646, 1684, 0]"] | ||||
|     58["Segment<br>[1646, 1684, 0]"] | ||||
|     59["Segment<br>[1646, 1684, 0]"] | ||||
|     60["Segment<br>[1646, 1684, 0]"] | ||||
|     61["Segment<br>[1646, 1684, 0]"] | ||||
|     62["Segment<br>[1646, 1684, 0]"] | ||||
|     63["Segment<br>[1646, 1684, 0]"] | ||||
|     64["Segment<br>[1646, 1684, 0]"] | ||||
|     65["Segment<br>[1646, 1684, 0]"] | ||||
|     66["Segment<br>[1646, 1684, 0]"] | ||||
|     67["Segment<br>[1646, 1684, 0]"] | ||||
|     68["Segment<br>[1646, 1684, 0]"] | ||||
|     69["Segment<br>[1646, 1684, 0]"] | ||||
|     70["Segment<br>[1646, 1684, 0]"] | ||||
|     71["Segment<br>[1646, 1684, 0]"] | ||||
|     72["Segment<br>[1646, 1684, 0]"] | ||||
|     73["Segment<br>[1646, 1684, 0]"] | ||||
|     74["Segment<br>[1646, 1684, 0]"] | ||||
|     75["Segment<br>[1646, 1684, 0]"] | ||||
|     76["Segment<br>[1646, 1684, 0]"] | ||||
|     77["Segment<br>[1646, 1684, 0]"] | ||||
|     78["Segment<br>[1646, 1684, 0]"] | ||||
|     79["Segment<br>[1646, 1684, 0]"] | ||||
|     80["Segment<br>[1646, 1684, 0]"] | ||||
|     81["Segment<br>[1646, 1684, 0]"] | ||||
|     82["Segment<br>[1646, 1684, 0]"] | ||||
|     83["Segment<br>[1646, 1684, 0]"] | ||||
|     84["Segment<br>[1646, 1684, 0]"] | ||||
|     85["Segment<br>[1646, 1684, 0]"] | ||||
|     86["Segment<br>[1646, 1684, 0]"] | ||||
|     87["Segment<br>[1646, 1684, 0]"] | ||||
|     88["Segment<br>[1646, 1684, 0]"] | ||||
|     89["Segment<br>[1646, 1684, 0]"] | ||||
|     90["Segment<br>[1646, 1684, 0]"] | ||||
|     91["Segment<br>[1646, 1684, 0]"] | ||||
|     92["Segment<br>[1646, 1684, 0]"] | ||||
|     93["Segment<br>[1646, 1684, 0]"] | ||||
|     94["Segment<br>[1646, 1684, 0]"] | ||||
|     95["Segment<br>[1646, 1684, 0]"] | ||||
|     96["Segment<br>[1646, 1684, 0]"] | ||||
|     97["Segment<br>[1646, 1684, 0]"] | ||||
|     98["Segment<br>[1646, 1684, 0]"] | ||||
|     99["Segment<br>[1646, 1684, 0]"] | ||||
|     100["Segment<br>[1646, 1684, 0]"] | ||||
|     101["Segment<br>[1646, 1684, 0]"] | ||||
|     102["Segment<br>[1646, 1684, 0]"] | ||||
|     103["Segment<br>[1646, 1684, 0]"] | ||||
|     104["Segment<br>[1646, 1684, 0]"] | ||||
|     105["Segment<br>[1646, 1684, 0]"] | ||||
|     106["Segment<br>[1646, 1684, 0]"] | ||||
|     107["Segment<br>[1646, 1684, 0]"] | ||||
|     108["Segment<br>[1646, 1684, 0]"] | ||||
|     109["Segment<br>[1866, 1896, 0]"] | ||||
|     110["Segment<br>[1866, 1896, 0]"] | ||||
|     111["Segment<br>[1866, 1896, 0]"] | ||||
|     112["Segment<br>[1866, 1896, 0]"] | ||||
|     113["Segment<br>[1866, 1896, 0]"] | ||||
|     114["Segment<br>[1866, 1896, 0]"] | ||||
|     115["Segment<br>[1866, 1896, 0]"] | ||||
|     116["Segment<br>[1866, 1896, 0]"] | ||||
|     117["Segment<br>[1866, 1896, 0]"] | ||||
|     118["Segment<br>[1866, 1896, 0]"] | ||||
|     119["Segment<br>[1866, 1896, 0]"] | ||||
|     120["Segment<br>[1866, 1896, 0]"] | ||||
|     121["Segment<br>[1866, 1896, 0]"] | ||||
|     122["Segment<br>[1866, 1896, 0]"] | ||||
|     123["Segment<br>[1866, 1896, 0]"] | ||||
|     124["Segment<br>[1866, 1896, 0]"] | ||||
|     125["Segment<br>[1866, 1896, 0]"] | ||||
|     126["Segment<br>[1866, 1896, 0]"] | ||||
|     127["Segment<br>[1866, 1896, 0]"] | ||||
|     128["Segment<br>[1866, 1896, 0]"] | ||||
|     129["Segment<br>[1866, 1896, 0]"] | ||||
|     130["Segment<br>[1866, 1896, 0]"] | ||||
|     131["Segment<br>[1866, 1896, 0]"] | ||||
|     132["Segment<br>[1866, 1896, 0]"] | ||||
|     133["Segment<br>[1866, 1896, 0]"] | ||||
|     134["Segment<br>[1866, 1896, 0]"] | ||||
|     135["Segment<br>[1866, 1896, 0]"] | ||||
|     136["Segment<br>[1866, 1896, 0]"] | ||||
|     137["Segment<br>[1866, 1896, 0]"] | ||||
|     138["Segment<br>[1866, 1896, 0]"] | ||||
|     139["Segment<br>[1866, 1896, 0]"] | ||||
|     140["Segment<br>[1866, 1896, 0]"] | ||||
|     141["Segment<br>[1866, 1896, 0]"] | ||||
|     142["Segment<br>[1866, 1896, 0]"] | ||||
|     143["Segment<br>[1866, 1896, 0]"] | ||||
|     144["Segment<br>[1866, 1896, 0]"] | ||||
|     145["Segment<br>[1866, 1896, 0]"] | ||||
|     146["Segment<br>[1866, 1896, 0]"] | ||||
|     147["Segment<br>[1866, 1896, 0]"] | ||||
|     148["Segment<br>[1866, 1896, 0]"] | ||||
|     149["Segment<br>[1866, 1896, 0]"] | ||||
|     150["Segment<br>[1866, 1896, 0]"] | ||||
|     151["Segment<br>[1866, 1896, 0]"] | ||||
|     152["Segment<br>[1866, 1896, 0]"] | ||||
|     153["Segment<br>[1866, 1896, 0]"] | ||||
|     154["Segment<br>[1866, 1896, 0]"] | ||||
|     155["Segment<br>[1866, 1896, 0]"] | ||||
|     156["Segment<br>[1866, 1896, 0]"] | ||||
|     157["Segment<br>[1866, 1896, 0]"] | ||||
|     158["Segment<br>[1866, 1896, 0]"] | ||||
|     159["Segment<br>[1866, 1896, 0]"] | ||||
|     160["Segment<br>[1866, 1896, 0]"] | ||||
|     161["Segment<br>[1866, 1896, 0]"] | ||||
|     162["Segment<br>[1866, 1896, 0]"] | ||||
|     163["Segment<br>[1866, 1896, 0]"] | ||||
|     164["Segment<br>[1866, 1896, 0]"] | ||||
|     165["Segment<br>[1866, 1896, 0]"] | ||||
|     166["Segment<br>[1866, 1896, 0]"] | ||||
|     167["Segment<br>[1866, 1896, 0]"] | ||||
|     168["Segment<br>[1866, 1896, 0]"] | ||||
|     169["Segment<br>[1866, 1896, 0]"] | ||||
|     170["Segment<br>[1866, 1896, 0]"] | ||||
|     171["Segment<br>[1866, 1896, 0]"] | ||||
|     172["Segment<br>[1866, 1896, 0]"] | ||||
|     173["Segment<br>[1866, 1896, 0]"] | ||||
|     174["Segment<br>[1866, 1896, 0]"] | ||||
|     175["Segment<br>[1866, 1896, 0]"] | ||||
|     176["Segment<br>[1866, 1896, 0]"] | ||||
|     177["Segment<br>[1866, 1896, 0]"] | ||||
|     178["Segment<br>[1866, 1896, 0]"] | ||||
|     179["Segment<br>[1866, 1896, 0]"] | ||||
|     180["Segment<br>[1866, 1896, 0]"] | ||||
|     181["Segment<br>[1866, 1896, 0]"] | ||||
|     182["Segment<br>[1866, 1896, 0]"] | ||||
|     183["Segment<br>[1866, 1896, 0]"] | ||||
|     184["Segment<br>[1866, 1896, 0]"] | ||||
|     185["Segment<br>[1866, 1896, 0]"] | ||||
|     186["Segment<br>[1866, 1896, 0]"] | ||||
|     187["Segment<br>[1866, 1896, 0]"] | ||||
|     188["Segment<br>[1866, 1896, 0]"] | ||||
|     189["Segment<br>[1866, 1896, 0]"] | ||||
|     190["Segment<br>[1866, 1896, 0]"] | ||||
|     191["Segment<br>[1866, 1896, 0]"] | ||||
|     192["Segment<br>[1866, 1896, 0]"] | ||||
|     193["Segment<br>[1866, 1896, 0]"] | ||||
|     194["Segment<br>[1866, 1896, 0]"] | ||||
|     195["Segment<br>[1866, 1896, 0]"] | ||||
|     196["Segment<br>[1866, 1896, 0]"] | ||||
|     197["Segment<br>[1866, 1896, 0]"] | ||||
|     198["Segment<br>[1866, 1896, 0]"] | ||||
|     199["Segment<br>[1866, 1896, 0]"] | ||||
|     200["Segment<br>[1866, 1896, 0]"] | ||||
|     201["Segment<br>[1866, 1896, 0]"] | ||||
|     202["Segment<br>[1866, 1896, 0]"] | ||||
|     203["Segment<br>[1866, 1896, 0]"] | ||||
|     204["Segment<br>[1866, 1896, 0]"] | ||||
|     205["Segment<br>[1866, 1896, 0]"] | ||||
|     206["Segment<br>[1866, 1896, 0]"] | ||||
|     207["Segment<br>[1866, 1896, 0]"] | ||||
|     208["Segment<br>[1866, 1896, 0]"] | ||||
|     209["Segment<br>[1866, 1896, 0]"] | ||||
|     210["Segment<br>[2053, 2122, 0]"] | ||||
|     211["Segment<br>[2182, 2189, 0]"] | ||||
|     5["Path<br>[1969, 2006, 0]"] | ||||
|     8["Segment<br>[1655, 1696, 0]"] | ||||
|     9["Segment<br>[1655, 1696, 0]"] | ||||
|     10["Segment<br>[1655, 1696, 0]"] | ||||
|     11["Segment<br>[1655, 1696, 0]"] | ||||
|     12["Segment<br>[1655, 1696, 0]"] | ||||
|     13["Segment<br>[1655, 1696, 0]"] | ||||
|     14["Segment<br>[1655, 1696, 0]"] | ||||
|     15["Segment<br>[1655, 1696, 0]"] | ||||
|     16["Segment<br>[1655, 1696, 0]"] | ||||
|     17["Segment<br>[1655, 1696, 0]"] | ||||
|     18["Segment<br>[1655, 1696, 0]"] | ||||
|     19["Segment<br>[1655, 1696, 0]"] | ||||
|     20["Segment<br>[1655, 1696, 0]"] | ||||
|     21["Segment<br>[1655, 1696, 0]"] | ||||
|     22["Segment<br>[1655, 1696, 0]"] | ||||
|     23["Segment<br>[1655, 1696, 0]"] | ||||
|     24["Segment<br>[1655, 1696, 0]"] | ||||
|     25["Segment<br>[1655, 1696, 0]"] | ||||
|     26["Segment<br>[1655, 1696, 0]"] | ||||
|     27["Segment<br>[1655, 1696, 0]"] | ||||
|     28["Segment<br>[1655, 1696, 0]"] | ||||
|     29["Segment<br>[1655, 1696, 0]"] | ||||
|     30["Segment<br>[1655, 1696, 0]"] | ||||
|     31["Segment<br>[1655, 1696, 0]"] | ||||
|     32["Segment<br>[1655, 1696, 0]"] | ||||
|     33["Segment<br>[1655, 1696, 0]"] | ||||
|     34["Segment<br>[1655, 1696, 0]"] | ||||
|     35["Segment<br>[1655, 1696, 0]"] | ||||
|     36["Segment<br>[1655, 1696, 0]"] | ||||
|     37["Segment<br>[1655, 1696, 0]"] | ||||
|     38["Segment<br>[1655, 1696, 0]"] | ||||
|     39["Segment<br>[1655, 1696, 0]"] | ||||
|     40["Segment<br>[1655, 1696, 0]"] | ||||
|     41["Segment<br>[1655, 1696, 0]"] | ||||
|     42["Segment<br>[1655, 1696, 0]"] | ||||
|     43["Segment<br>[1655, 1696, 0]"] | ||||
|     44["Segment<br>[1655, 1696, 0]"] | ||||
|     45["Segment<br>[1655, 1696, 0]"] | ||||
|     46["Segment<br>[1655, 1696, 0]"] | ||||
|     47["Segment<br>[1655, 1696, 0]"] | ||||
|     48["Segment<br>[1655, 1696, 0]"] | ||||
|     49["Segment<br>[1655, 1696, 0]"] | ||||
|     50["Segment<br>[1655, 1696, 0]"] | ||||
|     51["Segment<br>[1655, 1696, 0]"] | ||||
|     52["Segment<br>[1655, 1696, 0]"] | ||||
|     53["Segment<br>[1655, 1696, 0]"] | ||||
|     54["Segment<br>[1655, 1696, 0]"] | ||||
|     55["Segment<br>[1655, 1696, 0]"] | ||||
|     56["Segment<br>[1655, 1696, 0]"] | ||||
|     57["Segment<br>[1655, 1696, 0]"] | ||||
|     58["Segment<br>[1655, 1696, 0]"] | ||||
|     59["Segment<br>[1655, 1696, 0]"] | ||||
|     60["Segment<br>[1655, 1696, 0]"] | ||||
|     61["Segment<br>[1655, 1696, 0]"] | ||||
|     62["Segment<br>[1655, 1696, 0]"] | ||||
|     63["Segment<br>[1655, 1696, 0]"] | ||||
|     64["Segment<br>[1655, 1696, 0]"] | ||||
|     65["Segment<br>[1655, 1696, 0]"] | ||||
|     66["Segment<br>[1655, 1696, 0]"] | ||||
|     67["Segment<br>[1655, 1696, 0]"] | ||||
|     68["Segment<br>[1655, 1696, 0]"] | ||||
|     69["Segment<br>[1655, 1696, 0]"] | ||||
|     70["Segment<br>[1655, 1696, 0]"] | ||||
|     71["Segment<br>[1655, 1696, 0]"] | ||||
|     72["Segment<br>[1655, 1696, 0]"] | ||||
|     73["Segment<br>[1655, 1696, 0]"] | ||||
|     74["Segment<br>[1655, 1696, 0]"] | ||||
|     75["Segment<br>[1655, 1696, 0]"] | ||||
|     76["Segment<br>[1655, 1696, 0]"] | ||||
|     77["Segment<br>[1655, 1696, 0]"] | ||||
|     78["Segment<br>[1655, 1696, 0]"] | ||||
|     79["Segment<br>[1655, 1696, 0]"] | ||||
|     80["Segment<br>[1655, 1696, 0]"] | ||||
|     81["Segment<br>[1655, 1696, 0]"] | ||||
|     82["Segment<br>[1655, 1696, 0]"] | ||||
|     83["Segment<br>[1655, 1696, 0]"] | ||||
|     84["Segment<br>[1655, 1696, 0]"] | ||||
|     85["Segment<br>[1655, 1696, 0]"] | ||||
|     86["Segment<br>[1655, 1696, 0]"] | ||||
|     87["Segment<br>[1655, 1696, 0]"] | ||||
|     88["Segment<br>[1655, 1696, 0]"] | ||||
|     89["Segment<br>[1655, 1696, 0]"] | ||||
|     90["Segment<br>[1655, 1696, 0]"] | ||||
|     91["Segment<br>[1655, 1696, 0]"] | ||||
|     92["Segment<br>[1655, 1696, 0]"] | ||||
|     93["Segment<br>[1655, 1696, 0]"] | ||||
|     94["Segment<br>[1655, 1696, 0]"] | ||||
|     95["Segment<br>[1655, 1696, 0]"] | ||||
|     96["Segment<br>[1655, 1696, 0]"] | ||||
|     97["Segment<br>[1655, 1696, 0]"] | ||||
|     98["Segment<br>[1655, 1696, 0]"] | ||||
|     99["Segment<br>[1655, 1696, 0]"] | ||||
|     100["Segment<br>[1655, 1696, 0]"] | ||||
|     101["Segment<br>[1655, 1696, 0]"] | ||||
|     102["Segment<br>[1655, 1696, 0]"] | ||||
|     103["Segment<br>[1655, 1696, 0]"] | ||||
|     104["Segment<br>[1655, 1696, 0]"] | ||||
|     105["Segment<br>[1655, 1696, 0]"] | ||||
|     106["Segment<br>[1655, 1696, 0]"] | ||||
|     107["Segment<br>[1655, 1696, 0]"] | ||||
|     108["Segment<br>[1655, 1696, 0]"] | ||||
|     109["Segment<br>[1882, 1915, 0]"] | ||||
|     110["Segment<br>[1882, 1915, 0]"] | ||||
|     111["Segment<br>[1882, 1915, 0]"] | ||||
|     112["Segment<br>[1882, 1915, 0]"] | ||||
|     113["Segment<br>[1882, 1915, 0]"] | ||||
|     114["Segment<br>[1882, 1915, 0]"] | ||||
|     115["Segment<br>[1882, 1915, 0]"] | ||||
|     116["Segment<br>[1882, 1915, 0]"] | ||||
|     117["Segment<br>[1882, 1915, 0]"] | ||||
|     118["Segment<br>[1882, 1915, 0]"] | ||||
|     119["Segment<br>[1882, 1915, 0]"] | ||||
|     120["Segment<br>[1882, 1915, 0]"] | ||||
|     121["Segment<br>[1882, 1915, 0]"] | ||||
|     122["Segment<br>[1882, 1915, 0]"] | ||||
|     123["Segment<br>[1882, 1915, 0]"] | ||||
|     124["Segment<br>[1882, 1915, 0]"] | ||||
|     125["Segment<br>[1882, 1915, 0]"] | ||||
|     126["Segment<br>[1882, 1915, 0]"] | ||||
|     127["Segment<br>[1882, 1915, 0]"] | ||||
|     128["Segment<br>[1882, 1915, 0]"] | ||||
|     129["Segment<br>[1882, 1915, 0]"] | ||||
|     130["Segment<br>[1882, 1915, 0]"] | ||||
|     131["Segment<br>[1882, 1915, 0]"] | ||||
|     132["Segment<br>[1882, 1915, 0]"] | ||||
|     133["Segment<br>[1882, 1915, 0]"] | ||||
|     134["Segment<br>[1882, 1915, 0]"] | ||||
|     135["Segment<br>[1882, 1915, 0]"] | ||||
|     136["Segment<br>[1882, 1915, 0]"] | ||||
|     137["Segment<br>[1882, 1915, 0]"] | ||||
|     138["Segment<br>[1882, 1915, 0]"] | ||||
|     139["Segment<br>[1882, 1915, 0]"] | ||||
|     140["Segment<br>[1882, 1915, 0]"] | ||||
|     141["Segment<br>[1882, 1915, 0]"] | ||||
|     142["Segment<br>[1882, 1915, 0]"] | ||||
|     143["Segment<br>[1882, 1915, 0]"] | ||||
|     144["Segment<br>[1882, 1915, 0]"] | ||||
|     145["Segment<br>[1882, 1915, 0]"] | ||||
|     146["Segment<br>[1882, 1915, 0]"] | ||||
|     147["Segment<br>[1882, 1915, 0]"] | ||||
|     148["Segment<br>[1882, 1915, 0]"] | ||||
|     149["Segment<br>[1882, 1915, 0]"] | ||||
|     150["Segment<br>[1882, 1915, 0]"] | ||||
|     151["Segment<br>[1882, 1915, 0]"] | ||||
|     152["Segment<br>[1882, 1915, 0]"] | ||||
|     153["Segment<br>[1882, 1915, 0]"] | ||||
|     154["Segment<br>[1882, 1915, 0]"] | ||||
|     155["Segment<br>[1882, 1915, 0]"] | ||||
|     156["Segment<br>[1882, 1915, 0]"] | ||||
|     157["Segment<br>[1882, 1915, 0]"] | ||||
|     158["Segment<br>[1882, 1915, 0]"] | ||||
|     159["Segment<br>[1882, 1915, 0]"] | ||||
|     160["Segment<br>[1882, 1915, 0]"] | ||||
|     161["Segment<br>[1882, 1915, 0]"] | ||||
|     162["Segment<br>[1882, 1915, 0]"] | ||||
|     163["Segment<br>[1882, 1915, 0]"] | ||||
|     164["Segment<br>[1882, 1915, 0]"] | ||||
|     165["Segment<br>[1882, 1915, 0]"] | ||||
|     166["Segment<br>[1882, 1915, 0]"] | ||||
|     167["Segment<br>[1882, 1915, 0]"] | ||||
|     168["Segment<br>[1882, 1915, 0]"] | ||||
|     169["Segment<br>[1882, 1915, 0]"] | ||||
|     170["Segment<br>[1882, 1915, 0]"] | ||||
|     171["Segment<br>[1882, 1915, 0]"] | ||||
|     172["Segment<br>[1882, 1915, 0]"] | ||||
|     173["Segment<br>[1882, 1915, 0]"] | ||||
|     174["Segment<br>[1882, 1915, 0]"] | ||||
|     175["Segment<br>[1882, 1915, 0]"] | ||||
|     176["Segment<br>[1882, 1915, 0]"] | ||||
|     177["Segment<br>[1882, 1915, 0]"] | ||||
|     178["Segment<br>[1882, 1915, 0]"] | ||||
|     179["Segment<br>[1882, 1915, 0]"] | ||||
|     180["Segment<br>[1882, 1915, 0]"] | ||||
|     181["Segment<br>[1882, 1915, 0]"] | ||||
|     182["Segment<br>[1882, 1915, 0]"] | ||||
|     183["Segment<br>[1882, 1915, 0]"] | ||||
|     184["Segment<br>[1882, 1915, 0]"] | ||||
|     185["Segment<br>[1882, 1915, 0]"] | ||||
|     186["Segment<br>[1882, 1915, 0]"] | ||||
|     187["Segment<br>[1882, 1915, 0]"] | ||||
|     188["Segment<br>[1882, 1915, 0]"] | ||||
|     189["Segment<br>[1882, 1915, 0]"] | ||||
|     190["Segment<br>[1882, 1915, 0]"] | ||||
|     191["Segment<br>[1882, 1915, 0]"] | ||||
|     192["Segment<br>[1882, 1915, 0]"] | ||||
|     193["Segment<br>[1882, 1915, 0]"] | ||||
|     194["Segment<br>[1882, 1915, 0]"] | ||||
|     195["Segment<br>[1882, 1915, 0]"] | ||||
|     196["Segment<br>[1882, 1915, 0]"] | ||||
|     197["Segment<br>[1882, 1915, 0]"] | ||||
|     198["Segment<br>[1882, 1915, 0]"] | ||||
|     199["Segment<br>[1882, 1915, 0]"] | ||||
|     200["Segment<br>[1882, 1915, 0]"] | ||||
|     201["Segment<br>[1882, 1915, 0]"] | ||||
|     202["Segment<br>[1882, 1915, 0]"] | ||||
|     203["Segment<br>[1882, 1915, 0]"] | ||||
|     204["Segment<br>[1882, 1915, 0]"] | ||||
|     205["Segment<br>[1882, 1915, 0]"] | ||||
|     206["Segment<br>[1882, 1915, 0]"] | ||||
|     207["Segment<br>[1882, 1915, 0]"] | ||||
|     208["Segment<br>[1882, 1915, 0]"] | ||||
|     209["Segment<br>[1882, 1915, 0]"] | ||||
|     210["Segment<br>[2072, 2141, 0]"] | ||||
|     211["Segment<br>[2201, 2208, 0]"] | ||||
|     218[Solid2d] | ||||
|   end | ||||
|   subgraph path6 [Path] | ||||
|     6["Path<br>[2670, 2770, 0]"] | ||||
|     212["Segment<br>[2776, 2803, 0]"] | ||||
|     213["Segment<br>[2809, 2837, 0]"] | ||||
|     214["Segment<br>[2843, 2871, 0]"] | ||||
|     215["Segment<br>[2877, 2971, 0]"] | ||||
|     216["Segment<br>[2977, 3060, 0]"] | ||||
|     217["Segment<br>[3066, 3073, 0]"] | ||||
|     6["Path<br>[2689, 2789, 0]"] | ||||
|     212["Segment<br>[2795, 2822, 0]"] | ||||
|     213["Segment<br>[2828, 2856, 0]"] | ||||
|     214["Segment<br>[2862, 2890, 0]"] | ||||
|     215["Segment<br>[2896, 2990, 0]"] | ||||
|     216["Segment<br>[2996, 3079, 0]"] | ||||
|     217["Segment<br>[3085, 3092, 0]"] | ||||
|     220[Solid2d] | ||||
|   end | ||||
|   1["Plane<br>[1408, 1425, 0]"] | ||||
|   2["Plane<br>[1927, 1944, 0]"] | ||||
|   3["StartSketchOnFace<br>[2633, 2664, 0]"] | ||||
|   221["Sweep Extrusion<br>[1487, 1515, 0]"] | ||||
|   222["Sweep Extrusion<br>[2195, 2223, 0]"] | ||||
|   223["Sweep Extrusion<br>[3079, 3108, 0]"] | ||||
|   1["Plane<br>[1413, 1430, 0]"] | ||||
|   2["Plane<br>[1946, 1963, 0]"] | ||||
|   3["StartSketchOnFace<br>[2652, 2683, 0]"] | ||||
|   221["Sweep Extrusion<br>[1492, 1520, 0]"] | ||||
|   222["Sweep Extrusion<br>[2214, 2242, 0]"] | ||||
|   223["Sweep Extrusion<br>[3098, 3127, 0]"] | ||||
|   224[Wall] | ||||
|   225[Wall] | ||||
|   226[Wall] | ||||
|  | ||||
| @ -698,7 +698,8 @@ description: Result of parsing gear.kcl | ||||
|                         "name": "i", | ||||
|                         "start": 0, | ||||
|                         "type": "Identifier" | ||||
|                       } | ||||
|                       }, | ||||
|                       "labeled": false | ||||
|                     } | ||||
|                   ], | ||||
|                   "start": 0, | ||||
| @ -934,7 +935,8 @@ description: Result of parsing gear.kcl | ||||
|                         "name": "r", | ||||
|                         "start": 0, | ||||
|                         "type": "Identifier" | ||||
|                       } | ||||
|                       }, | ||||
|                       "labeled": false | ||||
|                     } | ||||
|                   ], | ||||
|                   "start": 0, | ||||
| @ -1135,7 +1137,8 @@ description: Result of parsing gear.kcl | ||||
|                         "name": "a", | ||||
|                         "start": 0, | ||||
|                         "type": "Identifier" | ||||
|                       } | ||||
|                       }, | ||||
|                       "labeled": false | ||||
|                     } | ||||
|                   ], | ||||
|                   "start": 0, | ||||
| @ -1337,7 +1340,8 @@ description: Result of parsing gear.kcl | ||||
|                         "name": "i", | ||||
|                         "start": 0, | ||||
|                         "type": "Identifier" | ||||
|                       } | ||||
|                       }, | ||||
|                       "labeled": false | ||||
|                     } | ||||
|                   ], | ||||
|                   "start": 0, | ||||
| @ -1559,7 +1563,8 @@ description: Result of parsing gear.kcl | ||||
|                         "name": "i", | ||||
|                         "start": 0, | ||||
|                         "type": "Identifier" | ||||
|                       } | ||||
|                       }, | ||||
|                       "labeled": false | ||||
|                     } | ||||
|                   ], | ||||
|                   "start": 0, | ||||
| @ -2119,7 +2124,7 @@ description: Result of parsing gear.kcl | ||||
|                       "name": { | ||||
|                         "commentStart": 0, | ||||
|                         "end": 0, | ||||
|                         "name": "sg", | ||||
|                         "name": "accum", | ||||
|                         "start": 0, | ||||
|                         "type": "Identifier" | ||||
|                       }, | ||||
| @ -2169,14 +2174,15 @@ description: Result of parsing gear.kcl | ||||
|                   "name": "i", | ||||
|                   "start": 0, | ||||
|                   "type": "Identifier" | ||||
|                 } | ||||
|                 }, | ||||
|                 "labeled": false | ||||
|               }, | ||||
|               { | ||||
|                 "type": "Parameter", | ||||
|                 "identifier": { | ||||
|                   "commentStart": 0, | ||||
|                   "end": 0, | ||||
|                   "name": "sg", | ||||
|                   "name": "accum", | ||||
|                   "start": 0, | ||||
|                   "type": "Identifier" | ||||
|                 } | ||||
| @ -2735,7 +2741,7 @@ description: Result of parsing gear.kcl | ||||
|                       "name": { | ||||
|                         "commentStart": 0, | ||||
|                         "end": 0, | ||||
|                         "name": "sg", | ||||
|                         "name": "accum", | ||||
|                         "start": 0, | ||||
|                         "type": "Identifier" | ||||
|                       }, | ||||
| @ -2767,14 +2773,15 @@ description: Result of parsing gear.kcl | ||||
|                   "name": "i", | ||||
|                   "start": 0, | ||||
|                   "type": "Identifier" | ||||
|                 } | ||||
|                 }, | ||||
|                 "labeled": false | ||||
|               }, | ||||
|               { | ||||
|                 "type": "Parameter", | ||||
|                 "identifier": { | ||||
|                   "commentStart": 0, | ||||
|                   "end": 0, | ||||
|                   "name": "sg", | ||||
|                   "name": "accum", | ||||
|                   "start": 0, | ||||
|                   "type": "Identifier" | ||||
|                 } | ||||
|  | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -2,60 +2,60 @@ | ||||
| flowchart LR | ||||
|   subgraph path2 [Path] | ||||
|     2["Path<br>[733, 769, 0]"] | ||||
|     3["Segment<br>[923, 987, 0]"] | ||||
|     4["Segment<br>[923, 987, 0]"] | ||||
|     5["Segment<br>[923, 987, 0]"] | ||||
|     6["Segment<br>[923, 987, 0]"] | ||||
|     7["Segment<br>[923, 987, 0]"] | ||||
|     8["Segment<br>[923, 987, 0]"] | ||||
|     9["Segment<br>[923, 987, 0]"] | ||||
|     10["Segment<br>[923, 987, 0]"] | ||||
|     11["Segment<br>[923, 987, 0]"] | ||||
|     12["Segment<br>[923, 987, 0]"] | ||||
|     13["Segment<br>[923, 987, 0]"] | ||||
|     14["Segment<br>[923, 987, 0]"] | ||||
|     15["Segment<br>[923, 987, 0]"] | ||||
|     16["Segment<br>[923, 987, 0]"] | ||||
|     17["Segment<br>[923, 987, 0]"] | ||||
|     18["Segment<br>[923, 987, 0]"] | ||||
|     19["Segment<br>[923, 987, 0]"] | ||||
|     20["Segment<br>[923, 987, 0]"] | ||||
|     21["Segment<br>[923, 987, 0]"] | ||||
|     22["Segment<br>[923, 987, 0]"] | ||||
|     23["Segment<br>[923, 987, 0]"] | ||||
|     24["Segment<br>[923, 987, 0]"] | ||||
|     25["Segment<br>[923, 987, 0]"] | ||||
|     26["Segment<br>[923, 987, 0]"] | ||||
|     27["Segment<br>[923, 987, 0]"] | ||||
|     28["Segment<br>[923, 987, 0]"] | ||||
|     29["Segment<br>[923, 987, 0]"] | ||||
|     30["Segment<br>[923, 987, 0]"] | ||||
|     31["Segment<br>[923, 987, 0]"] | ||||
|     32["Segment<br>[923, 987, 0]"] | ||||
|     33["Segment<br>[923, 987, 0]"] | ||||
|     34["Segment<br>[923, 987, 0]"] | ||||
|     35["Segment<br>[923, 987, 0]"] | ||||
|     36["Segment<br>[923, 987, 0]"] | ||||
|     37["Segment<br>[923, 987, 0]"] | ||||
|     38["Segment<br>[923, 987, 0]"] | ||||
|     39["Segment<br>[923, 987, 0]"] | ||||
|     40["Segment<br>[923, 987, 0]"] | ||||
|     41["Segment<br>[923, 987, 0]"] | ||||
|     42["Segment<br>[923, 987, 0]"] | ||||
|     43["Segment<br>[923, 987, 0]"] | ||||
|     44["Segment<br>[923, 987, 0]"] | ||||
|     45["Segment<br>[923, 987, 0]"] | ||||
|     46["Segment<br>[923, 987, 0]"] | ||||
|     47["Segment<br>[923, 987, 0]"] | ||||
|     48["Segment<br>[923, 987, 0]"] | ||||
|     49["Segment<br>[923, 987, 0]"] | ||||
|     50["Segment<br>[923, 987, 0]"] | ||||
|     51["Segment<br>[923, 987, 0]"] | ||||
|     52["Segment<br>[1051, 1069, 0]"] | ||||
|     3["Segment<br>[923, 986, 0]"] | ||||
|     4["Segment<br>[923, 986, 0]"] | ||||
|     5["Segment<br>[923, 986, 0]"] | ||||
|     6["Segment<br>[923, 986, 0]"] | ||||
|     7["Segment<br>[923, 986, 0]"] | ||||
|     8["Segment<br>[923, 986, 0]"] | ||||
|     9["Segment<br>[923, 986, 0]"] | ||||
|     10["Segment<br>[923, 986, 0]"] | ||||
|     11["Segment<br>[923, 986, 0]"] | ||||
|     12["Segment<br>[923, 986, 0]"] | ||||
|     13["Segment<br>[923, 986, 0]"] | ||||
|     14["Segment<br>[923, 986, 0]"] | ||||
|     15["Segment<br>[923, 986, 0]"] | ||||
|     16["Segment<br>[923, 986, 0]"] | ||||
|     17["Segment<br>[923, 986, 0]"] | ||||
|     18["Segment<br>[923, 986, 0]"] | ||||
|     19["Segment<br>[923, 986, 0]"] | ||||
|     20["Segment<br>[923, 986, 0]"] | ||||
|     21["Segment<br>[923, 986, 0]"] | ||||
|     22["Segment<br>[923, 986, 0]"] | ||||
|     23["Segment<br>[923, 986, 0]"] | ||||
|     24["Segment<br>[923, 986, 0]"] | ||||
|     25["Segment<br>[923, 986, 0]"] | ||||
|     26["Segment<br>[923, 986, 0]"] | ||||
|     27["Segment<br>[923, 986, 0]"] | ||||
|     28["Segment<br>[923, 986, 0]"] | ||||
|     29["Segment<br>[923, 986, 0]"] | ||||
|     30["Segment<br>[923, 986, 0]"] | ||||
|     31["Segment<br>[923, 986, 0]"] | ||||
|     32["Segment<br>[923, 986, 0]"] | ||||
|     33["Segment<br>[923, 986, 0]"] | ||||
|     34["Segment<br>[923, 986, 0]"] | ||||
|     35["Segment<br>[923, 986, 0]"] | ||||
|     36["Segment<br>[923, 986, 0]"] | ||||
|     37["Segment<br>[923, 986, 0]"] | ||||
|     38["Segment<br>[923, 986, 0]"] | ||||
|     39["Segment<br>[923, 986, 0]"] | ||||
|     40["Segment<br>[923, 986, 0]"] | ||||
|     41["Segment<br>[923, 986, 0]"] | ||||
|     42["Segment<br>[923, 986, 0]"] | ||||
|     43["Segment<br>[923, 986, 0]"] | ||||
|     44["Segment<br>[923, 986, 0]"] | ||||
|     45["Segment<br>[923, 986, 0]"] | ||||
|     46["Segment<br>[923, 986, 0]"] | ||||
|     47["Segment<br>[923, 986, 0]"] | ||||
|     48["Segment<br>[923, 986, 0]"] | ||||
|     49["Segment<br>[923, 986, 0]"] | ||||
|     50["Segment<br>[923, 986, 0]"] | ||||
|     51["Segment<br>[923, 986, 0]"] | ||||
|     52["Segment<br>[1050, 1068, 0]"] | ||||
|     53[Solid2d] | ||||
|   end | ||||
|   1["Plane<br>[710, 727, 0]"] | ||||
|   54["Sweep Extrusion<br>[1123, 1161, 0]"] | ||||
|   54["Sweep Extrusion<br>[1122, 1160, 0]"] | ||||
|   55[Wall] | ||||
|   56[Wall] | ||||
|   57[Wall] | ||||
|  | ||||
| @ -801,7 +801,7 @@ description: Result of parsing loop_tag.kcl | ||||
|                             "name": { | ||||
|                               "commentStart": 0, | ||||
|                               "end": 0, | ||||
|                               "name": "sketch", | ||||
|                               "name": "accum", | ||||
|                               "start": 0, | ||||
|                               "type": "Identifier" | ||||
|                             }, | ||||
| @ -833,14 +833,15 @@ description: Result of parsing loop_tag.kcl | ||||
|                         "name": "index", | ||||
|                         "start": 0, | ||||
|                         "type": "Identifier" | ||||
|                       } | ||||
|                       }, | ||||
|                       "labeled": false | ||||
|                     }, | ||||
|                     { | ||||
|                       "type": "Parameter", | ||||
|                       "identifier": { | ||||
|                         "commentStart": 0, | ||||
|                         "end": 0, | ||||
|                         "name": "sketch", | ||||
|                         "name": "accum", | ||||
|                         "start": 0, | ||||
|                         "type": "Identifier" | ||||
|                       } | ||||
|  | ||||
| @ -27,8 +27,8 @@ initialSketch = startSketchOn(XY) | ||||
| finalSketch = reduce( | ||||
|   [1..numSides-1], | ||||
|   initial = initialSketch, | ||||
|   f = fn(index, sketch) { | ||||
|     return line(sketch, end = calculatePoint(index), tag = $problematicTag) | ||||
|   f = fn(@index, accum) { | ||||
|     return line(accum, end = calculatePoint(index), tag = $problematicTag) | ||||
|   } | ||||
| ) | ||||
|  | ||||
|  | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -34,8 +34,8 @@ initialSketch = startSketchOn(XY) | ||||
| finalSketch = reduce( | ||||
|   [1 .. numSides - 1], | ||||
|   initial = initialSketch, | ||||
|   f = fn(index, sketch) { | ||||
|     return line(sketch, end =     calculatePoint(index), tag = $problematicTag) | ||||
|   f = fn(@index, accum) { | ||||
|     return line(accum, end =     calculatePoint(index), tag = $problematicTag) | ||||
|   }, | ||||
| ) | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user