Fix some uses of close and lineTo
Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
@ -199,7 +199,7 @@ test.describe('Testing segment overlays', () => {
|
||||
})
|
||||
}
|
||||
test.setTimeout(120000)
|
||||
test('for segments [line, angledLine, lineTo, xLineTo]', async ({
|
||||
test('for segments [line, angledLine, xLineTo]', async ({
|
||||
page,
|
||||
editor,
|
||||
homePage,
|
||||
@ -1111,7 +1111,7 @@ test.describe('Testing segment overlays', () => {
|
||||
)
|
||||
await page.mouse.move(hoverPos.x, hoverPos.y)
|
||||
|
||||
const codeToBeDeleted = 'lineTo(endAbsolute = [33, 11.5 + 0])'
|
||||
const codeToBeDeleted = 'line(endAbsolute = [33, 11.5 + 0])'
|
||||
await editor.expectEditor.toContain(codeToBeDeleted, {
|
||||
shouldNormalise: true,
|
||||
})
|
||||
|
@ -815,7 +815,7 @@ test.describe('Testing selections', () => {
|
||||
await checkCodeAtHoverPosition(
|
||||
'adjacentChamfer1',
|
||||
adjacentChamfer1,
|
||||
`lineTo([profileStartX(%),profileStartY(%)],%,$seg02)chamfer({length=30,tags=[seg01,getNextAdjacentEdge(yo),getNextAdjacentEdge(seg02),getOppositeEdge(seg01)]},%)`,
|
||||
`line(endAbsolute=[profileStartX(%),profileStartY(%)],tag=$seg02)chamfer({length=30,tags=[seg01,getNextAdjacentEdge(yo),getNextAdjacentEdge(seg02),getOppositeEdge(seg01)]},%)`,
|
||||
'}, %)'
|
||||
)
|
||||
|
||||
|
@ -119,7 +119,7 @@ const Part001 = startSketchOn('XY')
|
||||
|> angledLineToX({ angle: 120, to: pipeSmallDia }, %)
|
||||
|> line([0, pipeLength], %)
|
||||
|> angledLineToX({ angle: 60, to: pipeLargeDia }, %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
|> revolve({ axis: 'y' }, %)
|
||||
"
|
||||
);
|
||||
@ -155,7 +155,7 @@ const part001 = startSketchOn('XY')
|
||||
|> angledLineToX({ angle: 120, to: pipeSmallDia }, %)
|
||||
|> line([0, pipeLength], %)
|
||||
|> angledLineToX({ angle: 60, to: pipeLargeDia }, %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
|> revolve({ axis: 'y' }, %)
|
||||
"
|
||||
);
|
||||
|
@ -107,7 +107,7 @@ const bracket = startSketchOn('XY')
|
||||
|> line([0, -thickness], %)
|
||||
|> line([shelfMountL - thickness, 0], %, $innerEdge)
|
||||
|> line([0, -wallMountL + thickness], %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
|> extrude(width, %)
|
||||
|> fillet({
|
||||
radius: filletR,
|
||||
@ -154,7 +154,7 @@ const bracket = startSketchOn('XY')
|
||||
|> line([0, -thickness], %)
|
||||
|> line([shelfMountL - thickness, 0], %, $innerEdge)
|
||||
|> line([0, -wallMountL + thickness], %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
|> extrude(width, %)
|
||||
|> fillet({
|
||||
radius: filletR,
|
||||
|
@ -3385,7 +3385,7 @@ mySk1 = startSketchAt([0, 0])"#;
|
||||
#[test]
|
||||
fn pipes_on_pipes_minimal() {
|
||||
let test_program = r#"startSketchAt([0, 0])
|
||||
|> lineTo([0, -0], %) // MoveRelative
|
||||
|> line(endAbsolute = [0, -0]) // MoveRelative
|
||||
|
||||
"#;
|
||||
let tokens = crate::parsing::token::lex(test_program, ModuleId::default()).unwrap();
|
||||
@ -3730,7 +3730,7 @@ firstExtrude = startSketchOn('XY')
|
||||
|> line([0, 8], %)
|
||||
|> line([20, 0], %)
|
||||
|> line([0, -8], %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
|> extrude(length=2)
|
||||
|
||||
secondExtrude = startSketchOn('XY')
|
||||
@ -4207,7 +4207,7 @@ let other_thing = 2 * cos(3)"#;
|
||||
|> line([0, l], %)
|
||||
|> line([w, 0], %)
|
||||
|> line([0, -l], %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
|> extrude(length=h)
|
||||
|
||||
return myBox
|
||||
@ -4574,7 +4574,7 @@ mod snapshot_tests {
|
||||
snapshot_test!(y, "sg = startSketchAt(pos)");
|
||||
snapshot_test!(z, "sg = startSketchAt(pos) |> line([0, -scale], %)");
|
||||
snapshot_test!(aa, r#"sg = -scale"#);
|
||||
snapshot_test!(ab, "lineTo({ to: [0, -1] })");
|
||||
snapshot_test!(ab, "line(endAbsolute = [0, -1])");
|
||||
snapshot_test!(ac, "myArray = [0..10]");
|
||||
snapshot_test!(
|
||||
ad,
|
||||
@ -4594,20 +4594,16 @@ mod snapshot_tests {
|
||||
snapshot_test!(
|
||||
af,
|
||||
r#"mySketch = startSketchAt([0,0])
|
||||
|> lineTo([0, 1], %, $myPath)
|
||||
|> lineTo([1, 1], %)
|
||||
|> lineTo([1, 0], %, $rightPath)
|
||||
|> close(%)"#
|
||||
|> line(endAbsolute = [0, 1], tag = $myPath)
|
||||
|> line(endAbsolute = [1, 1])
|
||||
|> line(endAbsolute = [1, 0], tag = $rightPath)
|
||||
|> close()"#
|
||||
);
|
||||
snapshot_test!(ag, "mySketch = startSketchAt([0,0]) |> lineTo([1, 1], %) |> close(%)");
|
||||
snapshot_test!(ag, "mySketch = startSketchAt([0,0]) |> line(endAbsolute = [1, 1]) |> close()");
|
||||
snapshot_test!(ah, "myBox = startSketchAt(p)");
|
||||
snapshot_test!(ai, r#"myBox = f(1) |> g(2, %)"#);
|
||||
snapshot_test!(aj, r#"myBox = startSketchAt(p) |> line([0, l], %)"#);
|
||||
snapshot_test!(ak, "lineTo({ to: [0, 1] })");
|
||||
snapshot_test!(al, "lineTo({ to: [0, 1], from: [3, 3] })");
|
||||
snapshot_test!(am, "lineTo({to:[0, 1]})");
|
||||
snapshot_test!(an, "lineTo({ to: [0, 1], from: [3, 3]})");
|
||||
snapshot_test!(ao, "lineTo({ to: [0, 1],from: [3, 3] })");
|
||||
snapshot_test!(aj, r#"myBox = startSketchAt(p) |> line(end = [0, l])"#);
|
||||
snapshot_test!(ak, "line(endAbsolute = [0, 1])");
|
||||
snapshot_test!(ap, "mySketch = startSketchAt([0,0])");
|
||||
snapshot_test!(aq, "log(5, \"hello\", aIdentifier)");
|
||||
snapshot_test!(ar, r#"5 + "a""#);
|
||||
|
@ -1,120 +0,0 @@
|
||||
---
|
||||
source: kcl/src/parsing/parser.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"body": [
|
||||
{
|
||||
"end": 36,
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"end": 35,
|
||||
"properties": [
|
||||
{
|
||||
"end": 19,
|
||||
"key": {
|
||||
"end": 11,
|
||||
"name": "to",
|
||||
"start": 9,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 9,
|
||||
"type": "ObjectProperty",
|
||||
"value": {
|
||||
"elements": [
|
||||
{
|
||||
"end": 15,
|
||||
"raw": "0",
|
||||
"start": 14,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 18,
|
||||
"raw": "1",
|
||||
"start": 17,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
],
|
||||
"end": 19,
|
||||
"start": 13,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 33,
|
||||
"key": {
|
||||
"end": 25,
|
||||
"name": "from",
|
||||
"start": 21,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 21,
|
||||
"type": "ObjectProperty",
|
||||
"value": {
|
||||
"elements": [
|
||||
{
|
||||
"end": 29,
|
||||
"raw": "3",
|
||||
"start": 28,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 32,
|
||||
"raw": "3",
|
||||
"start": 31,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
],
|
||||
"end": 33,
|
||||
"start": 27,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
}
|
||||
}
|
||||
],
|
||||
"start": 7,
|
||||
"type": "ObjectExpression",
|
||||
"type": "ObjectExpression"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 6,
|
||||
"name": "lineTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 36,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
}
|
||||
],
|
||||
"end": 36,
|
||||
"start": 0
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
---
|
||||
source: kcl/src/parsing/parser.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"body": [
|
||||
{
|
||||
"end": 19,
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"end": 18,
|
||||
"properties": [
|
||||
{
|
||||
"end": 17,
|
||||
"key": {
|
||||
"end": 10,
|
||||
"name": "to",
|
||||
"start": 8,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 8,
|
||||
"type": "ObjectProperty",
|
||||
"value": {
|
||||
"elements": [
|
||||
{
|
||||
"end": 13,
|
||||
"raw": "0",
|
||||
"start": 12,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 16,
|
||||
"raw": "1",
|
||||
"start": 15,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
],
|
||||
"end": 17,
|
||||
"start": 11,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
}
|
||||
}
|
||||
],
|
||||
"start": 7,
|
||||
"type": "ObjectExpression",
|
||||
"type": "ObjectExpression"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 6,
|
||||
"name": "lineTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 19,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
}
|
||||
],
|
||||
"end": 19,
|
||||
"start": 0
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
---
|
||||
source: kcl/src/parsing/parser.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"body": [
|
||||
{
|
||||
"end": 35,
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"end": 34,
|
||||
"properties": [
|
||||
{
|
||||
"end": 19,
|
||||
"key": {
|
||||
"end": 11,
|
||||
"name": "to",
|
||||
"start": 9,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 9,
|
||||
"type": "ObjectProperty",
|
||||
"value": {
|
||||
"elements": [
|
||||
{
|
||||
"end": 15,
|
||||
"raw": "0",
|
||||
"start": 14,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 18,
|
||||
"raw": "1",
|
||||
"start": 17,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
],
|
||||
"end": 19,
|
||||
"start": 13,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 33,
|
||||
"key": {
|
||||
"end": 25,
|
||||
"name": "from",
|
||||
"start": 21,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 21,
|
||||
"type": "ObjectProperty",
|
||||
"value": {
|
||||
"elements": [
|
||||
{
|
||||
"end": 29,
|
||||
"raw": "3",
|
||||
"start": 28,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 32,
|
||||
"raw": "3",
|
||||
"start": 31,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
],
|
||||
"end": 33,
|
||||
"start": 27,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
}
|
||||
}
|
||||
],
|
||||
"start": 7,
|
||||
"type": "ObjectExpression",
|
||||
"type": "ObjectExpression"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 6,
|
||||
"name": "lineTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 35,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
}
|
||||
],
|
||||
"end": 35,
|
||||
"start": 0
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
---
|
||||
source: kcl/src/parsing/parser.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"body": [
|
||||
{
|
||||
"end": 35,
|
||||
"expression": {
|
||||
"arguments": [
|
||||
{
|
||||
"end": 34,
|
||||
"properties": [
|
||||
{
|
||||
"end": 19,
|
||||
"key": {
|
||||
"end": 11,
|
||||
"name": "to",
|
||||
"start": 9,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 9,
|
||||
"type": "ObjectProperty",
|
||||
"value": {
|
||||
"elements": [
|
||||
{
|
||||
"end": 15,
|
||||
"raw": "0",
|
||||
"start": 14,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 18,
|
||||
"raw": "1",
|
||||
"start": 17,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
],
|
||||
"end": 19,
|
||||
"start": 13,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 32,
|
||||
"key": {
|
||||
"end": 24,
|
||||
"name": "from",
|
||||
"start": 20,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 20,
|
||||
"type": "ObjectProperty",
|
||||
"value": {
|
||||
"elements": [
|
||||
{
|
||||
"end": 28,
|
||||
"raw": "3",
|
||||
"start": 27,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 31,
|
||||
"raw": "3",
|
||||
"start": 30,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 3.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
],
|
||||
"end": 32,
|
||||
"start": 26,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
}
|
||||
}
|
||||
],
|
||||
"start": 7,
|
||||
"type": "ObjectExpression",
|
||||
"type": "ObjectExpression"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 6,
|
||||
"name": "lineTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 35,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
}
|
||||
],
|
||||
"end": 35,
|
||||
"start": 0
|
||||
}
|
@ -876,17 +876,17 @@ fn rect(x, y, w, h) {
|
||||
|> xLine(w, %)
|
||||
|> yLine(h, %)
|
||||
|> xLine(-w, %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
|> extrude(d, %)
|
||||
}
|
||||
|
||||
fn quad(x1, y1, x2, y2, x3, y3, x4, y4) {
|
||||
startSketchOn('XY')
|
||||
|> startProfileAt([x1, y1], %)
|
||||
|> lineTo([x2, y2], %)
|
||||
|> lineTo([x3, y3], %)
|
||||
|> lineTo([x4, y4], %)
|
||||
|> close(%)
|
||||
|> line(endAbsolute = [x2, y2])
|
||||
|> line(endAbsolute = [x3, y3])
|
||||
|> line(endAbsolute = [x4, y4])
|
||||
|> close()
|
||||
|> extrude(d, %)
|
||||
}
|
||||
|
||||
@ -950,7 +950,7 @@ fn o(c_x, c_y) {
|
||||
angle_start = 225 - a,
|
||||
angle_end = 45 + a
|
||||
}, %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
|> extrude(d, %)
|
||||
|
||||
startSketchOn('XY')
|
||||
@ -966,7 +966,7 @@ fn o(c_x, c_y) {
|
||||
angle_start = 45 - a,
|
||||
angle_end = 225 + a - 360
|
||||
}, %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
|> extrude(d, %)
|
||||
}
|
||||
|
||||
@ -1006,7 +1006,7 @@ insideRevolve = startSketchOn('XZ')
|
||||
|> line([overHangLength - thickness, 0], %)
|
||||
|> line([0, -thickness], %)
|
||||
|> line([-overHangLength, 0], %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
|> revolve({ axis: 'y' }, %)
|
||||
|
||||
// Sketch and revolve one of the balls and duplicate it using a circular pattern. (This is currently a workaround, we have a bug with rotating on a sketch that touches the rotation axis)
|
||||
@ -1021,7 +1021,7 @@ sphere = startSketchOn('XZ')
|
||||
angle_end = -180,
|
||||
radius = sphereDia / 2 - 0.05
|
||||
}, %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
|> revolve({ axis: 'x' }, %)
|
||||
|> patternCircular3d({
|
||||
axis = [0, 0, 1],
|
||||
@ -1045,7 +1045,7 @@ outsideRevolve = startSketchOn('XZ')
|
||||
|> line([-overHangLength, 0], %)
|
||||
|> line([0, thickness], %)
|
||||
|> line([overHangLength - thickness, 0], %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
|> revolve({ axis: 'y' }, %)"#;
|
||||
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
||||
|
||||
@ -1073,7 +1073,7 @@ insideRevolve = startSketchOn('XZ')
|
||||
|> line([overHangLength - thickness, 0], %)
|
||||
|> line([0, -thickness], %)
|
||||
|> line([-overHangLength, 0], %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
|> revolve({ axis = 'y' }, %)
|
||||
|
||||
// Sketch and revolve one of the balls and duplicate it using a circular pattern. (This is currently a workaround, we have a bug with rotating on a sketch that touches the rotation axis)
|
||||
@ -1088,7 +1088,7 @@ sphere = startSketchOn('XZ')
|
||||
angle_end = -180,
|
||||
radius = sphereDia / 2 - 0.05
|
||||
}, %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
|> revolve({ axis = 'x' }, %)
|
||||
|> patternCircular3d({
|
||||
axis = [0, 0, 1],
|
||||
@ -1112,7 +1112,7 @@ outsideRevolve = startSketchOn('XZ')
|
||||
|> line([-overHangLength, 0], %)
|
||||
|> line([0, thickness], %)
|
||||
|> line([overHangLength - thickness, 0], %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
|> revolve({ axis = 'y' }, %)
|
||||
"#
|
||||
);
|
||||
@ -1239,7 +1239,7 @@ part001 = startSketchOn('XY')
|
||||
|> line([20, 0], %)
|
||||
|> line([0, 20], %)
|
||||
|> line([-20, 0], %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
"#;
|
||||
|
||||
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
||||
@ -1254,7 +1254,7 @@ part001 = startSketchOn('XY')
|
||||
|> line([20, 0], %)
|
||||
|> line([0, 20], %)
|
||||
|> line([-20, 0], %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
"#
|
||||
);
|
||||
}
|
||||
@ -1270,7 +1270,7 @@ part001 = startSketchOn('XY')
|
||||
|> line([20, 0], %)
|
||||
|> line([0, 20], %)
|
||||
|> line([-20, 0], %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
"#;
|
||||
|
||||
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
||||
@ -1285,7 +1285,7 @@ part001 = startSketchOn('XY')
|
||||
|> line([20, 0], %)
|
||||
|> line([0, 20], %)
|
||||
|> line([-20, 0], %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
"#
|
||||
);
|
||||
}
|
||||
@ -1300,7 +1300,7 @@ part001 = startSketchOn('XY')
|
||||
|> line([20, 0], %)
|
||||
|> line([0, 20], %)
|
||||
|> line([-20, 0], %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
"#;
|
||||
|
||||
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
||||
@ -1316,7 +1316,7 @@ part001 = startSketchOn('XY')
|
||||
|> line([20, 0], %)
|
||||
|> line([0, 20], %)
|
||||
|> line([-20, 0], %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
"#
|
||||
);
|
||||
}
|
||||
@ -1335,10 +1335,10 @@ hole_diam = 5
|
||||
fn rectShape = (pos, w, l) => {
|
||||
rr = startSketchOn('xy')
|
||||
|> startProfileAt([pos[0] - (w / 2), pos[1] - (l / 2)], %)
|
||||
|> lineTo([pos[0] + w / 2, pos[1] - (l / 2)], %,$edge1)
|
||||
|> lineTo([pos[0] + w / 2, pos[1] + l / 2], %, $edge2)
|
||||
|> lineTo([pos[0] - (w / 2), pos[1] + l / 2], %, $edge3)
|
||||
|> close(%, $edge4)
|
||||
|> line(endAbsolute = [pos[0] + w / 2, pos[1] - (l / 2)], tag = $edge1)
|
||||
|> line(endAbsolute = [pos[0] + w / 2, pos[1] + l / 2], tag = $edge2)
|
||||
|> line(endAbsolute = [pos[0] - (w / 2), pos[1] + l / 2], tag = $edge3)
|
||||
|> close($edge4)
|
||||
return rr
|
||||
}
|
||||
// build the body of the focusrite scarlett solo gen 4
|
||||
@ -1365,14 +1365,14 @@ fn bracketSketch = (w, d, t) => {
|
||||
}
|
||||
})
|
||||
|> startProfileAt([-w / 2 - t, d + t], %)
|
||||
|> lineTo([-w / 2 - t, -t], %, $edge1)
|
||||
|> lineTo([w / 2 + t, -t], %, $edge2)
|
||||
|> lineTo([w / 2 + t, d + t], %, $edge3)
|
||||
|> lineTo([w / 2, d + t], %, $edge4)
|
||||
|> lineTo([w / 2, 0], %, $edge5)
|
||||
|> lineTo([-w / 2, 0], %, $edge6)
|
||||
|> lineTo([-w / 2, d + t], %, $edge7)
|
||||
|> close(%, $edge8)
|
||||
|> line(endAbsolute = [-w / 2 - t, -t], tag = $edge1)
|
||||
|> line(endAbsolute = [w / 2 + t, -t], tag = $edge2)
|
||||
|> line(endAbsolute = [w / 2 + t, d + t], tag = $edge3)
|
||||
|> line(endAbsolute = [w / 2, d + t], tag = $edge4)
|
||||
|> line(endAbsolute = [w / 2, 0], tag = $edge5)
|
||||
|> line(endAbsolute = [-w / 2, 0], tag = $edge6)
|
||||
|> line(endAbsolute = [-w / 2, d + t], tag = $edge7)
|
||||
|> close($edge8)
|
||||
return s
|
||||
}
|
||||
// build the body of the bracket
|
||||
@ -1400,7 +1400,7 @@ tabs_r = startSketchOn({
|
||||
|> line([10, -5], %)
|
||||
|> line([0, -10], %)
|
||||
|> line([-10, -5], %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
|> hole(circle({
|
||||
center = [
|
||||
width / 2 + thk + hole_diam,
|
||||
@ -1427,7 +1427,7 @@ tabs_l = startSketchOn({
|
||||
|> line([-10, -5], %)
|
||||
|> line([0, -10], %)
|
||||
|> line([10, -5], %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
|> hole(circle({
|
||||
center = [
|
||||
-width / 2 - thk - hole_diam,
|
||||
@ -1460,10 +1460,10 @@ hole_diam = 5
|
||||
fn rectShape(pos, w, l) {
|
||||
rr = startSketchOn('xy')
|
||||
|> startProfileAt([pos[0] - (w / 2), pos[1] - (l / 2)], %)
|
||||
|> lineTo([pos[0] + w / 2, pos[1] - (l / 2)], %, $edge1)
|
||||
|> lineTo([pos[0] + w / 2, pos[1] + l / 2], %, $edge2)
|
||||
|> lineTo([pos[0] - (w / 2), pos[1] + l / 2], %, $edge3)
|
||||
|> close(%, $edge4)
|
||||
|> line(endAbsolute = [pos[0] + w / 2, pos[1] - (l / 2)], tag = $edge1)
|
||||
|> line(endAbsolute = [pos[0] + w / 2, pos[1] + l / 2], tag = $edge2)
|
||||
|> line(endAbsolute = [pos[0] - (w / 2), pos[1] + l / 2], tag = $edge3)
|
||||
|> close($edge4)
|
||||
return rr
|
||||
}
|
||||
// build the body of the focusrite scarlett solo gen 4
|
||||
@ -1490,14 +1490,14 @@ fn bracketSketch(w, d, t) {
|
||||
}
|
||||
})
|
||||
|> startProfileAt([-w / 2 - t, d + t], %)
|
||||
|> lineTo([-w / 2 - t, -t], %, $edge1)
|
||||
|> lineTo([w / 2 + t, -t], %, $edge2)
|
||||
|> lineTo([w / 2 + t, d + t], %, $edge3)
|
||||
|> lineTo([w / 2, d + t], %, $edge4)
|
||||
|> lineTo([w / 2, 0], %, $edge5)
|
||||
|> lineTo([-w / 2, 0], %, $edge6)
|
||||
|> lineTo([-w / 2, d + t], %, $edge7)
|
||||
|> close(%, $edge8)
|
||||
|> line(endAbsolute = [-w / 2 - t, -t], tag = $edge1)
|
||||
|> line(endAbsolute = [w / 2 + t, -t], tag = $edge2)
|
||||
|> line(endAbsolute = [w / 2 + t, d + t], tag = $edge3)
|
||||
|> line(endAbsolute = [w / 2, d + t], tag = $edge4)
|
||||
|> line(endAbsolute = [w / 2, 0], tag = $edge5)
|
||||
|> line(endAbsolute = [-w / 2, 0], tag = $edge6)
|
||||
|> line(endAbsolute = [-w / 2, d + t], tag = $edge7)
|
||||
|> close($edge8)
|
||||
return s
|
||||
}
|
||||
// build the body of the bracket
|
||||
@ -1525,7 +1525,7 @@ tabs_r = startSketchOn({
|
||||
|> line([10, -5], %)
|
||||
|> line([0, -10], %)
|
||||
|> line([-10, -5], %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
|> hole(circle({
|
||||
center = [
|
||||
width / 2 + thk + hole_diam,
|
||||
@ -1552,7 +1552,7 @@ tabs_l = startSketchOn({
|
||||
|> line([-10, -5], %)
|
||||
|> line([0, -10], %)
|
||||
|> line([10, -5], %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
|> hole(circle({
|
||||
center = [
|
||||
-width / 2 - thk - hole_diam,
|
||||
@ -1578,7 +1578,7 @@ tabs_l = startSketchOn({
|
||||
|> line([0, scale], %)
|
||||
|> line([scale, 0], %)
|
||||
|> line([0, -scale], %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
|> extrude(scale, %)
|
||||
}"#;
|
||||
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
||||
@ -1592,7 +1592,7 @@ tabs_l = startSketchOn({
|
||||
|> line([0, scale], %)
|
||||
|> line([scale, 0], %)
|
||||
|> line([0, -scale], %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
|> extrude(scale, %)
|
||||
}
|
||||
"#
|
||||
@ -1609,7 +1609,7 @@ tabs_l = startSketchOn({
|
||||
|> line([0, scale], %)
|
||||
|> line([scale, 0], %) as bar
|
||||
|> line([0 as baz, -scale] as qux, %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
|> extrude(scale, %)
|
||||
}
|
||||
|
||||
@ -1825,10 +1825,10 @@ mySk1 = startSketchAt([0, 0])
|
||||
let some_program_string = r#"// comment at start
|
||||
mySk1 = startSketchOn('XY')
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> lineTo([1, 1], %)
|
||||
|> line(endAbsolute = [1, 1])
|
||||
// comment here
|
||||
|> lineTo([0, 1], %, $myTag)
|
||||
|> lineTo([1, 1], %)
|
||||
|> line(endAbsolute = [0, 1], tag = $myTag)
|
||||
|> line(endAbsolute = [1, 1])
|
||||
/* and
|
||||
here
|
||||
*/
|
||||
@ -1846,10 +1846,10 @@ mySk1 = startSketchOn('XY')
|
||||
r#"// comment at start
|
||||
mySk1 = startSketchOn('XY')
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> lineTo([1, 1], %)
|
||||
|> line(endAbsolute = [1, 1])
|
||||
// comment here
|
||||
|> lineTo([0, 1], %, $myTag)
|
||||
|> lineTo([1, 1], %)
|
||||
|> line(endAbsolute = [0, 1], tag = $myTag)
|
||||
|> line(endAbsolute = [1, 1])
|
||||
/* and
|
||||
here */
|
||||
// a comment between pipe expression statements
|
||||
@ -2088,7 +2088,7 @@ firstExtrude = startSketchOn('XY')
|
||||
|> line([0, l], %)
|
||||
|> line([w, 0], %)
|
||||
|> line([0, -l], %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
|> extrude(h, %)
|
||||
"#;
|
||||
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
||||
@ -2105,7 +2105,7 @@ firstExtrude = startSketchOn('XY')
|
||||
|> line([0, l], %)
|
||||
|> line([w, 0], %)
|
||||
|> line([0, -l], %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
|> extrude(h, %)
|
||||
"#
|
||||
);
|
||||
@ -2125,7 +2125,7 @@ firstExtrude = startSketchOn('XY')
|
||||
|> line([0, l], %)
|
||||
|> line([w, 0], %)
|
||||
|> line([0, -l], %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
|> extrude(h, %)
|
||||
"#;
|
||||
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
||||
@ -2145,7 +2145,7 @@ firstExtrude = startSketchOn('XY')
|
||||
|> line([0, l], %)
|
||||
|> line([w, 0], %)
|
||||
|> line([0, -l], %)
|
||||
|> close(%)
|
||||
|> close()
|
||||
|> extrude(h, %)
|
||||
"#
|
||||
);
|
||||
|
Reference in New Issue
Block a user