Compare commits

...

3 Commits

Author SHA1 Message Date
06779ccf36 WIP 2025-02-05 09:05:27 -06:00
440a1db055 Update KCL test code 2025-02-05 09:05:26 -06:00
70ec92f208 KCL: Circle is now a kw function 2025-02-05 09:05:26 -06:00
64 changed files with 6759 additions and 5182 deletions

View File

@ -66,7 +66,12 @@ import { perpendicularDistance } from 'sketch-helpers'
import { TagDeclarator } from 'wasm-lib/kcl/bindings/TagDeclarator'
import { EdgeCutInfo } from 'machines/modelingMachine'
import { Node } from 'wasm-lib/kcl/bindings/Node'
import { findKwArg, findKwArgAny, findKwArgAnyIndex } from 'lang/util'
import {
findKwArg,
findKwArgAny,
findKwArgAnyIndex,
findKwArgWithIndex,
} from 'lang/util'
export const ARG_TAG = 'tag'
export const ARG_END = 'end'
@ -1049,7 +1054,7 @@ export const tangentialArcTo: SketchLineHelper = {
]
},
}
export const circle: SketchLineHelper = {
export const circle: SketchLineHelperKw = {
add: ({ node, pathToNode, segmentInput, replaceExistingCallback }) => {
if (segmentInput.type !== 'arc-segment') return ARC_SEGMENT_ERR
@ -1070,6 +1075,7 @@ export const circle: SketchLineHelper = {
const radiusExp = createLiteral(roundOff(radius, 2))
if (replaceExistingCallback) {
// ADAM: Make this kw.
const result = replaceExistingCallback([
{
type: 'arrayInObject',
@ -1128,14 +1134,12 @@ export const circle: SketchLineHelper = {
pathToNode: shallowPath,
}
},
getTag: getTag(),
addTag: addTag(),
getConstraintInfo: (callExp: CallExpression, code, pathToNode) => {
if (callExp.type !== 'CallExpression') return []
const firstArg = callExp.arguments?.[0]
if (firstArg.type !== 'ObjectExpression') return []
const centerDetails = getObjExprProperty(firstArg, 'center')
const radiusDetails = getObjExprProperty(firstArg, 'radius')
getTag: getTagKwArg(),
addTag: addTagKw(),
getConstraintInfo: (callExp: CallExpressionKw, code, pathToNode) => {
if (callExp.type !== 'CallExpressionKw') return []
const centerDetails = findKwArgWithIndex('center', callExp)
const radiusDetails = findKwArgWithIndex('radius', callExp)
if (!centerDetails || !radiusDetails) return []
if (centerDetails.expr.type !== 'ArrayExpression') return []
@ -1985,12 +1989,12 @@ export const sketchLineHelperMap: { [key: string]: SketchLineHelper } = {
angledLineToY,
angledLineThatIntersects,
tangentialArcTo,
circle,
} as const
export const sketchLineHelperMapKw: { [key: string]: SketchLineHelperKw } = {
line,
lineTo,
circle,
} as const
export function changeSketchArguments(

View File

@ -155,10 +155,22 @@ function createCallWrapper(
}
}
const args =
tooltip === 'circle'
? []
: [createFirstArg(tooltip, val), createPipeSubstitution()]
if (tooltip === 'circle') {
const labeledArgs = []
if (tag) {
labeledArgs.push(createLabeledArg(ARG_TAG, tag))
}
return {
callExp: createCallExpressionStdLibKw(
'circle',
null, // Assumes this is being called in a pipeline, so the first arg is optional and if not given, will become pipeline substitution.
labeledArgs
),
valueUsedInTransform: 0,
}
}
const args = [createFirstArg(tooltip, val), createPipeSubstitution()]
if (tag) {
args.push(tag)
}

View File

@ -86,6 +86,29 @@ export function findKwArg(
})?.arg
}
/**
Search the keyword arguments from a call for an argument with this label.
*/
export function findKwArgWithIndex(
label: string,
call: CallExpressionKw
): { expr: Expr; index: number } | undefined {
const index = call.arguments.findIndex((arg) => {
return label === arg.label.name
})
if (index < 0) {
return undefined
}
const expr = call.arguments.at(index)
if (expr === undefined) {
return undefined
}
return {
index,
expr: expr.arg,
}
}
/**
Search the keyword arguments from a call for an argument with one of these labels.
*/

View File

@ -2828,7 +2828,7 @@ export function isEditingExistingSketch({
item.type === 'CallExpression' && item.callee.name === 'startProfileAt'
)
const hasCircle = pipeExpression.body.some(
(item) => item.type === 'CallExpression' && item.callee.name === 'circle'
(item) => item.type === 'CallExpressionKw' && item.callee.name === 'circle'
)
return (hasStartProfileAt && pipeExpression.body.length > 2) || hasCircle
}
@ -2876,7 +2876,7 @@ export function pipeHasCircle({
const pipeExpression = variableDeclaration.node.init
if (pipeExpression.type !== 'PipeExpression') return false
const hasCircle = pipeExpression.body.some(
(item) => item.type === 'CallExpression' && item.callee.name === 'circle'
(item) => item.type === 'CallExpressionKw' && item.callee.name === 'circle'
)
return hasCircle
}
@ -2935,7 +2935,7 @@ export function isClosedSketch({
if (node.node?.declaration?.init?.type !== 'PipeExpression') return false
return node.node.declaration.init.body.some(
(node) =>
node.type === 'CallExpression' &&
(node.type === 'CallExpressionKw' || node.type === 'CallExpression') &&
(node.callee.name === 'close' || node.callee.name === 'circle')
)
}

View File

@ -970,10 +970,10 @@ mod tests {
let snippet = circle_fn.to_autocomplete_snippet().unwrap();
assert_eq!(
snippet,
r#"circle({
r#"circle(
center = [${0:3.14}, ${1:3.14}],
radius = ${2:3.14},
}, ${3:%})${}"#
)${}"#
);
}

View File

@ -1199,7 +1199,7 @@ fn transform = (replicaId) => {
fn layer = () => {
return startSketchOn("XY")
|> circle({ center: [0, 0], radius: 1 }, %, $tag1)
|> circle(center = [0, 0], radius = 1 , tag = $tag1)
|> extrude(length = 10)
}

View File

@ -1,12 +1,13 @@
---
source: kcl/src/parsing/parser.rs
expression: actual
snapshot_kind: text
---
{
"body": [
{
"declaration": {
"end": 113,
"end": 109,
"id": {
"end": 14,
"name": "cylinder",
@ -40,24 +41,17 @@ expression: actual
{
"arguments": [
{
"end": 81,
"properties": [
{
"end": 67,
"key": {
"end": 59,
"name": "center",
"start": 53,
"type": "Identifier"
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "center"
},
"start": 53,
"type": "ObjectProperty",
"value": {
"arg": {
"elements": [
{
"end": 63,
"end": 62,
"raw": "0",
"start": 62,
"start": 61,
"type": "Literal",
"type": "Literal",
"value": {
@ -66,9 +60,9 @@ expression: actual
}
},
{
"end": 66,
"end": 65,
"raw": "0",
"start": 65,
"start": 64,
"type": "Literal",
"type": "Literal",
"value": {
@ -77,23 +71,19 @@ expression: actual
}
}
],
"end": 67,
"start": 61,
"end": 66,
"start": 60,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
},
{
"end": 79,
"key": {
"end": 75,
"name": "radius",
"start": 69,
"type": "Identifier"
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "radius"
},
"start": 69,
"type": "ObjectProperty",
"value": {
"arg": {
"end": 79,
"raw": "22",
"start": 77,
@ -106,27 +96,17 @@ expression: actual
}
}
],
"start": 51,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
{
"end": 84,
"start": 83,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 50,
"name": "circle",
"start": 44,
"type": "Identifier"
},
"end": 85,
"end": 81,
"start": 44,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
@ -137,9 +117,9 @@ expression: actual
"name": "length"
},
"arg": {
"end": 112,
"end": 108,
"raw": "14",
"start": 110,
"start": 106,
"type": "Literal",
"type": "Literal",
"value": {
@ -150,19 +130,19 @@ expression: actual
}
],
"callee": {
"end": 100,
"end": 96,
"name": "extrude",
"start": 93,
"start": 89,
"type": "Identifier"
},
"end": 113,
"start": 93,
"end": 109,
"start": 89,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
}
],
"end": 113,
"end": 109,
"start": 17,
"type": "PipeExpression",
"type": "PipeExpression"
@ -170,13 +150,13 @@ expression: actual
"start": 6,
"type": "VariableDeclarator"
},
"end": 113,
"end": 109,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 114,
"end": 110,
"start": 0
}

View File

@ -80,7 +80,7 @@ pub async fn appearance(_exec_state: &mut ExecState, args: Args) -> Result<KclVa
/// ```no_run
/// // Add color to a revolved solid.
/// sketch001 = startSketchOn('XY')
/// |> circle({ center = [15, 0], radius = 5 }, %)
/// |> circle(center = [15, 0], radius = 5 )
/// |> revolve({ angle = 360, axis = 'y' }, %)
/// |> appearance({
/// color = '#ff0000',
@ -241,16 +241,16 @@ pub async fn appearance(_exec_state: &mut ExecState, args: Args) -> Result<KclVa
/// |> line(end = [0, 7])
///
/// pipeHole = startSketchOn('XY')
/// |> circle({
/// |> circle(
/// center = [0, 0],
/// radius = 1.5,
/// }, %)
/// )
///
/// sweepSketch = startSketchOn('XY')
/// |> circle({
/// |> circle(
/// center = [0, 0],
/// radius = 2,
/// }, %)
/// )
/// |> hole(pipeHole, %)
/// |> sweep({
/// path: sweepPath,

View File

@ -373,19 +373,6 @@ impl Args {
Ok((numbers[0], numbers[1]))
}
pub(crate) fn get_circle_args(
&self,
) -> Result<
(
crate::std::shapes::CircleData,
crate::std::shapes::SketchOrSurface,
Option<TagNode>,
),
KclError,
> {
FromArgs::from_args(self, 0)
}
pub(crate) fn get_sketches(&self) -> Result<(SketchSet, Sketch), KclError> {
FromArgs::from_args(self, 0)
}
@ -1184,15 +1171,6 @@ impl<'a> FromKclValue<'a> for super::revolve::RevolveData {
}
}
impl<'a> FromKclValue<'a> for super::shapes::CircleData {
fn from_kcl_val(arg: &'a KclValue) -> Option<Self> {
let obj = arg.as_object()?;
let_field_of!(obj, center);
let_field_of!(obj, radius);
Some(Self { center, radius })
}
}
impl<'a> FromKclValue<'a> for super::sketch::TangentialArcData {
fn from_kcl_val(arg: &'a KclValue) -> Option<Self> {
let obj = arg.as_object()?;

View File

@ -33,7 +33,7 @@ pub async fn map(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kcl
/// r = 10 // radius
/// fn drawCircle(id) {
/// return startSketchOn("XY")
/// |> circle({ center: [id * 2 * r, 0], radius: r}, %)
/// |> circle(center = [id * 2 * r, 0], radius = r)
/// }
///
/// // Call `drawCircle`, passing in each element of the array.
@ -51,7 +51,7 @@ pub async fn map(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kcl
/// [1..3],
/// fn(id) {
/// return startSketchOn("XY")
/// |> circle({ center: [id * 2 * r, 0], radius: r}, %)
/// |> circle(center = [id * 2 * r, 0], radius = r)
/// }
/// )
/// ```

View File

@ -25,7 +25,7 @@ pub async fn int(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
/// assertEqual(n, 3, 0.0001, "5/2 = 2.5, rounded up makes 3")
/// // Draw n cylinders.
/// startSketchOn('XZ')
/// |> circle({ center = [0, 0], radius = 2 }, %)
/// |> circle(center = [0, 0], radius = 2 )
/// |> extrude(length = 5)
/// |> patternTransform(n, fn(id) {
/// return { translate = [4 * id, 0, 0] }

View File

@ -59,7 +59,7 @@ pub async fn helix(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
///
/// // Create a spring by sweeping around the helix path.
/// springSketch = startSketchOn('YZ')
/// |> circle({ center = [0, 0], radius = 0.5 }, %)
/// |> circle(center = [0, 0], radius = 0.5 )
/// |> sweep({ path = helixPath }, %)
/// ```
///
@ -80,7 +80,7 @@ pub async fn helix(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
///
/// // Create a spring by sweeping around the helix path.
/// springSketch = startSketchOn('XY')
/// |> circle({ center = [0, 0], radius = 0.5 }, %)
/// |> circle(center = [0, 0], radius = 0.5 )
/// |> sweep({ path = helixPath }, %)
/// ```
///
@ -102,7 +102,7 @@ pub async fn helix(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
///
/// // Create a spring by sweeping around the helix path.
/// springSketch = startSketchOn('XY')
/// |> circle({ center = [0, 0], radius = 1 }, %)
/// |> circle(center = [0, 0], radius = 1 )
/// |> sweep({ path = helixPath }, %)
/// ```
#[stdlib {
@ -202,7 +202,7 @@ pub async fn helix_revolutions(exec_state: &mut ExecState, args: Args) -> Result
///
/// ```no_run
/// part001 = startSketchOn('XY')
/// |> circle({ center: [5, 5], radius: 10 }, %)
/// |> circle(center = [5, 5], radius = 10 )
/// |> extrude(length = 10)
/// |> helixRevolutions({
/// angleStart = 0,

View File

@ -78,10 +78,10 @@ pub async fn loft(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
/// |> close()
///
/// circleSketch0 = startSketchOn(offsetPlane('XY', 75))
/// |> circle({ center = [0, 100], radius = 50 }, %)
/// |> circle(center = [0, 100], radius = 50 )
///
/// circleSketch1 = startSketchOn(offsetPlane('XY', 150))
/// |> circle({ center = [0, 100], radius = 20 }, %)
/// |> circle(center = [0, 100], radius = 20 )
///
/// loft([squareSketch, circleSketch0, circleSketch1])
/// ```
@ -97,10 +97,10 @@ pub async fn loft(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
/// |> close()
///
/// circleSketch0 = startSketchOn(offsetPlane('XY', 75))
/// |> circle({ center = [0, 100], radius = 50 }, %)
/// |> circle(center = [0, 100], radius = 50 )
///
/// circleSketch1 = startSketchOn(offsetPlane('XY', 150))
/// |> circle({ center = [0, 100], radius = 20 }, %)
/// |> circle(center = [0, 100], radius = 20 )
///
/// loft([squareSketch, circleSketch0, circleSketch1],
/// baseCurveIndex = 0,

View File

@ -148,7 +148,7 @@ pub async fn pi(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kcl
/// circumference = 70
///
/// exampleSketch = startSketchOn("XZ")
/// |> circle({ center = [0, 0], radius = circumference/ (2 * pi()) }, %)
/// |> circle(center = [0, 0], radius = circumference/ (2 * pi()) )
///
/// example = extrude(exampleSketch, length = 5)
/// ```

View File

@ -152,7 +152,7 @@ pub async fn pattern_transform_2d(exec_state: &mut ExecState, args: Args) -> Res
///
/// // Sketch 4 cylinders.
/// sketch001 = startSketchOn('XZ')
/// |> circle({ center = [0, 0], radius = 2 }, %)
/// |> circle(center = [0, 0], radius = 2 )
/// |> extrude(length = 5)
/// |> patternTransform(4, transform, %)
/// ```
@ -165,7 +165,7 @@ pub async fn pattern_transform_2d(exec_state: &mut ExecState, args: Args) -> Res
/// }
///
/// sketch001 = startSketchOn('XZ')
/// |> circle({ center = [0, 0], radius = 2 }, %)
/// |> circle(center = [0, 0], radius = 2 )
/// |> extrude(length = 5)
/// |> patternTransform(4, transform, %)
/// ```
@ -261,7 +261,7 @@ pub async fn pattern_transform_2d(exec_state: &mut ExecState, args: Args) -> Res
/// // Each layer is just a pretty thin cylinder.
/// fn layer() {
/// return startSketchOn("XY") // or some other plane idk
/// |> circle({ center = [0, 0], radius = 1 }, %, $tag1)
/// |> circle(center = [0, 0], radius = 1 , tag = $tag1)
/// |> extrude(length = h)
/// }
/// // The vase is 100 layers tall.
@ -322,7 +322,7 @@ async fn inner_pattern_transform<'a>(
///
/// // Sketch 4 circles.
/// sketch001 = startSketchOn('XZ')
/// |> circle({ center: [0, 0], radius: 2 }, %)
/// |> circle(center = [0, 0], radius = 2 )
/// |> patternTransform2d(4, transform, %)
/// ```
#[stdlib {
@ -694,7 +694,7 @@ pub async fn pattern_linear_2d(exec_state: &mut ExecState, args: Args) -> Result
///
/// ```no_run
/// exampleSketch = startSketchOn('XZ')
/// |> circle({ center = [0, 0], radius = 1 }, %)
/// |> circle(center = [0, 0], radius = 1 )
/// |> patternLinear2d({
/// axis = [1, 0],
/// instances = 7,
@ -973,7 +973,7 @@ pub async fn pattern_circular_3d(exec_state: &mut ExecState, args: Args) -> Resu
///
/// ```no_run
/// exampleSketch = startSketchOn('XZ')
/// |> circle({ center = [0, 0], radius = 1 }, %)
/// |> circle(center = [0, 0], radius = 1 )
///
/// example = extrude(exampleSketch, length = -5)
/// |> patternCircular3d({

View File

@ -74,7 +74,7 @@ pub async fn offset_plane(exec_state: &mut ExecState, args: Args) -> Result<KclV
/// |> close()
///
/// circleSketch = startSketchOn(offsetPlane('XY', 150))
/// |> circle({ center = [0, 100], radius = 50 }, %)
/// |> circle(center = [0, 100], radius = 50 )
///
/// loft([squareSketch, circleSketch])
/// ```
@ -90,7 +90,7 @@ pub async fn offset_plane(exec_state: &mut ExecState, args: Args) -> Result<KclV
/// |> close()
///
/// circleSketch = startSketchOn(offsetPlane('XZ', 150))
/// |> circle({ center = [0, 100], radius = 50 }, %)
/// |> circle(center = [0, 100], radius = 50 )
///
/// loft([squareSketch, circleSketch])
/// ```
@ -106,7 +106,7 @@ pub async fn offset_plane(exec_state: &mut ExecState, args: Args) -> Result<KclV
/// |> close()
///
/// circleSketch = startSketchOn(offsetPlane('YZ', 150))
/// |> circle({ center = [0, 100], radius = 50 }, %)
/// |> circle(center = [0, 100], radius = 50 )
///
/// loft([squareSketch, circleSketch])
/// ```
@ -122,7 +122,7 @@ pub async fn offset_plane(exec_state: &mut ExecState, args: Args) -> Result<KclV
/// |> close()
///
/// circleSketch = startSketchOn(offsetPlane('-XZ', -150))
/// |> circle({ center = [0, 100], radius = 50 }, %)
/// |> circle(center = [0, 100], radius = 50 )
///
/// loft([squareSketch, circleSketch])
/// ```
@ -130,7 +130,7 @@ pub async fn offset_plane(exec_state: &mut ExecState, args: Args) -> Result<KclV
/// // A circle on the XY plane
/// startSketchOn("XY")
/// |> startProfileAt([0, 0], %)
/// |> circle({ radius = 10, center = [0, 0] }, %)
/// |> circle(radius = 10, center = [0, 0])
///
/// // Triangle on the plane 4 units above
/// startSketchOn(offsetPlane("XY", 4))

View File

@ -63,7 +63,7 @@ pub async fn revolve(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// ```no_run
/// // A donut shape.
/// sketch001 = startSketchOn('XY')
/// |> circle({ center = [15, 0], radius = 5 }, %)
/// |> circle(center = [15, 0], radius = 5 )
/// |> revolve({
/// angle = 360,
/// axis = 'y'
@ -115,7 +115,7 @@ pub async fn revolve(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// |> extrude(length = 20)
///
/// sketch001 = startSketchOn(box, "END")
/// |> circle({ center = [10,10], radius = 4 }, %)
/// |> circle(center = [10,10], radius = 4 )
/// |> revolve({
/// angle = -90,
/// axis = 'y'
@ -132,7 +132,7 @@ pub async fn revolve(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// |> extrude(length = 20)
///
/// sketch001 = startSketchOn(box, "END")
/// |> circle({ center = [10,10], radius = 4 }, %)
/// |> circle(center = [10,10], radius = 4 )
/// |> revolve({
/// angle = 90,
/// axis = getOppositeEdge(revolveAxis)
@ -149,7 +149,7 @@ pub async fn revolve(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// |> extrude(length = 20)
///
/// sketch001 = startSketchOn(box, "END")
/// |> circle({ center = [10,10], radius = 4 }, %)
/// |> circle(center = [10,10], radius = 4 )
/// |> revolve({
/// angle = 90,
/// axis = getOppositeEdge(revolveAxis),

View File

@ -34,7 +34,7 @@ pub async fn segment_end(exec_state: &mut ExecState, args: Args) -> Result<KclVa
/// fn cylinder(radius, tag) {
/// return startSketchOn('XY')
/// |> startProfileAt([0, 0], %)
/// |> circle({ radius = radius, center = segEnd(tag) }, %)
/// |> circle(radius = radius, center = segEnd(tag))
/// |> extrude(length = radius)
/// }
///
@ -155,7 +155,7 @@ pub async fn segment_start(exec_state: &mut ExecState, args: Args) -> Result<Kcl
/// fn cylinder(radius, tag) {
/// return startSketchOn('XY')
/// |> startProfileAt([0, 0], %)
/// |> circle({ radius = radius, center = segStart(tag) }, %)
/// |> circle(radius = radius, center = segStart(tag))
/// |> extrude(length = radius)
/// }
///
@ -486,7 +486,7 @@ pub async fn tangent_to_end(exec_state: &mut ExecState, args: Args) -> Result<Kc
///
/// ```no_run
/// circSketch = startSketchOn("XY")
/// |> circle({ center: [0, 0], radius: 3 }, %, $circ)
/// |> circle(center = [0, 0], radius = 3 , tag = $circ)
///
/// triangleSketch = startSketchOn("XY")
/// |> startProfileAt([-5, 0], %)

View File

@ -23,6 +23,8 @@ use crate::{
},
};
use super::sketch::NEW_TAG_KW;
/// A sketch surface or a sketch.
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
#[ts(export)]
@ -32,24 +34,14 @@ pub enum SketchOrSurface {
Sketch(Box<Sketch>),
}
/// Data for drawing an circle
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
#[ts(export)]
#[serde(rename_all = "camelCase")]
// TODO: make sure the docs on the args below are correct.
pub struct CircleData {
/// The center of the circle.
pub center: [f64; 2],
/// The circle radius
pub radius: f64,
}
/// Sketch a circle.
pub async fn circle(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
let (data, sketch_surface_or_group, tag): (CircleData, SketchOrSurface, Option<TagNode>) =
args.get_circle_args()?;
let sketch = inner_circle(data, sketch_surface_or_group, tag, exec_state, args).await?;
let sketch_surface_or_group = args.get_unlabeled_kw_arg("sketchSurfaceOrGroup")?;
let center = args.get_kw_arg("center")?;
let radius = args.get_kw_arg_opt("radius")?;
let diameter = args.get_kw_arg_opt("diameter")?;
let tag = args.get_kw_arg_opt(NEW_TAG_KW)?;
let sketch = inner_circle(sketch_surface_or_group, center, radius, diameter, tag, exec_state, args).await?;
Ok(KclValue::Sketch {
value: Box::new(sketch),
})
@ -60,7 +52,7 @@ pub async fn circle(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
///
/// ```no_run
/// exampleSketch = startSketchOn("-XZ")
/// |> circle({ center = [0, 0], radius = 10 }, %)
/// |> circle(center = [0, 0], radius = 10 )
///
/// example = extrude(exampleSketch, length = 5)
/// ```
@ -72,16 +64,27 @@ pub async fn circle(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// |> line(end = [0, 30])
/// |> line(end = [-30, 0])
/// |> close()
/// |> hole(circle({ center = [0, 15], radius = 5 }, %), %)
/// |> hole(circle(center = [0, 15], radius = 5 ), %)
///
/// example = extrude(exampleSketch, length = 5)
/// ```
#[stdlib {
name = "circle",
keywords = true,
unlabeled_first = true,
args = {
sketch_surface_or_group = { docs = "Which sketch should this circle be drawn on?"},
center = { docs = "Center of the circle", include_in_snippet = true},
radius = { docs = "Distance from circle's circumference to center. Incompatible with `diameter`.", include_in_snippet = true},
diameter = { docs = "Maximum distance between two points on the circle. Incompatible with `radius`."},
tag = { docs = "Create a new tag which refers to this circle"},
}
}]
async fn inner_circle(
data: CircleData,
sketch_surface_or_group: SketchOrSurface,
center: [f64; 2],
radius: Option<f64>,
diameter: Option<f64>,
tag: Option<TagNode>,
exec_state: &mut ExecState,
args: Args,
@ -90,8 +93,25 @@ async fn inner_circle(
SketchOrSurface::SketchSurface(surface) => surface,
SketchOrSurface::Sketch(group) => group.on,
};
let radius = match (radius, diameter) {
(Some(r), None) => r,
(None, Some(d)) => d / 2.0,
(None, None) => {
return Err(KclError::Semantic(KclErrorDetails {
source_ranges: vec![args.source_range],
message: "You must supply either `end` or `end_absolute` arguments".to_owned(),
}))
}
(Some(_), Some(_)) => {
return Err(KclError::Semantic(KclErrorDetails {
source_ranges: vec![args.source_range],
message: "You cannot give both `end` and `end_absolute` params, you have to choose one or the other"
.to_owned(),
}))
}
};
let sketch = crate::std::sketch::inner_start_profile_at(
[data.center[0] + data.radius, data.center[1]],
[center[0] + radius, center[1]],
sketch_surface,
None,
exec_state,
@ -99,7 +119,7 @@ async fn inner_circle(
)
.await?;
let from = [data.center[0] + data.radius, data.center[1]];
let from = [center[0] + radius, center[1]];
let angle_start = Angle::zero();
let angle_end = Angle::turn();
@ -112,8 +132,8 @@ async fn inner_circle(
segment: PathSegment::Arc {
start: angle_start,
end: angle_end,
center: KPoint2d::from(data.center).map(LengthUnit),
radius: data.radius.into(),
center: KPoint2d::from(center).map(LengthUnit),
radius: radius.into(),
relative: false,
},
}),
@ -130,8 +150,8 @@ async fn inner_circle(
metadata: args.source_range.into(),
},
},
radius: data.radius,
center: data.center,
radius,
center,
ccw: angle_start < angle_end,
};
@ -191,13 +211,13 @@ async fn inner_circle_three_point(
args: Args,
) -> Result<Sketch, KclError> {
let center = calculate_circle_center(p1, p2, p3);
inner_circle(
CircleData {
center,
// It can be the distance to any of the 3 points - they all lay on the circumference.
radius: distance(center.into(), p2.into()),
},
let radius = distance(center.into(), p2.into());
inner_circle(
sketch_surface_or_group,
center,
Some(radius),
None,
tag,
exec_state,
args,

View File

@ -116,11 +116,11 @@ pub async fn shell(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
/// |> extrude(length = 65)
///
/// thing1 = startSketchOn(case, 'end')
/// |> circle({ center = [-size / 2, -size / 2], radius = 25 }, %)
/// |> circle(center = [-size / 2, -size / 2], radius = 25 )
/// |> extrude(length = 50)
///
/// thing2 = startSketchOn(case, 'end')
/// |> circle({ center = [size / 2, -size / 2], radius = 25 }, %)
/// |> circle(center = [size / 2, -size / 2], radius = 25 )
/// |> extrude(length = 50)
///
/// // We put "case" in the shell function to shell the entire object.
@ -139,11 +139,11 @@ pub async fn shell(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
/// |> extrude(length = 65)
///
/// thing1 = startSketchOn(case, 'end')
/// |> circle({ center = [-size / 2, -size / 2], radius = 25 }, %)
/// |> circle(center = [-size / 2, -size / 2], radius = 25 )
/// |> extrude(length = 50)
///
/// thing2 = startSketchOn(case, 'end')
/// |> circle({ center = [size / 2, -size / 2], radius = 25 }, %)
/// |> circle(center = [size / 2, -size / 2], radius = 25 )
/// |> extrude(length = 50)
///
/// // We put "thing1" in the shell function to shell the end face of the object.
@ -164,11 +164,11 @@ pub async fn shell(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
/// |> extrude(length = 65)
///
/// thing1 = startSketchOn(case, 'end')
/// |> circle({ center = [-size / 2, -size / 2], radius = 25 }, %)
/// |> circle(center = [-size / 2, -size / 2], radius = 25 )
/// |> extrude(length = 50)
///
/// thing2 = startSketchOn(case, 'end')
/// |> circle({ center = [size / 2, -size / 2], radius = 25 }, %)
/// |> circle(center = [size / 2, -size / 2], radius = 25 )
/// |> extrude(length = 50)
///
/// // We put "thing1" and "thing2" in the shell function to shell the end face of the object.
@ -292,11 +292,11 @@ pub async fn hollow(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// |> extrude(length = 65)
///
/// thing1 = startSketchOn(case, 'end')
/// |> circle({ center = [-size / 2, -size / 2], radius = 25 }, %)
/// |> circle(center = [-size / 2, -size / 2], radius = 25 )
/// |> extrude(length = 50)
///
/// thing2 = startSketchOn(case, 'end')
/// |> circle({ center = [size / 2, -size / 2], radius = 25 }, %)
/// |> circle(center = [size / 2, -size / 2], radius = 25 )
/// |> extrude(length = 50)
///
/// hollow(0.5, case)

View File

@ -130,7 +130,6 @@ pub async fn line(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
/// |> line(end = [-10, 0], tag = $thirdLineOfBox)
/// |> close()
/// |> extrude(length = 5)
///
/// ```
#[stdlib {
name = "line",
@ -2238,8 +2237,8 @@ pub async fn hole(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
/// |> line(end = [5, 0])
/// |> line(end = [0, -5])
/// |> close()
/// |> hole(circle({ center = [1, 1], radius = .25 }, %), %)
/// |> hole(circle({ center = [1, 4], radius = .25 }, %), %)
/// |> hole(circle(center = [1, 1], radius = .25 ), %)
/// |> hole(circle(center = [1, 4], radius = .25 ), %)
///
/// example = extrude(exampleSketch, length = 1)
/// ```
@ -2256,7 +2255,7 @@ pub async fn hole(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
/// }
///
/// exampleSketch = startSketchOn('-XZ')
/// |> circle({ center = [0, 0], radius = 3 }, %)
/// |> circle(center = [0, 0], radius = 3 )
/// |> hole(squareHoleSketch(), %)
/// example = extrude(exampleSketch, length = 1)
/// ```

View File

@ -71,16 +71,16 @@ pub async fn sweep(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
///
/// // Create a hole for the pipe.
/// pipeHole = startSketchOn('XY')
/// |> circle({
/// |> circle(
/// center = [0, 0],
/// radius = 1.5,
/// }, %)
/// )
///
/// sweepSketch = startSketchOn('XY')
/// |> circle({
/// |> circle(
/// center = [0, 0],
/// radius = 2,
/// }, %)
/// )
/// |> hole(pipeHole, %)
/// |> sweep({
/// path: sweepPath,
@ -103,7 +103,7 @@ pub async fn sweep(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
///
/// // Create a spring by sweeping around the helix path.
/// springSketch = startSketchOn('YZ')
/// |> circle({ center = [0, 0], radius = 1 }, %)
/// |> circle(center = [0, 0], radius = 1 )
/// |> sweep({ path = helixPath }, %)
/// ```
#[stdlib {

View File

@ -318,23 +318,41 @@ impl CallExpressionKw {
fn recast(&self, options: &FormatOptions, indentation_level: usize, ctxt: ExprContext) -> String {
let indent = if ctxt == ExprContext::Pipe {
"".to_string()
} else {
options.get_indentation(indentation_level + 1)
};
let closing_indentation = if ctxt == ExprContext::Pipe {
options.get_indentation_offset_pipe(indentation_level)
} else {
options.get_indentation(indentation_level)
};
let name = &self.callee.name;
let mut arg_list = if let Some(first_arg) = &self.unlabeled {
vec![first_arg.recast(options, indentation_level, ctxt)]
let inner_indentation = if ctxt == ExprContext::Pipe {
options.get_indentation_offset_pipe(indentation_level + 1)
} else {
Vec::new()
options.get_indentation(indentation_level + 1)
};
let name = &self.callee.name;
let mut arg_list = Vec::new();
if let Some(first_arg) = &self.unlabeled {
let fst_arg = first_arg.recast(options, indentation_level + 1, ctxt);
arg_list.push(fst_arg)
};
arg_list.extend(
self.arguments
.iter()
.map(|arg| arg.recast(options, indentation_level, ctxt)),
.map(|arg| arg.recast(options, indentation_level + 1, ctxt)),
);
if arg_list.iter().any(|arg| arg.contains('\n')) {
// Multiline
let args = arg_list.join(&format!(",\n{inner_indentation}"));
format!("{indent}{name}(\n{inner_indentation}{args},\n{closing_indentation})")
} else {
// Single line
let args = arg_list.join(", ");
format!("{indent}{name}({args})")
}
}
}
impl LabeledArg {
@ -1407,13 +1425,13 @@ tabs_r = startSketchOn({
|> line([0, -10], %)
|> line([-10, -5], %)
|> close()
|> hole(circle({
|> hole(circle(
center = [
width / 2 + thk + hole_diam,
length / 2 - hole_diam
],
radius = hole_diam / 2
}, %), %)
radius = hole_diam / 2,
), %)
|> extrude(-thk, %)
|> patternLinear3d({
axis = [0, -1, 0],
@ -1434,13 +1452,13 @@ tabs_l = startSketchOn({
|> line([0, -10], %)
|> line([10, -5], %)
|> close()
|> hole(circle({
|> hole(circle(
center = [
-width / 2 - thk - hole_diam,
length / 2 - hole_diam
],
radius = hole_diam / 2
}, %), %)
radius = hole_diam / 2,
), %)
|> extrude(-thk, %)
|> patternLinear3d({
axis = [0, -1, 0],
@ -1532,13 +1550,13 @@ tabs_r = startSketchOn({
|> line([0, -10], %)
|> line([-10, -5], %)
|> close()
|> hole(circle({
|> hole(circle(
center = [
width / 2 + thk + hole_diam,
length / 2 - hole_diam
],
radius = hole_diam / 2
}, %), %)
radius = hole_diam / 2,
), %)
|> extrude(-thk, %)
|> patternLinear3d({
axis = [0, -1, 0],
@ -1559,13 +1577,13 @@ tabs_l = startSketchOn({
|> line([0, -10], %)
|> line([10, -5], %)
|> close()
|> hole(circle({
|> hole(circle(
center = [
-width / 2 - thk - hole_diam,
length / 2 - hole_diam
],
radius = hole_diam / 2
}, %), %)
radius = hole_diam / 2,
), %)
|> extrude(-thk, %)
|> patternLinear3d({
axis = [0, -1, 0],

View File

@ -927,7 +927,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
1374,
1418,
1411,
0
],
"command": {
@ -947,7 +947,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
1374,
1418,
1411,
0
],
"command": {
@ -958,7 +958,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
1374,
1418,
1411,
0
],
"command": {
@ -975,7 +975,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
1374,
1418,
1411,
0
],
"command": {
@ -1004,7 +1004,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
1374,
1418,
1411,
0
],
"command": {
@ -1015,8 +1015,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1431,
1476,
1424,
1463,
0
],
"command": {
@ -1035,8 +1035,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1431,
1476,
1424,
1463,
0
],
"command": {
@ -1046,8 +1046,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1431,
1476,
1424,
1463,
0
],
"command": {
@ -1063,8 +1063,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1431,
1476,
1424,
1463,
0
],
"command": {
@ -1092,8 +1092,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1431,
1476,
1424,
1463,
0
],
"command": {
@ -1104,8 +1104,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1426,
1480,
1419,
1467,
0
],
"command": {
@ -1117,8 +1117,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1426,
1480,
1419,
1467,
0
],
"command": {
@ -1130,8 +1130,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -1150,8 +1150,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -1164,8 +1164,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -1175,8 +1175,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -1187,8 +1187,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -1200,8 +1200,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -1214,8 +1214,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -1228,8 +1228,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -1242,8 +1242,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -1334,7 +1334,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
1374,
1418,
1411,
0
],
"command": {
@ -1354,7 +1354,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
1374,
1418,
1411,
0
],
"command": {
@ -1365,7 +1365,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
1374,
1418,
1411,
0
],
"command": {
@ -1382,7 +1382,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
1374,
1418,
1411,
0
],
"command": {
@ -1411,7 +1411,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
1374,
1418,
1411,
0
],
"command": {
@ -1422,8 +1422,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1431,
1476,
1424,
1463,
0
],
"command": {
@ -1442,8 +1442,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1431,
1476,
1424,
1463,
0
],
"command": {
@ -1453,8 +1453,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1431,
1476,
1424,
1463,
0
],
"command": {
@ -1470,8 +1470,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1431,
1476,
1424,
1463,
0
],
"command": {
@ -1499,8 +1499,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1431,
1476,
1424,
1463,
0
],
"command": {
@ -1511,8 +1511,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1426,
1480,
1419,
1467,
0
],
"command": {
@ -1524,8 +1524,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1426,
1480,
1419,
1467,
0
],
"command": {
@ -1537,8 +1537,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -1557,8 +1557,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -1571,8 +1571,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -1582,8 +1582,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -1594,8 +1594,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -1607,8 +1607,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -1621,8 +1621,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -1635,8 +1635,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -1649,8 +1649,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -1741,7 +1741,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
1374,
1418,
1411,
0
],
"command": {
@ -1761,7 +1761,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
1374,
1418,
1411,
0
],
"command": {
@ -1772,7 +1772,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
1374,
1418,
1411,
0
],
"command": {
@ -1789,7 +1789,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
1374,
1418,
1411,
0
],
"command": {
@ -1818,7 +1818,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
1374,
1418,
1411,
0
],
"command": {
@ -1829,8 +1829,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1431,
1476,
1424,
1463,
0
],
"command": {
@ -1849,8 +1849,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1431,
1476,
1424,
1463,
0
],
"command": {
@ -1860,8 +1860,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1431,
1476,
1424,
1463,
0
],
"command": {
@ -1877,8 +1877,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1431,
1476,
1424,
1463,
0
],
"command": {
@ -1906,8 +1906,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1431,
1476,
1424,
1463,
0
],
"command": {
@ -1918,8 +1918,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1426,
1480,
1419,
1467,
0
],
"command": {
@ -1931,8 +1931,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1426,
1480,
1419,
1467,
0
],
"command": {
@ -1944,8 +1944,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -1964,8 +1964,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -1978,8 +1978,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -1989,8 +1989,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -2001,8 +2001,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -2014,8 +2014,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -2028,8 +2028,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -2042,8 +2042,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -2056,8 +2056,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -2148,7 +2148,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
1374,
1418,
1411,
0
],
"command": {
@ -2168,7 +2168,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
1374,
1418,
1411,
0
],
"command": {
@ -2179,7 +2179,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
1374,
1418,
1411,
0
],
"command": {
@ -2196,7 +2196,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
1374,
1418,
1411,
0
],
"command": {
@ -2225,7 +2225,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
1374,
1418,
1411,
0
],
"command": {
@ -2236,8 +2236,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1431,
1476,
1424,
1463,
0
],
"command": {
@ -2256,8 +2256,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1431,
1476,
1424,
1463,
0
],
"command": {
@ -2267,8 +2267,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1431,
1476,
1424,
1463,
0
],
"command": {
@ -2284,8 +2284,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1431,
1476,
1424,
1463,
0
],
"command": {
@ -2313,8 +2313,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1431,
1476,
1424,
1463,
0
],
"command": {
@ -2325,8 +2325,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1426,
1480,
1419,
1467,
0
],
"command": {
@ -2338,8 +2338,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1426,
1480,
1419,
1467,
0
],
"command": {
@ -2351,8 +2351,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -2371,8 +2371,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -2385,8 +2385,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -2396,8 +2396,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -2408,8 +2408,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -2421,8 +2421,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -2435,8 +2435,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -2449,8 +2449,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -2463,8 +2463,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
1488,
1512,
1475,
1499,
0
],
"command": {
@ -2541,8 +2541,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
2047,
2110,
2034,
2097,
0
],
"command": {

View File

@ -20,52 +20,52 @@ flowchart LR
31["Path<br>[1341, 1366, 0]"]
end
subgraph path32 [Path]
32["Path<br>[1374, 1418, 0]"]
33["Segment<br>[1374, 1418, 0]"]
32["Path<br>[1374, 1411, 0]"]
33["Segment<br>[1374, 1411, 0]"]
34[Solid2d]
end
subgraph path35 [Path]
35["Path<br>[1431, 1476, 0]"]
36["Segment<br>[1431, 1476, 0]"]
35["Path<br>[1424, 1463, 0]"]
36["Segment<br>[1424, 1463, 0]"]
37[Solid2d]
end
subgraph path45 [Path]
45["Path<br>[1341, 1366, 0]"]
end
subgraph path46 [Path]
46["Path<br>[1374, 1418, 0]"]
47["Segment<br>[1374, 1418, 0]"]
46["Path<br>[1374, 1411, 0]"]
47["Segment<br>[1374, 1411, 0]"]
48[Solid2d]
end
subgraph path49 [Path]
49["Path<br>[1431, 1476, 0]"]
50["Segment<br>[1431, 1476, 0]"]
49["Path<br>[1424, 1463, 0]"]
50["Segment<br>[1424, 1463, 0]"]
51[Solid2d]
end
subgraph path59 [Path]
59["Path<br>[1341, 1366, 0]"]
end
subgraph path60 [Path]
60["Path<br>[1374, 1418, 0]"]
61["Segment<br>[1374, 1418, 0]"]
60["Path<br>[1374, 1411, 0]"]
61["Segment<br>[1374, 1411, 0]"]
62[Solid2d]
end
subgraph path63 [Path]
63["Path<br>[1431, 1476, 0]"]
64["Segment<br>[1431, 1476, 0]"]
63["Path<br>[1424, 1463, 0]"]
64["Segment<br>[1424, 1463, 0]"]
65[Solid2d]
end
subgraph path73 [Path]
73["Path<br>[1341, 1366, 0]"]
end
subgraph path74 [Path]
74["Path<br>[1374, 1418, 0]"]
75["Segment<br>[1374, 1418, 0]"]
74["Path<br>[1374, 1411, 0]"]
75["Segment<br>[1374, 1411, 0]"]
76[Solid2d]
end
subgraph path77 [Path]
77["Path<br>[1431, 1476, 0]"]
78["Segment<br>[1431, 1476, 0]"]
77["Path<br>[1424, 1463, 0]"]
78["Segment<br>[1424, 1463, 0]"]
79[Solid2d]
end
1["Plane<br>[373, 461, 0]"]
@ -86,28 +86,28 @@ flowchart LR
28["SweepEdge Opposite"]
29["SweepEdge Adjacent"]
30["Plane<br>[1314, 1333, 0]"]
38["Sweep Extrusion<br>[1488, 1512, 0]"]
38["Sweep Extrusion<br>[1475, 1499, 0]"]
39[Wall]
40["Cap Start"]
41["Cap End"]
42["SweepEdge Opposite"]
43["SweepEdge Adjacent"]
44["Plane<br>[1314, 1333, 0]"]
52["Sweep Extrusion<br>[1488, 1512, 0]"]
52["Sweep Extrusion<br>[1475, 1499, 0]"]
53[Wall]
54["Cap Start"]
55["Cap End"]
56["SweepEdge Opposite"]
57["SweepEdge Adjacent"]
58["Plane<br>[1314, 1333, 0]"]
66["Sweep Extrusion<br>[1488, 1512, 0]"]
66["Sweep Extrusion<br>[1475, 1499, 0]"]
67[Wall]
68["Cap Start"]
69["Cap End"]
70["SweepEdge Opposite"]
71["SweepEdge Adjacent"]
72["Plane<br>[1314, 1333, 0]"]
80["Sweep Extrusion<br>[1488, 1512, 0]"]
80["Sweep Extrusion<br>[1475, 1499, 0]"]
81[Wall]
82["Cap Start"]
83["Cap End"]

File diff suppressed because it is too large Load Diff

View File

@ -26,18 +26,24 @@ miniHdmiHole = startSketchAt([
0,
border + miniHdmiDistance - (miniHdmiWidth / 2)
])
|> line(endAbsolute = [
|> line(
endAbsolute = [
0,
border + miniHdmiDistance + miniHdmiWidth / 2
])
|> line(endAbsolute = [
],
)
|> line(
endAbsolute = [
1,
border + miniHdmiDistance + miniHdmiWidth / 2
])
|> line(endAbsolute = [
],
)
|> line(
endAbsolute = [
1,
border + miniHdmiDistance - (miniHdmiWidth / 2)
])
],
)
|> close(%)
case = startSketchOn('XY')
@ -60,8 +66,8 @@ case = startSketchOn('XY')
fn m25Screw(x, y, height) {
screw = startSketchOn("XY")
|> startProfileAt([0, 0], %)
|> circle({ center = [x, y], radius = 2.5 }, %)
|> hole(circle({ center = [x, y], radius = 1.25 }, %), %)
|> circle(center = [x, y], radius = 2.5)
|> hole(circle(center = [x, y], radius = 1.25), %)
|> extrude(length = height)
return screw
}

View File

@ -73,14 +73,14 @@ snapshot_kind: text
"name": "m25Screw",
"functionSourceRange": [
1287,
1529,
1516,
0
],
"unlabeledArg": null,
"labeledArgs": {},
"sourceRange": [
1531,
1660,
1518,
1647,
0
]
},
@ -107,23 +107,23 @@ snapshot_kind: text
"labeledArgs": {
"hole_sketch": {
"sourceRange": [
1431,
1476,
1424,
1463,
0
]
},
"sketch": {
"sourceRange": [
1478,
1479,
1465,
1466,
0
]
}
},
"name": "hole",
"sourceRange": [
1426,
1480,
1419,
1467,
0
],
"type": "StdLibCall",
@ -133,16 +133,16 @@ snapshot_kind: text
"labeledArgs": {
"length": {
"sourceRange": [
1505,
1511,
1492,
1498,
0
]
}
},
"name": "extrude",
"sourceRange": [
1488,
1512,
1475,
1499,
0
],
"type": "StdLibCall",
@ -156,14 +156,14 @@ snapshot_kind: text
"name": "m25Screw",
"functionSourceRange": [
1287,
1529,
1516,
0
],
"unlabeledArg": null,
"labeledArgs": {},
"sourceRange": [
1662,
1789,
1649,
1776,
0
]
},
@ -190,23 +190,23 @@ snapshot_kind: text
"labeledArgs": {
"hole_sketch": {
"sourceRange": [
1431,
1476,
1424,
1463,
0
]
},
"sketch": {
"sourceRange": [
1478,
1479,
1465,
1466,
0
]
}
},
"name": "hole",
"sourceRange": [
1426,
1480,
1419,
1467,
0
],
"type": "StdLibCall",
@ -216,16 +216,16 @@ snapshot_kind: text
"labeledArgs": {
"length": {
"sourceRange": [
1505,
1511,
1492,
1498,
0
]
}
},
"name": "extrude",
"sourceRange": [
1488,
1512,
1475,
1499,
0
],
"type": "StdLibCall",
@ -239,14 +239,14 @@ snapshot_kind: text
"name": "m25Screw",
"functionSourceRange": [
1287,
1529,
1516,
0
],
"unlabeledArg": null,
"labeledArgs": {},
"sourceRange": [
1791,
1916,
1778,
1903,
0
]
},
@ -273,23 +273,23 @@ snapshot_kind: text
"labeledArgs": {
"hole_sketch": {
"sourceRange": [
1431,
1476,
1424,
1463,
0
]
},
"sketch": {
"sourceRange": [
1478,
1479,
1465,
1466,
0
]
}
},
"name": "hole",
"sourceRange": [
1426,
1480,
1419,
1467,
0
],
"type": "StdLibCall",
@ -299,16 +299,16 @@ snapshot_kind: text
"labeledArgs": {
"length": {
"sourceRange": [
1505,
1511,
1492,
1498,
0
]
}
},
"name": "extrude",
"sourceRange": [
1488,
1512,
1475,
1499,
0
],
"type": "StdLibCall",
@ -322,14 +322,14 @@ snapshot_kind: text
"name": "m25Screw",
"functionSourceRange": [
1287,
1529,
1516,
0
],
"unlabeledArg": null,
"labeledArgs": {},
"sourceRange": [
1918,
2045,
1905,
2032,
0
]
},
@ -356,23 +356,23 @@ snapshot_kind: text
"labeledArgs": {
"hole_sketch": {
"sourceRange": [
1431,
1476,
1424,
1463,
0
]
},
"sketch": {
"sourceRange": [
1478,
1479,
1465,
1466,
0
]
}
},
"name": "hole",
"sourceRange": [
1426,
1480,
1419,
1467,
0
],
"type": "StdLibCall",
@ -382,16 +382,16 @@ snapshot_kind: text
"labeledArgs": {
"length": {
"sourceRange": [
1505,
1511,
1492,
1498,
0
]
}
},
"name": "extrude",
"sourceRange": [
1488,
1512,
1475,
1499,
0
],
"type": "StdLibCall",
@ -404,23 +404,23 @@ snapshot_kind: text
"labeledArgs": {
"data": {
"sourceRange": [
2053,
2103,
2040,
2090,
0
]
},
"solid_set": {
"sourceRange": [
2105,
2109,
2092,
2096,
0
]
}
},
"name": "shell",
"sourceRange": [
2047,
2110,
2034,
2097,
0
],
"type": "StdLibCall",

View File

@ -1,6 +1,7 @@
---
source: kcl/src/simulation_tests.rs
description: Program memory after executing fillet-and-shell.kcl
snapshot_kind: text
---
{
"environments": [
@ -921,7 +922,7 @@ description: Program memory after executing fillet-and-shell.kcl
"body": [
{
"declaration": {
"end": 1512,
"end": 1499,
"id": {
"end": 1311,
"name": "screw",
@ -1005,55 +1006,44 @@ description: Program memory after executing fillet-and-shell.kcl
{
"arguments": [
{
"end": 1414,
"properties": [
{
"end": 1398,
"key": {
"end": 1389,
"name": "center",
"start": 1383,
"type": "Identifier"
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "center"
},
"start": 1383,
"type": "ObjectProperty",
"value": {
"arg": {
"elements": [
{
"end": 1394,
"end": 1392,
"name": "x",
"start": 1393,
"start": 1391,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 1397,
"end": 1395,
"name": "y",
"start": 1396,
"start": 1394,
"type": "Identifier",
"type": "Identifier"
}
],
"end": 1398,
"start": 1392,
"end": 1396,
"start": 1390,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
},
{
"end": 1412,
"key": {
"end": 1406,
"name": "radius",
"start": 1400,
"type": "Identifier"
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "radius"
},
"start": 1400,
"type": "ObjectProperty",
"value": {
"end": 1412,
"arg": {
"end": 1410,
"raw": "2.5",
"start": 1409,
"start": 1407,
"type": "Literal",
"type": "Literal",
"value": {
@ -1063,82 +1053,61 @@ description: Program memory after executing fillet-and-shell.kcl
}
}
],
"start": 1381,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
{
"end": 1417,
"start": 1416,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 1380,
"name": "circle",
"start": 1374,
"type": "Identifier"
},
"end": 1418,
"end": 1411,
"start": 1374,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"arguments": [
{
"end": 1472,
"properties": [
{
"end": 1455,
"key": {
"end": 1446,
"name": "center",
"start": 1440,
"type": "Identifier"
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "center"
},
"start": 1440,
"type": "ObjectProperty",
"value": {
"arg": {
"elements": [
{
"end": 1451,
"end": 1442,
"name": "x",
"start": 1450,
"start": 1441,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 1454,
"end": 1445,
"name": "y",
"start": 1453,
"start": 1444,
"type": "Identifier",
"type": "Identifier"
}
],
"end": 1455,
"start": 1449,
"end": 1446,
"start": 1440,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
},
{
"end": 1470,
"key": {
"end": 1463,
"name": "radius",
"start": 1457,
"type": "Identifier"
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "radius"
},
"start": 1457,
"type": "ObjectProperty",
"value": {
"end": 1470,
"arg": {
"end": 1461,
"raw": "1.25",
"start": 1466,
"start": 1457,
"type": "Literal",
"type": "Literal",
"value": {
@ -1148,43 +1117,33 @@ description: Program memory after executing fillet-and-shell.kcl
}
}
],
"start": 1438,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
{
"end": 1475,
"start": 1474,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 1437,
"name": "circle",
"start": 1431,
"type": "Identifier"
},
"end": 1476,
"start": 1431,
"type": "CallExpression",
"type": "CallExpression"
},
{
"end": 1479,
"start": 1478,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 1430,
"name": "hole",
"start": 1426,
"name": "circle",
"start": 1424,
"type": "Identifier"
},
"end": 1480,
"start": 1426,
"end": 1463,
"start": 1424,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"end": 1466,
"start": 1465,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 1423,
"name": "hole",
"start": 1419,
"type": "Identifier"
},
"end": 1467,
"start": 1419,
"type": "CallExpression",
"type": "CallExpression"
},
@ -1197,28 +1156,28 @@ description: Program memory after executing fillet-and-shell.kcl
"name": "length"
},
"arg": {
"end": 1511,
"end": 1498,
"name": "height",
"start": 1505,
"start": 1492,
"type": "Identifier",
"type": "Identifier"
}
}
],
"callee": {
"end": 1495,
"end": 1482,
"name": "extrude",
"start": 1488,
"start": 1475,
"type": "Identifier"
},
"end": 1512,
"start": 1488,
"end": 1499,
"start": 1475,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
}
],
"end": 1512,
"end": 1499,
"start": 1314,
"type": "PipeExpression",
"type": "PipeExpression"
@ -1226,7 +1185,7 @@ description: Program memory after executing fillet-and-shell.kcl
"start": 1306,
"type": "VariableDeclarator"
},
"end": 1512,
"end": 1499,
"kind": "const",
"start": 1306,
"type": "VariableDeclaration",
@ -1234,22 +1193,22 @@ description: Program memory after executing fillet-and-shell.kcl
},
{
"argument": {
"end": 1527,
"end": 1514,
"name": "screw",
"start": 1522,
"start": 1509,
"type": "Identifier",
"type": "Identifier"
},
"end": 1527,
"start": 1515,
"end": 1514,
"start": 1502,
"type": "ReturnStatement",
"type": "ReturnStatement"
}
],
"end": 1529,
"end": 1516,
"start": 1302
},
"end": 1529,
"end": 1516,
"params": [
{
"type": "Parameter",
@ -2471,7 +2430,7 @@ description: Program memory after executing fillet-and-shell.kcl
{
"sourceRange": [
1287,
1529,
1516,
0
]
}

View File

@ -315,7 +315,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
35,
78,
71,
0
],
"command": {
@ -335,7 +335,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
35,
78,
71,
0
],
"command": {
@ -346,7 +346,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
35,
78,
71,
0
],
"command": {
@ -363,7 +363,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
35,
78,
71,
0
],
"command": {
@ -392,7 +392,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
35,
78,
71,
0
],
"command": {
@ -403,8 +403,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
84,
104,
77,
97,
0
],
"command": {
@ -423,8 +423,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
84,
104,
77,
97,
0
],
"command": {
@ -437,8 +437,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
84,
104,
77,
97,
0
],
"command": {
@ -448,8 +448,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
84,
104,
77,
97,
0
],
"command": {
@ -460,8 +460,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
84,
104,
77,
97,
0
],
"command": {
@ -473,8 +473,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
84,
104,
77,
97,
0
],
"command": {
@ -487,8 +487,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
84,
104,
77,
97,
0
],
"command": {
@ -501,8 +501,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
110,
205,
103,
198,
0
],
"command": {

View File

@ -1,12 +1,12 @@
```mermaid
flowchart LR
subgraph path2 [Path]
2["Path<br>[35, 78, 0]"]
3["Segment<br>[35, 78, 0]"]
2["Path<br>[35, 71, 0]"]
3["Segment<br>[35, 71, 0]"]
4[Solid2d]
end
1["Plane<br>[10, 29, 0]"]
5["Sweep Extrusion<br>[84, 104, 0]"]
5["Sweep Extrusion<br>[77, 97, 0]"]
6[Wall]
7["Cap Start"]
8["Cap End"]

View File

@ -1,13 +1,14 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing helix_ccw.kcl
snapshot_kind: text
---
{
"Ok": {
"body": [
{
"declaration": {
"end": 205,
"end": 198,
"id": {
"end": 7,
"name": "part001",
@ -41,24 +42,17 @@ description: Result of parsing helix_ccw.kcl
{
"arguments": [
{
"end": 74,
"properties": [
{
"end": 59,
"key": {
"end": 50,
"name": "center",
"start": 44,
"type": "Identifier"
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "center"
},
"start": 44,
"type": "ObjectProperty",
"value": {
"arg": {
"elements": [
{
"end": 55,
"end": 53,
"raw": "5",
"start": 54,
"start": 52,
"type": "Literal",
"type": "Literal",
"value": {
@ -67,9 +61,9 @@ description: Result of parsing helix_ccw.kcl
}
},
{
"end": 58,
"end": 56,
"raw": "5",
"start": 57,
"start": 55,
"type": "Literal",
"type": "Literal",
"value": {
@ -78,26 +72,22 @@ description: Result of parsing helix_ccw.kcl
}
}
],
"end": 59,
"start": 53,
"end": 57,
"start": 51,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
},
{
"end": 72,
"key": {
"end": 67,
"name": "radius",
"start": 61,
"type": "Identifier"
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "radius"
},
"start": 61,
"type": "ObjectProperty",
"value": {
"end": 72,
"arg": {
"end": 70,
"raw": "10",
"start": 70,
"start": 68,
"type": "Literal",
"type": "Literal",
"value": {
@ -107,27 +97,17 @@ description: Result of parsing helix_ccw.kcl
}
}
],
"start": 42,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
{
"end": 77,
"start": 76,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 41,
"name": "circle",
"start": 35,
"type": "Identifier"
},
"end": 78,
"end": 71,
"start": 35,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
@ -138,9 +118,9 @@ description: Result of parsing helix_ccw.kcl
"name": "length"
},
"arg": {
"end": 103,
"end": 96,
"raw": "10",
"start": 101,
"start": 94,
"type": "Literal",
"type": "Literal",
"value": {
@ -151,13 +131,13 @@ description: Result of parsing helix_ccw.kcl
}
],
"callee": {
"end": 91,
"end": 84,
"name": "extrude",
"start": 84,
"start": 77,
"type": "Identifier"
},
"end": 104,
"start": 84,
"end": 97,
"start": 77,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
@ -165,22 +145,22 @@ description: Result of parsing helix_ccw.kcl
{
"arguments": [
{
"end": 201,
"end": 194,
"properties": [
{
"end": 152,
"end": 145,
"key": {
"end": 147,
"end": 140,
"name": "revolutions",
"start": 136,
"start": 129,
"type": "Identifier"
},
"start": 136,
"start": 129,
"type": "ObjectProperty",
"value": {
"end": 152,
"end": 145,
"raw": "16",
"start": 150,
"start": 143,
"type": "Literal",
"type": "Literal",
"value": {
@ -190,19 +170,19 @@ description: Result of parsing helix_ccw.kcl
}
},
{
"end": 175,
"end": 168,
"key": {
"end": 171,
"end": 164,
"name": "angleStart",
"start": 161,
"start": 154,
"type": "Identifier"
},
"start": 161,
"start": 154,
"type": "ObjectProperty",
"value": {
"end": 175,
"end": 168,
"raw": "0",
"start": 174,
"start": 167,
"type": "Literal",
"type": "Literal",
"value": {
@ -212,49 +192,49 @@ description: Result of parsing helix_ccw.kcl
}
},
{
"end": 194,
"key": {
"end": 187,
"key": {
"end": 180,
"name": "ccw",
"start": 184,
"start": 177,
"type": "Identifier"
},
"start": 184,
"start": 177,
"type": "ObjectProperty",
"value": {
"end": 194,
"end": 187,
"raw": "true",
"start": 190,
"start": 183,
"type": "Literal",
"type": "Literal",
"value": true
}
}
],
"start": 127,
"start": 120,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
{
"end": 204,
"start": 203,
"end": 197,
"start": 196,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 126,
"end": 119,
"name": "helixRevolutions",
"start": 110,
"start": 103,
"type": "Identifier"
},
"end": 205,
"start": 110,
"end": 198,
"start": 103,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 205,
"end": 198,
"start": 10,
"type": "PipeExpression",
"type": "PipeExpression"
@ -262,14 +242,14 @@ description: Result of parsing helix_ccw.kcl
"start": 0,
"type": "VariableDeclarator"
},
"end": 205,
"end": 198,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 206,
"end": 199,
"start": 0
}
}

View File

@ -1,5 +1,5 @@
part001 = startSketchOn('XY')
|> circle({ center = [5, 5], radius = 10 }, %)
|> circle(center = [5, 5], radius = 10)
|> extrude(length = 10)
|> helixRevolutions({
revolutions = 16,

View File

@ -27,16 +27,16 @@ snapshot_kind: text
"labeledArgs": {
"length": {
"sourceRange": [
101,
103,
94,
96,
0
]
}
},
"name": "extrude",
"sourceRange": [
84,
104,
77,
97,
0
],
"type": "StdLibCall",
@ -46,23 +46,23 @@ snapshot_kind: text
"labeledArgs": {
"data": {
"sourceRange": [
127,
201,
120,
194,
0
]
},
"solid": {
"sourceRange": [
203,
204,
196,
197,
0
]
}
},
"name": "helixRevolutions",
"sourceRange": [
110,
205,
103,
198,
0
],
"type": "StdLibCall",

View File

@ -1,6 +1,7 @@
---
source: kcl/src/simulation_tests.rs
description: Program memory after executing helix_ccw.kcl
snapshot_kind: text
---
{
"environments": [
@ -37,7 +38,7 @@ description: Program memory after executing helix_ccw.kcl
"id": "[uuid]",
"sourceRange": [
35,
78,
71,
0
],
"tag": null,
@ -53,7 +54,7 @@ description: Program memory after executing helix_ccw.kcl
"id": "[uuid]",
"sourceRange": [
35,
78,
71,
0
]
},
@ -118,7 +119,7 @@ description: Program memory after executing helix_ccw.kcl
"id": "[uuid]",
"sourceRange": [
35,
78,
71,
0
]
}
@ -130,7 +131,7 @@ description: Program memory after executing helix_ccw.kcl
{
"sourceRange": [
35,
78,
71,
0
]
}
@ -146,7 +147,7 @@ description: Program memory after executing helix_ccw.kcl
{
"sourceRange": [
35,
78,
71,
0
]
}

View File

@ -315,7 +315,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
106,
149,
143,
1
],
"command": {
@ -335,7 +335,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
106,
149,
143,
1
],
"command": {
@ -346,7 +346,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
106,
149,
143,
1
],
"command": {
@ -363,7 +363,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
106,
149,
143,
1
],
"command": {
@ -392,7 +392,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
106,
149,
143,
1
],
"command": {

View File

@ -1,8 +1,8 @@
```mermaid
flowchart LR
subgraph path2 [Path]
2["Path<br>[106, 149, 1]"]
3["Segment<br>[106, 149, 1]"]
2["Path<br>[106, 143, 1]"]
3["Segment<br>[106, 143, 1]"]
4[Solid2d]
end
1["Plane<br>[81, 100, 1]"]

View File

@ -2,4 +2,4 @@ export fn foo = () => { return 0 }
// This interacts with the engine.
part001 = startSketchOn('XY')
|> circle({ center = [0, 0], radius = 10 }, %)
|> circle(center = [0, 0], radius = 10 )

View File

@ -1,6 +1,7 @@
---
source: kcl/src/simulation_tests.rs
description: Artifact commands import_whole.kcl
snapshot_kind: text
---
[
{
@ -326,7 +327,7 @@ description: Artifact commands import_whole.kcl
"cmdId": "[uuid]",
"range": [
61,
104,
98,
1
],
"command": {
@ -346,7 +347,7 @@ description: Artifact commands import_whole.kcl
"cmdId": "[uuid]",
"range": [
61,
104,
98,
1
],
"command": {
@ -357,7 +358,7 @@ description: Artifact commands import_whole.kcl
"cmdId": "[uuid]",
"range": [
61,
104,
98,
1
],
"command": {
@ -374,7 +375,7 @@ description: Artifact commands import_whole.kcl
"cmdId": "[uuid]",
"range": [
61,
104,
98,
1
],
"command": {
@ -403,7 +404,7 @@ description: Artifact commands import_whole.kcl
"cmdId": "[uuid]",
"range": [
61,
104,
98,
1
],
"command": {
@ -414,8 +415,8 @@ description: Artifact commands import_whole.kcl
{
"cmdId": "[uuid]",
"range": [
110,
130,
104,
124,
1
],
"command": {
@ -434,8 +435,8 @@ description: Artifact commands import_whole.kcl
{
"cmdId": "[uuid]",
"range": [
110,
130,
104,
124,
1
],
"command": {
@ -448,8 +449,8 @@ description: Artifact commands import_whole.kcl
{
"cmdId": "[uuid]",
"range": [
110,
130,
104,
124,
1
],
"command": {
@ -459,8 +460,8 @@ description: Artifact commands import_whole.kcl
{
"cmdId": "[uuid]",
"range": [
110,
130,
104,
124,
1
],
"command": {
@ -471,8 +472,8 @@ description: Artifact commands import_whole.kcl
{
"cmdId": "[uuid]",
"range": [
110,
130,
104,
124,
1
],
"command": {
@ -484,8 +485,8 @@ description: Artifact commands import_whole.kcl
{
"cmdId": "[uuid]",
"range": [
110,
130,
104,
124,
1
],
"command": {
@ -498,8 +499,8 @@ description: Artifact commands import_whole.kcl
{
"cmdId": "[uuid]",
"range": [
110,
130,
104,
124,
1
],
"command": {

View File

@ -1,12 +1,12 @@
```mermaid
flowchart LR
subgraph path2 [Path]
2["Path<br>[61, 104, 1]"]
3["Segment<br>[61, 104, 1]"]
2["Path<br>[61, 98, 1]"]
3["Segment<br>[61, 98, 1]"]
4[Solid2d]
end
1["Plane<br>[36, 55, 1]"]
5["Sweep Extrusion<br>[110, 130, 1]"]
5["Sweep Extrusion<br>[104, 124, 1]"]
6[Wall]
7["Cap Start"]
8["Cap End"]

View File

@ -1,4 +1,4 @@
@settings(defaultLengthUnit = inch)
startSketchOn('XY')
|> circle({ center = [5, 5], radius = 10 }, %)
|> circle(center = [5, 5], radius = 10 )
|> extrude(length = 10)

View File

@ -1,6 +1,7 @@
---
source: kcl/src/simulation_tests.rs
description: Program memory after executing import_whole.kcl
snapshot_kind: text
---
{
"environments": [
@ -37,7 +38,7 @@ description: Program memory after executing import_whole.kcl
"id": "[uuid]",
"sourceRange": [
61,
104,
98,
1
],
"tag": null,
@ -53,7 +54,7 @@ description: Program memory after executing import_whole.kcl
"id": "[uuid]",
"sourceRange": [
61,
104,
98,
1
]
},
@ -118,7 +119,7 @@ description: Program memory after executing import_whole.kcl
"id": "[uuid]",
"sourceRange": [
61,
104,
98,
1
]
}
@ -130,7 +131,7 @@ description: Program memory after executing import_whole.kcl
{
"sourceRange": [
61,
104,
98,
1
]
}
@ -146,7 +147,7 @@ description: Program memory after executing import_whole.kcl
{
"sourceRange": [
61,
104,
98,
1
]
}

File diff suppressed because it is too large Load Diff

View File

@ -631,7 +631,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
298,
351,
350,
0
],
"command": {
@ -647,7 +647,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
298,
351,
350,
0
],
"command": {
@ -658,7 +658,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
298,
351,
350,
0
],
"command": {
@ -675,7 +675,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
298,
351,
350,
0
],
"command": {
@ -704,7 +704,7 @@ snapshot_kind: text
"cmdId": "[uuid]",
"range": [
298,
351,
350,
0
],
"command": {
@ -715,8 +715,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
357,
376,
356,
375,
0
],
"command": {
@ -731,8 +731,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
357,
376,
356,
375,
0
],
"command": {
@ -745,8 +745,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
357,
376,
356,
375,
0
],
"command": {
@ -756,8 +756,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
357,
376,
356,
375,
0
],
"command": {
@ -768,8 +768,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
357,
376,
356,
375,
0
],
"command": {
@ -781,8 +781,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
357,
376,
356,
375,
0
],
"command": {
@ -795,8 +795,8 @@ snapshot_kind: text
{
"cmdId": "[uuid]",
"range": [
357,
376,
356,
375,
0
],
"command": {

View File

@ -9,8 +9,8 @@ flowchart LR
7[Solid2d]
end
subgraph path23 [Path]
23["Path<br>[298, 351, 0]"]
24["Segment<br>[298, 351, 0]"]
23["Path<br>[298, 350, 0]"]
24["Segment<br>[298, 350, 0]"]
25[Solid2d]
end
1["Plane<br>[29, 48, 0]"]
@ -20,7 +20,7 @@ flowchart LR
11[Wall]
12[Wall]
13["Cap Start"]
14["Plane<br>[298, 351, 0]"]
14["Plane<br>[298, 350, 0]"]
15["SweepEdge Opposite"]
16["SweepEdge Adjacent"]
17["SweepEdge Opposite"]
@ -29,7 +29,7 @@ flowchart LR
20["SweepEdge Adjacent"]
21["SweepEdge Opposite"]
22["SweepEdge Adjacent"]
26["Sweep Extrusion<br>[357, 376, 0]"]
26["Sweep Extrusion<br>[356, 375, 0]"]
27[Wall]
28["Cap Start"]
29["Cap End"]

View File

@ -1,6 +1,7 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing sketch_on_face_circle_tagged.kcl
snapshot_kind: text
---
{
"Ok": {
@ -445,7 +446,7 @@ description: Result of parsing sketch_on_face_circle_tagged.kcl
},
{
"declaration": {
"end": 376,
"end": 375,
"id": {
"end": 260,
"name": "part002",
@ -486,24 +487,17 @@ description: Result of parsing sketch_on_face_circle_tagged.kcl
{
"arguments": [
{
"end": 336,
"properties": [
{
"end": 322,
"key": {
"end": 313,
"name": "center",
"start": 307,
"type": "Identifier"
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "center"
},
"start": 307,
"type": "ObjectProperty",
"value": {
"arg": {
"elements": [
{
"end": 318,
"end": 316,
"raw": "0",
"start": 317,
"start": 315,
"type": "Literal",
"type": "Literal",
"value": {
@ -512,9 +506,9 @@ description: Result of parsing sketch_on_face_circle_tagged.kcl
}
},
{
"end": 321,
"end": 319,
"raw": "0",
"start": 320,
"start": 318,
"type": "Literal",
"type": "Literal",
"value": {
@ -523,26 +517,22 @@ description: Result of parsing sketch_on_face_circle_tagged.kcl
}
}
],
"end": 322,
"start": 316,
"end": 320,
"start": 314,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
},
{
"end": 334,
"key": {
"end": 330,
"name": "radius",
"start": 324,
"type": "Identifier"
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "radius"
},
"start": 324,
"type": "ObjectProperty",
"value": {
"end": 334,
"arg": {
"end": 332,
"raw": "5",
"start": 333,
"start": 331,
"type": "Literal",
"type": "Literal",
"value": {
@ -550,25 +540,21 @@ description: Result of parsing sketch_on_face_circle_tagged.kcl
"suffix": "None"
}
}
}
],
"start": 305,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
{
"end": 339,
"start": 338,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "tag"
},
{
"end": 350,
"start": 341,
"arg": {
"end": 349,
"start": 340,
"type": "TagDeclarator",
"type": "TagDeclarator",
"value": "myCircle"
}
}
],
"callee": {
"end": 304,
@ -576,10 +562,11 @@ description: Result of parsing sketch_on_face_circle_tagged.kcl
"start": 298,
"type": "Identifier"
},
"end": 351,
"end": 350,
"start": 298,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
@ -590,9 +577,9 @@ description: Result of parsing sketch_on_face_circle_tagged.kcl
"name": "length"
},
"arg": {
"end": 375,
"end": 374,
"raw": "5",
"start": 374,
"start": 373,
"type": "Literal",
"type": "Literal",
"value": {
@ -603,19 +590,19 @@ description: Result of parsing sketch_on_face_circle_tagged.kcl
}
],
"callee": {
"end": 364,
"end": 363,
"name": "extrude",
"start": 357,
"start": 356,
"type": "Identifier"
},
"end": 376,
"start": 357,
"end": 375,
"start": 356,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
}
],
"end": 376,
"end": 375,
"start": 263,
"type": "PipeExpression",
"type": "PipeExpression"
@ -623,14 +610,14 @@ description: Result of parsing sketch_on_face_circle_tagged.kcl
"start": 253,
"type": "VariableDeclarator"
},
"end": 376,
"end": 375,
"kind": "const",
"start": 253,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 377,
"end": 376,
"nonCodeMeta": {
"nonCodeNodes": {
"1": [

View File

@ -12,5 +12,5 @@ part001 = cube([0, 0], 20)
|> extrude(length = 20)
part002 = startSketchOn(part001, "end")
|> circle({ center = [0, 0], radius = 5 }, %, $myCircle)
|> circle(center = [0, 0], radius = 5, tag = $myCircle)
|> extrude(length = 5)

View File

@ -91,16 +91,16 @@ snapshot_kind: text
"labeledArgs": {
"length": {
"sourceRange": [
373,
374,
375,
0
]
}
},
"name": "extrude",
"sourceRange": [
357,
376,
356,
375,
0
],
"type": "StdLibCall",

View File

@ -1,6 +1,7 @@
---
source: kcl/src/simulation_tests.rs
description: Program memory after executing sketch_on_face_circle_tagged.kcl
snapshot_kind: text
---
{
"environments": [
@ -367,7 +368,7 @@ description: Program memory after executing sketch_on_face_circle_tagged.kcl
"id": "[uuid]",
"sourceRange": [
298,
351,
350,
0
]
},
@ -382,8 +383,8 @@ description: Program memory after executing sketch_on_face_circle_tagged.kcl
],
"radius": 5.0,
"tag": {
"end": 350,
"start": 341,
"end": 349,
"start": 340,
"type": "TagDeclarator",
"value": "myCircle"
},
@ -398,12 +399,12 @@ description: Program memory after executing sketch_on_face_circle_tagged.kcl
"id": "[uuid]",
"sourceRange": [
298,
351,
350,
0
],
"tag": {
"end": 350,
"start": 341,
"end": 349,
"start": 340,
"type": "TagDeclarator",
"value": "myCircle"
},
@ -413,8 +414,8 @@ description: Program memory after executing sketch_on_face_circle_tagged.kcl
"__meta": [
{
"sourceRange": [
341,
350,
340,
349,
0
]
}
@ -645,12 +646,12 @@ description: Program memory after executing sketch_on_face_circle_tagged.kcl
"id": "[uuid]",
"sourceRange": [
298,
351,
350,
0
],
"tag": {
"end": 350,
"start": 341,
"end": 349,
"start": 340,
"type": "TagDeclarator",
"value": "myCircle"
},
@ -666,7 +667,7 @@ description: Program memory after executing sketch_on_face_circle_tagged.kcl
"id": "[uuid]",
"sourceRange": [
298,
351,
350,
0
]
},
@ -681,8 +682,8 @@ description: Program memory after executing sketch_on_face_circle_tagged.kcl
],
"radius": 5.0,
"tag": {
"end": 350,
"start": 341,
"end": 349,
"start": 340,
"type": "TagDeclarator",
"value": "myCircle"
},
@ -950,7 +951,7 @@ description: Program memory after executing sketch_on_face_circle_tagged.kcl
"id": "[uuid]",
"sourceRange": [
298,
351,
350,
0
]
}
@ -968,7 +969,7 @@ description: Program memory after executing sketch_on_face_circle_tagged.kcl
"id": "[uuid]",
"sourceRange": [
298,
351,
350,
0
]
},
@ -983,8 +984,8 @@ description: Program memory after executing sketch_on_face_circle_tagged.kcl
],
"radius": 5.0,
"tag": {
"end": 350,
"start": 341,
"end": 349,
"start": 340,
"type": "TagDeclarator",
"value": "myCircle"
},
@ -999,12 +1000,12 @@ description: Program memory after executing sketch_on_face_circle_tagged.kcl
"id": "[uuid]",
"sourceRange": [
298,
351,
350,
0
],
"tag": {
"end": 350,
"start": 341,
"end": 349,
"start": 340,
"type": "TagDeclarator",
"value": "myCircle"
},
@ -1014,8 +1015,8 @@ description: Program memory after executing sketch_on_face_circle_tagged.kcl
"__meta": [
{
"sourceRange": [
341,
350,
340,
349,
0
]
}
@ -1029,7 +1030,7 @@ description: Program memory after executing sketch_on_face_circle_tagged.kcl
{
"sourceRange": [
298,
351,
350,
0
]
}
@ -1045,7 +1046,7 @@ description: Program memory after executing sketch_on_face_circle_tagged.kcl
{
"sourceRange": [
298,
351,
350,
0
]
}

View File

@ -1,3 +1,3 @@
const cylinder = startSketchOn('XY')
|> circle({ center: [0, 0], radius: 22 }, %)
|> circle(center = [0, 0], radius = 22 )
|> extrude(length = 14)

View File

@ -61,8 +61,8 @@ const case = startSketchOn('XY')
fn m25Screw = (x, y, height) => {
const screw = startSketchOn("XY")
|> startProfileAt([0, 0], %)
|> circle({ center: [x, y], radius: 2.5 }, %)
|> hole(circle({ center: [x, y], radius: 1.25 }, %), %)
|> circle(center = [x, y], radius = 2.5 )
|> hole(circle(center = [x, y], radius = 1.25 ), %)
|> extrude(length = height)
return screw
}

View File

@ -80,13 +80,13 @@ const tabsR = startSketchOn(tabPlane)
|> line(end = [0, -tabLength / 3 * 2], tag = $edge12)
|> line(end = [-tabWidth, -tabLength / 3], tag = $edge13)
|> close(tag = $edge14)
|> hole(circle({
|> hole(circle(
center: [
width / 2 + thk + tabWidth / 2,
length / 2 + thk - (tabLength / (3 / 2))
],
radius: holeDiam / 2
}, %), %)
), %)
|> extrude(length = -tabThk)
|> fillet({
radius: holeDiam / 2,
@ -108,13 +108,13 @@ const tabsL = startSketchOn(tabPlane)
|> line(end = [0, -tabLength / 3 * 2], tag = $edge22)
|> line(end = [tabWidth, -tabLength / 3], tag = $edge23)
|> close(tag = $edge24)
|> hole(circle({
|> hole(circle(
center: [
-width / 2 - thk - (tabWidth / 2),
length / 2 + thk - (tabLength / (3 / 2))
],
radius: holeDiam / 2
}, %), %)
), %)
|> extrude(length = -tabThk)
|> fillet({
radius: holeDiam / 2,

View File

@ -80,13 +80,13 @@ const tabsR = startSketchOn(tabPlane)
|> line(end = [0, -tabLength / 3 * 2], tag = $edge12)
|> line(end = [-tabWidth, -tabLength / 3], tag = $edge13)
|> close(tag = $edge14)
|> hole(circle({
|> hole(circle(
center: [
width / 2 + thk + tabWidth / 2,
length / 2 + thk - (tabLength / (3 / 2))
],
radius: holeDiam / 2
}, %), %)
), %)
|> extrude(length = -tabThk)
|> fillet({
radius: holeDiam / 2,
@ -108,13 +108,13 @@ const tabsL = startSketchOn(tabPlane)
|> line(end = [0, -tabLength / 3 * 2], tag = $edge22)
|> line(end = [tabWidth, -tabLength / 3], tag = $edge23)
|> close(tag = $edge24)
|> hole(circle({
|> hole(circle(
center: [
-width / 2 - thk - (tabWidth / 2),
length / 2 + thk - (tabLength / (3 / 2))
],
radius: holeDiam / 2
}, %), %)
), %)
|> extrude(length = -tabThk)
|> fillet({
radius: holeDiam / 2,

View File

@ -1,4 +1,4 @@
const part001 = startSketchOn('XY')
|> circle({ center: [5, 5], radius: 10 }, %)
|> circle(center = [5, 5], radius = 10 )
|> extrude(length = 10)
|> helixRevolutions({revolutions = 16, angleStart = 0}, %)

View File

@ -1,4 +1,4 @@
const part001 = startSketchOn('XY')
|> circle({ center: [5, 5], radius: 10 }, %)
|> circle(center = [5, 5], radius = 10 )
|> extrude(length = -10)
|> helixRevolutions({revolutions = 16, angleStart = 0}, %)

View File

@ -1,4 +1,4 @@
const part001 = startSketchOn('XY')
|> circle({ center: [5, 5], radius: 10 }, %)
|> circle(center = [5, 5], radius = 10 )
|> extrude(length = 10)
|> helixRevolutions({revolutions = 16, angleStart = 0, length = 3}, %)

View File

@ -39,10 +39,10 @@ const shellExtrude = startSketchOn(s, "start")
|> extrude(length = -(height - t))
const peg = startSketchOn(s, "end")
|> circle({ center: [
|> circle(center = [
-(total_width / 2 - wSegments),
-(total_length / 2 - lSegments)
], radius: bumpDiam / 2 }, %)
], radius = bumpDiam / 2)
|> patternLinear2d({
axis: [1, 0],
instances: 6,

View File

@ -14,7 +14,7 @@ fn transform = (replicaId) => {
// Each layer is just a pretty thin cylinder with a fillet.
fn layer = () => {
return startSketchOn("XY") // or some other plane idk
|> circle({ center: [0, 0], radius: 1 }, %, $tag1)
|> circle(center = [0, 0], radius = 1 , tag = $tag1)
|> extrude(length = h)
// |> fillet({
// radius: h / 2.01,

View File

@ -30,22 +30,22 @@ fn caster = (originStart) => {
|> xLine(-3.543, %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> hole(circle({ center: [
|> hole(circle(center: [
(3.543 - 2.756) / 2,
(3.543 - 2.756) / 2
], radius: 8.8 / 2 / 25.4}, %), %)
|> hole(circle({ center: [
], radius: 8.8 / 2 / 25.4), %)
|> hole(circle(center: [
(3.543 - 2.756) / 2 + 2.756,
(3.543 - 2.756) / 2
], radius: 8.8 / 2 / 25.4 }, %), %)
|> hole(circle({ center: [
], radius: 8.8 / 2 / 25.4), %)
|> hole(circle(center: [
(3.543 - 2.756) / 2,
(3.543 - 2.756) / 2 + 2.756
], radius: 8.8 / 2 / 25.4 }, %), %)
|> hole(circle({ center: [
], radius: 8.8 / 2 / 25.4), %)
|> hole(circle(center: [
(3.543 - 2.756) / 2 + 2.756,
(3.543 - 2.756) / 2 + 2.756
], radius: 8.8 / 2 / 25.4 }, %), %)
], radius: 8.8 / 2 / 25.4), %)
|> extrude(length = -.25)
const sketch002c = startSketchOn(sketch001c, 'START')
@ -71,7 +71,7 @@ fn caster = (originStart) => {
}
}
const sketch003c = startSketchOn(plane002c)
|> circle({ center: [0, 1.2], radius 2.48 / 2 }, %)
|> circle(center: [0, 1.2], radius 2.48 / 2)
const examplec = extrude(sketch003c, length = -1 - (3 / 16))
return examplec
}

View File

@ -28,22 +28,22 @@ fn caster = (originStart) => {
|> xLine(-3.543, %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> hole(circle({ center: [
|> hole(circle(center: [
(3.543 - 2.756) / 2,
(3.543 - 2.756) / 2
], radius: 8.8 / 2 / 25.4 }, %), %)
|> hole(circle({ center: [
], radius: 8.8 / 2 / 25.4), %)
|> hole(circle(center: [
(3.543 - 2.756) / 2 + 2.756,
(3.543 - 2.756) / 2
], radius: 8.8 / 2 / 25.4 }, %), %)
|> hole(circle({ center: [
], radius: 8.8 / 2 / 25.4), %)
|> hole(circle(center: [
(3.543 - 2.756) / 2,
(3.543 - 2.756) / 2 + 2.756
], radius: 8.8 / 2 / 25.4 }, %), %)
|> hole(circle({ center: [
], radius: 8.8 / 2 / 25.4), %)
|> hole(circle(center: [
(3.543 - 2.756) / 2 + 2.756,
(3.543 - 2.756) / 2 + 2.756
], radius: 8.8 / 2 / 25.4 }, %), %)
], radius: 8.8 / 2 / 25.4), %)
|> extrude(length = -.25)
const sketch002c = startSketchOn(sketch001c, 'START')
@ -69,7 +69,7 @@ fn caster = (originStart) => {
}
}
const sketch003c = startSketchOn(plane002c)
|> circle({ center: [0, 1.2], radisu: 2.48 / 2 }, %)
|> circle(center = [0, 1.2], radius = 2.48 / 2)
const examplec = extrude(sketch003c, length = -1 - (3 / 16))
return examplec
}

View File

@ -12,5 +12,5 @@ const part001 = cube([0,0], 20)
|> extrude(length = 20)
const part002 = startSketchOn(part001, "end")
|> circle({ center: [0, 0], radius: 5 }, %, $myCircle)
|> circle(center = [0, 0], radius = 5 , tag = $myCircle)
|> extrude(length = 5)

View File

@ -62,10 +62,10 @@ fn tr = (i) => {
// Create the pegs on the top of the base
const totalBumps = (wbumps * lbumps)-1
const peg = startSketchOn(s, 'end')
|> circle({ center: [
|> circle(center: [
-(pitch*(wbumps-1)/2),
-(pitch*(lbumps-1)/2)
], radius: bumpDiam / 2 }, %)
], radius: bumpDiam / 2,)
|> patternLinear2d({
axis: [1, 0],
instances: wbumps,

View File

@ -11,7 +11,7 @@ const sketch002 = startSketchOn('XZ')
], %)
|> close()
const sketch001 = startSketchOn('XZ')
|> circle({
|> circle(
center = [318.33, 168.1],
radius = 182.8
}, %)
radius = 182.8,
)

View File

@ -270,8 +270,8 @@ async fn kcl_test_holes() {
|> line(end = [10, 0])
|> line(end = [0, -10])
|> close()
|> hole(circle({ center: [2, 2], radius: .5 }, %), %)
|> hole(circle({ center: [2, 8], radius: .5 }, %), %)
|> hole(circle(center = [2, 2], radius = .5 ), %)
|> hole(circle(center = [2, 8], radius = .5 ), %)
|> extrude(length = 2)
"#;
@ -323,10 +323,10 @@ holeRadius = 1
holeIndex = 6
part = roundedRectangle([0, 0], 20, 20, 4)
|> hole(circle({ center: [-holeIndex, holeIndex], radius: holeRadius }, %), %)
|> hole(circle({ center: [holeIndex, holeIndex], radius: holeRadius }, %), %)
|> hole(circle({ center: [-holeIndex, -holeIndex], radius: holeRadius }, %), %)
|> hole(circle({ center: [holeIndex, -holeIndex], radius: holeRadius }, %), %)
|> hole(circle(center = [-holeIndex, holeIndex], radius = holeRadius ), %)
|> hole(circle(center = [holeIndex, holeIndex], radius = holeRadius ), %)
|> hole(circle(center = [-holeIndex, -holeIndex], radius = holeRadius ), %)
|> hole(circle(center = [holeIndex, -holeIndex], radius = holeRadius ), %)
|> extrude(length = 2)
"#;
@ -336,7 +336,7 @@ part = roundedRectangle([0, 0], 20, 20, 4)
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_top_level_expression() {
let code = r#"startSketchOn('XY') |> circle({ center: [0,0], radius: 22 }, %) |> extrude(length = 14)"#;
let code = r#"startSketchOn('XY') |> circle(center = [0,0], radius = 22 ) |> extrude(length = 14)"#;
let result = execute_and_snapshot(code, UnitLength::Mm, None).await.unwrap();
assert_out("top_level_expression", &result);
@ -347,7 +347,7 @@ async fn kcl_test_patterns_linear_basic_with_math() {
let code = r#"num = 12
distance = 5
part = startSketchOn('XY')
|> circle({ center: [0,0], radius: 2 }, %)
|> circle(center = [0,0], radius = 2 )
|> patternLinear2d({axis: [0,1], instances: num, distance: distance - 1}, %)
|> extrude(length = 1)
"#;
@ -359,7 +359,7 @@ part = startSketchOn('XY')
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_patterns_linear_basic() {
let code = r#"part = startSketchOn('XY')
|> circle({ center: [0,0], radius: 2 }, %)
|> circle(center = [0,0], radius = 2 )
|> patternLinear2d({axis: [0,1], instances: 13, distance: 4}, %)
|> extrude(length = 1)
"#;
@ -387,7 +387,7 @@ async fn kcl_test_patterns_linear_basic_3d() {
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_patterns_linear_basic_negative_distance() {
let code = r#"part = startSketchOn('XY')
|> circle({ center: [0,0], radius: 2 }, %)
|> circle(center = [0,0], radius = 2 )
|> patternLinear2d({axis: [0,1], instances: 13, distance: -2}, %)
|> extrude(length = 1)
"#;
@ -399,7 +399,7 @@ async fn kcl_test_patterns_linear_basic_negative_distance() {
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_patterns_linear_basic_negative_axis() {
let code = r#"part = startSketchOn('XY')
|> circle({ center: [0,0], radius: 2 }, %)
|> circle(center = [0,0], radius = 2 )
|> patternLinear2d({axis: [0,-1], instances: 13, distance: 2}, %)
|> extrude(length = 1)
"#;
@ -411,7 +411,7 @@ async fn kcl_test_patterns_linear_basic_negative_axis() {
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_patterns_linear_basic_holes() {
let code = r#"circles = startSketchOn('XY')
|> circle({ center: [5, 5], radius: 1 }, %)
|> circle(center = [5, 5], radius = 1 )
|> patternLinear2d({axis: [1,1], instances: 13, distance: 3}, %)
rectangle = startSketchOn('XY')
@ -432,7 +432,7 @@ rectangle = startSketchOn('XY')
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_patterns_circular_basic_2d() {
let code = r#"part = startSketchOn('XY')
|> circle({ center: [0,0], radius: 2 }, %)
|> circle(center = [0,0], radius = 2 )
|> patternCircular2d({center: [20, 20], instances: 13, arcDegrees: 210, rotateDuplicates: true}, %)
|> extrude(length = 1)
"#;
@ -759,8 +759,8 @@ async fn kcl_test_stdlib_kcl_error_right_code_path() {
|> line(end = [10, 0])
|> line(end = [0, -10])
|> close()
|> hole(circle({ center: [2, 2], radius: .5 }), %)
|> hole(circle({ center: [2, 8], radius: .5 }, %), %)
|> hole(circle(center = [2, 2], radius = .5), %)
|> hole(circle(center = [2, 8], radius = .5), %)
|> extrude(length = 2)
"#;
@ -788,7 +788,7 @@ part001 = cube([0,0], 20)
|> extrude(length = 20)
part002 = startSketchOn(part001, "end")
|> circle({ center: [0, 0], radius: 5 }, %)
|> circle(center = [0, 0], radius = 5 )
|> extrude(length = 5)
"#;
@ -1062,7 +1062,7 @@ async fn kcl_test_revolve_on_face_circle_edge() {
|> extrude(length = 20)
sketch001 = startSketchOn(box, "END")
|> circle({ center: [10,10], radius: 4 }, %)
|> circle(center = [10,10], radius = 4 )
|> revolve({
angle: 90,
axis: getOppositeEdge(revolveAxis)
@ -1084,7 +1084,7 @@ async fn kcl_test_revolve_on_face_circle() {
|> extrude(length = 20)
sketch001 = startSketchOn(box, "END")
|> circle({ center: [10,10], radius: 4 }, %)
|> circle(center = [10,10], radius = 4 )
|> revolve({
angle: -90,
axis: 'y'
@ -1124,7 +1124,7 @@ sketch001 = startSketchOn(box, "end")
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_basic_revolve_circle() {
let code = r#"sketch001 = startSketchOn('XY')
|> circle({ center: [15, 0], radius: 5 }, %)
|> circle(center = [15, 0], radius = 5 )
|> revolve({
angle: 360,
axis: 'y'
@ -1248,10 +1248,10 @@ async fn kcl_test_member_expression_in_params() {
zAxis: { x: 0, y: 1, z: 0 }
}
})
|> circle({ center: [0, 0], radius: capDia / 2 }, %)
|> circle(center = [0, 0], radius = capDia / 2 )
|> extrude(length = capHeadLength)
screw = startSketchOn(screwHead, "start")
|> circle({ center: [0, 0], radius: dia / 2 }, %)
|> circle(center = [0, 0], radius = dia / 2 )
|> extrude(length = length)
return screw
}
@ -1320,7 +1320,7 @@ async fn kcl_test_error_empty_start_sketch_on_string() {
|> extrude(length = 100)
secondSketch = startSketchOn(part001, '')
|> circle({ center: [-20, 50], radius: 40 }, %)
|> circle(center = [-20, 50], radius = 40 )
|> extrude(length = 20)
"#;
@ -1350,7 +1350,7 @@ fn squareHole = (l, w) => {
}
extrusion = startSketchOn('XY')
|> circle({ center: [0, 0], radius: dia/2 }, %)
|> circle(center = [0, 0], radius = dia/2 )
|> hole(squareHole(length, width, height), %)
|> extrude(length = height)
"#;