Scoped tags (#2941)

* start of scoped tags

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* add the tags to the sketch group context

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* scoped tags

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* update docs

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix tests

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* scoped

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix;

Signed-off-by: Jess Frazelle <github@jessfraz.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2024-07-05 16:53:13 -07:00
committed by GitHub
parent 5701616f3e
commit a85c1a9375
65 changed files with 6343 additions and 110 deletions

View File

@ -121,6 +121,9 @@ const extrusion = extrude(5, sketch001)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -282,6 +285,9 @@ const extrusion = extrude(5, sketch001)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -125,6 +125,9 @@ const extrusion = extrude(5, sketch001)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -286,6 +289,9 @@ const extrusion = extrude(5, sketch001)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -126,6 +126,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -287,6 +290,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -476,6 +482,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -637,6 +646,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -125,6 +125,9 @@ const extrusion = extrude(10, sketch001)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -286,6 +289,9 @@ const extrusion = extrude(10, sketch001)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -475,6 +481,9 @@ const extrusion = extrude(10, sketch001)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -636,6 +645,9 @@ const extrusion = extrude(10, sketch001)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

File diff suppressed because one or more lines are too long

View File

@ -133,6 +133,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -294,6 +297,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -483,6 +489,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -644,6 +653,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -124,6 +124,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -285,6 +288,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -474,6 +480,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -635,6 +644,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -124,6 +124,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -285,6 +288,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -474,6 +480,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -635,6 +644,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -135,6 +135,9 @@ const exampleSketch = startSketchOn('XZ')
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -296,6 +299,9 @@ const exampleSketch = startSketchOn('XZ')
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -485,6 +491,9 @@ const exampleSketch = startSketchOn('XZ')
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -646,6 +655,9 @@ const exampleSketch = startSketchOn('XZ')
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -130,6 +130,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -291,6 +294,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -480,6 +486,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -641,6 +650,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -225,6 +225,9 @@ const mountingPlate = extrude(thickness, mountingPlateSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -532,6 +535,9 @@ const mountingPlate = extrude(thickness, mountingPlateSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -123,6 +123,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -410,6 +413,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -599,6 +605,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -760,6 +769,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -125,6 +125,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -286,6 +289,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -475,6 +481,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -636,6 +645,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -150,6 +150,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -311,6 +314,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
type: "sketchGroup",
// The paths in the sketch group.
@ -580,6 +586,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -225,6 +225,9 @@ const mountingPlate = extrude(thickness, mountingPlateSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -524,6 +527,9 @@ const mountingPlate = extrude(thickness, mountingPlateSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -215,6 +215,9 @@ const revolution = startSketchOn(box, "revolveAxis")
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -211,6 +211,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -211,6 +211,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -213,6 +213,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -213,6 +213,9 @@ const part001 = startSketchOn('XY')
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -512,6 +515,9 @@ const part001 = startSketchOn('XY')
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -136,6 +136,9 @@ const example = extrude(1, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -297,6 +300,9 @@ const example = extrude(1, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
type: "sketchGroup",
// The paths in the sketch group.
@ -479,6 +485,9 @@ const example = extrude(1, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -640,6 +649,9 @@ const example = extrude(1, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -821,6 +833,9 @@ const example = extrude(1, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -982,6 +997,9 @@ const example = extrude(1, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -116,6 +116,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -277,6 +280,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -116,6 +116,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -277,6 +280,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -129,6 +129,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -290,6 +293,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -479,6 +485,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -640,6 +649,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -116,6 +116,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -277,6 +280,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -466,6 +472,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -627,6 +636,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -134,6 +134,9 @@ const example = extrude(1, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -295,6 +298,9 @@ const example = extrude(1, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
type: "sketchGroup",
// The paths in the sketch group.

View File

@ -217,6 +217,9 @@ const example = extrude(-5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -127,6 +127,9 @@ const example = extrude(1, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -288,6 +291,9 @@ const example = extrude(1, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
type: "sketchGroup",
// The paths in the sketch group.

View File

@ -215,6 +215,9 @@ const example = extrude(1, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -217,6 +217,9 @@ let vase = layer()
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -117,6 +117,9 @@ const sketch001 = startSketchOn('XY')
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -278,6 +281,9 @@ const sketch001 = startSketchOn('XY')
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -112,6 +112,9 @@ const sketch001 = startSketchOn('XY')
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -273,6 +276,9 @@ const sketch001 = startSketchOn('XY')
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -111,6 +111,9 @@ const sketch001 = startSketchOn('XY')
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -272,6 +275,9 @@ const sketch001 = startSketchOn('XY')
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -247,6 +247,9 @@ uuid |
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -408,6 +411,9 @@ uuid |
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -673,6 +679,9 @@ uuid |
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -124,6 +124,9 @@ const example = extrude(4, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -285,6 +288,9 @@ const example = extrude(4, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -122,6 +122,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -283,6 +286,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -123,6 +123,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -284,6 +287,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -121,6 +121,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -282,6 +285,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -213,6 +213,9 @@ shell({ faces: ['end'], thickness: 0.25 }, firstSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -512,6 +515,9 @@ shell({ faces: ['end'], thickness: 0.25 }, firstSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -195,6 +195,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -442,6 +445,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -603,6 +609,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -142,6 +142,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -303,6 +306,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -264,6 +264,9 @@ const a1 = startSketchOn({
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -539,6 +542,9 @@ const a1 = startSketchOn({
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

File diff suppressed because it is too large Load Diff

View File

@ -125,6 +125,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -286,6 +289,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -475,6 +481,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -636,6 +645,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -116,6 +116,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -277,6 +280,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -466,6 +472,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -627,6 +636,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -74,10 +74,107 @@ You can nest expressions in parenthesis as well:
let myMathExpression = 3 + (1 * 2 / (3 - 7))
```
## Tag Declaration and Tag Identifiers
## Tags
The syntax for tags is now `$myTag` to declare a tag and `myTag` to then use it later.
Tags are used to give a name (tag) to a specific path.
Please if you find any issues using any of the above expressions or syntax
### Tag Declaration
The syntax for declaring a tag is `$myTag` you would use it in the following
way:
```
startSketchOn('XZ')
|> startProfileAt(origin, %)
|> angledLine([0, 191.26], %, $rectangleSegmentA001)
|> angledLine([
segAng(rectangleSegmentA001, %) - 90,
196.99
], %, $rectangleSegmentB001)
|> angledLine([
segAng(rectangleSegmentA001, %),
-segLen(rectangleSegmentA001, %)
], %, $rectangleSegmentC001)
|> lineTo([profileStartX(%), profileStartY(%)], %)
|> close(%)
```
### Tag Identifier
As per the example above you can use the tag identifier to get a reference to the
tagged object. The syntax for this is `myTag`.
In the example above we use the tag identifier to get the angle of the segment
`segAng(rectangleSegmentA001, %)`.
### Tag Scope
Tags are scoped globally if in the root context meaning in this example you can
use the tag `rectangleSegmentA001` in any function or expression in the file.
However if the code was written like this:
```
fn rect = (origin) => {
return startSketchOn('XZ')
|> startProfileAt(origin, %)
|> angledLine([0, 191.26], %, $rectangleSegmentA001)
|> angledLine([
segAng(rectangleSegmentA001, %) - 90,
196.99
], %, $rectangleSegmentB001)
|> angledLine([
segAng(rectangleSegmentA001, %),
-segLen(rectangleSegmentA001, %)
], %, $rectangleSegmentC001)
|> lineTo([profileStartX(%), profileStartY(%)], %)
|> close(%)
}
rect([0, 0])
rect([20, 0])
```
Those tags would only be available in the `rect` function and not globally.
However you likely want to use those tags somewhere outside the `rect` function.
Tags are accessible through the sketch group they are declared in.
For example the following code works.
```
fn rect = (origin) => {
return startSketchOn('XZ')
|> startProfileAt(origin, %)
|> angledLine([0, 191.26], %, $rectangleSegmentA001)
|> angledLine([
segAng(rectangleSegmentA001, %) - 90,
196.99
], %, $rectangleSegmentB001)
|> angledLine([
segAng(rectangleSegmentA001, %),
-segLen(rectangleSegmentA001, %)
], %, $rectangleSegmentC001)
|> lineTo([profileStartX(%), profileStartY(%)], %)
|> close(%)
}
rect([0, 0])
const myRect = rect([20, 0])
myRect
|> extrude(10, %)
|> fillet({radius: 0.5, tags: [myRect.tags.rectangleSegmentA001]}, %)
```
See how we use the tag `rectangleSegmentA001` in the `fillet` function outside
the `rect` function. This is because the `rect` function is returning the
sketch group that contains the tags.
---
If you find any issues using any of the above expressions or syntax,
please file an issue with the `ast` label on the [modeling-app
repo](https://github.com/KittyCAD/modeling-app/issues/new).

View File

@ -119,6 +119,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -280,6 +283,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -469,6 +475,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -630,6 +639,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -119,6 +119,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -280,6 +283,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -469,6 +475,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -630,6 +639,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -117,6 +117,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -278,6 +281,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -467,6 +473,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -628,6 +637,9 @@ const example = extrude(10, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -115,6 +115,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -276,6 +279,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -465,6 +471,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
@ -626,6 +635,9 @@ const example = extrude(5, exampleSketch)
},
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{

View File

@ -53,9 +53,8 @@ import {
sketchOnExtrudedFace,
startSketchOnDefault,
} from 'lang/modifyAst'
import { Program, VariableDeclaration, parse, recast } from 'lang/wasm'
import { Program, parse, recast } from 'lang/wasm'
import {
getNodeFromPath,
getNodePathFromSourceRange,
hasExtrudableGeometry,
isSingleCursorInPipe,

View File

@ -185,6 +185,17 @@ const sk2 = startSketchOn('XY')
on: expect.any(Object),
start: expect.any(Object),
type: 'SketchGroup',
tags: {
p: {
__meta: [
{
sourceRange: [114, 116],
},
],
type: 'TagIdentifier',
value: 'p',
},
},
value: [
{
type: 'ToPoint',
@ -265,6 +276,17 @@ const sk2 = startSketchOn('XY')
on: expect.any(Object),
start: expect.any(Object),
type: 'SketchGroup',
tags: {
o: {
__meta: [
{
sourceRange: [417, 419],
},
],
type: 'TagIdentifier',
value: 'o',
},
},
value: [
{
type: 'ToPoint',

View File

@ -155,6 +155,17 @@ const newVar = myVar + 1`
sourceRange: [39, 63],
},
},
tags: {
myPath: {
__meta: [
{
sourceRange: [109, 117],
},
],
type: 'TagIdentifier',
value: 'myPath',
},
},
value: [
{
type: 'ToPoint',

View File

@ -1385,7 +1385,7 @@ dependencies = [
[[package]]
name = "kcl-lib"
version = "0.1.70"
version = "0.1.71"
dependencies = [
"anyhow",
"approx",

View File

@ -1,7 +1,7 @@
[package]
name = "kcl-lib"
description = "KittyCAD Language implementation and tools"
version = "0.1.70"
version = "0.1.71"
edition = "2021"
license = "MIT"
repository = "https://github.com/KittyCAD/modeling-app"

View File

@ -1238,8 +1238,7 @@ impl CallExpression {
}
FunctionKind::UserDefined => {
let func = memory.get(&fn_name, self.into())?;
let (result, global_memory_items) =
func.call_fn(fn_args, memory.clone(), ctx.clone()).await.map_err(|e| {
let result = func.call_fn(fn_args, memory.clone(), ctx.clone()).await.map_err(|e| {
// Add the call expression to the source ranges.
e.add_source_ranges(vec![self.into()])
})?;
@ -1252,14 +1251,6 @@ impl CallExpression {
})?;
let result = result.get_value()?;
// Add the global memory items to the memory.
for (key, item) in global_memory_items {
// We don't care about errors here because any collisions
// would happened in the function call itself and already
// errored out.
memory.add(&key, item, self.into()).unwrap_or_default();
}
Ok(result)
}
}
@ -1787,6 +1778,17 @@ impl From<&TagDeclarator> for MemoryItem {
}
}
impl From<&TagDeclarator> for TagIdentifier {
fn from(tag: &TagDeclarator) -> Self {
TagIdentifier {
value: tag.name.clone(),
meta: vec![Metadata {
source_range: tag.into(),
}],
}
}
}
impl From<&TagDeclarator> for CompletionItem {
fn from(tag: &TagDeclarator) -> Self {
CompletionItem {

View File

@ -537,17 +537,14 @@ impl std::hash::Hash for TagIdentifier {
}
}
pub type MemoryFunction = fn(
pub type MemoryFunction =
fn(
s: Vec<MemoryItem>,
memory: ProgramMemory,
expression: Box<FunctionExpression>,
metadata: Vec<Metadata>,
ctx: ExecutorContext,
) -> std::pin::Pin<
Box<
dyn std::future::Future<Output = Result<(Option<ProgramReturn>, HashMap<String, MemoryItem>), KclError>> + Send,
>,
>;
) -> std::pin::Pin<Box<dyn std::future::Future<Output = Result<Option<ProgramReturn>, KclError>> + Send>>;
fn force_memory_function<
F: Fn(
@ -556,12 +553,7 @@ fn force_memory_function<
Box<FunctionExpression>,
Vec<Metadata>,
ExecutorContext,
) -> std::pin::Pin<
Box<
dyn std::future::Future<Output = Result<(Option<ProgramReturn>, HashMap<String, MemoryItem>), KclError>>
+ Send,
>,
>,
) -> std::pin::Pin<Box<dyn std::future::Future<Output = Result<Option<ProgramReturn>, KclError>> + Send>>,
>(
f: F,
) -> F {
@ -691,12 +683,16 @@ impl MemoryItem {
match self {
MemoryItem::TagIdentifier(t) => Ok(*t.clone()),
MemoryItem::UserVal(u) => {
if let Some(identifier) = self.get_json_opt::<TagIdentifier>()? {
Ok(identifier)
} else {
let name: String = self.get_json()?;
Ok(TagIdentifier {
value: name,
meta: u.meta.clone(),
})
}
}
_ => Err(KclError::Semantic(KclErrorDetails {
message: format!("Not a tag identifier: {:?}", self),
source_ranges: self.clone().into(),
@ -752,7 +748,7 @@ impl MemoryItem {
args: Vec<MemoryItem>,
memory: ProgramMemory,
ctx: ExecutorContext,
) -> Result<(Option<ProgramReturn>, HashMap<String, MemoryItem>), KclError> {
) -> Result<Option<ProgramReturn>, KclError> {
let MemoryItem::Function { func, expression, meta } = &self else {
return Err(KclError::Semantic(KclErrorDetails {
message: "not a in memory function".to_string(),
@ -782,6 +778,9 @@ pub struct SketchGroup {
pub on: SketchSurface,
/// The starting path.
pub start: BasePath,
/// Tag identifiers that have been declared in this sketch group.
#[serde(default, skip_serializing_if = "HashMap::is_empty")]
pub tags: HashMap<String, TagIdentifier>,
/// Metadata.
#[serde(rename = "__meta")]
pub meta: Vec<Metadata>,
@ -1572,16 +1571,7 @@ impl ExecutorContext {
}
FunctionKind::UserDefined => {
if let Some(func) = memory.clone().root.get(&fn_name) {
let (result, global_memory_items) =
func.call_fn(args.clone(), memory.clone(), self.clone()).await?;
// Add the global memory items to the memory.
for (key, item) in global_memory_items {
// We don't care about errors here because any collisions
// would happened in the function call itself and already
// errored out.
memory.add(&key, item, call_expr.into()).unwrap_or_default();
}
let result = func.call_fn(args.clone(), memory.clone(), self.clone()).await?;
memory.return_ = result;
} else {
@ -1706,7 +1696,7 @@ impl ExecutorContext {
.inner_execute(&function_expression.body, &mut fn_memory, BodyType::Block)
.await?;
Ok((result.return_, fn_memory.get_tags()))
Ok(result.return_)
})
},
);

View File

@ -1,5 +1,3 @@
use std::collections::HashMap;
use schemars::JsonSchema;
use crate::{
@ -18,10 +16,7 @@ pub struct FunctionParam<'a> {
}
impl<'a> FunctionParam<'a> {
pub async fn call(
&self,
args: Vec<MemoryItem>,
) -> Result<(Option<ProgramReturn>, HashMap<String, MemoryItem>), KclError> {
pub async fn call(&self, args: Vec<MemoryItem>) -> Result<Option<ProgramReturn>, KclError> {
(self.inner)(
args,
self.memory.clone(),

View File

@ -1542,6 +1542,7 @@ fn fn_call(i: TokenSlice) -> PResult<CallExpression> {
// Replace the literal with the tag.
args[i] = Value::Identifier(Box::new(tag));
}
Value::MemberExpression(_) => {}
e => {
return Err(ErrMode::Cut(
KclError::Syntax(KclErrorDetails {

View File

@ -207,7 +207,7 @@ async fn make_transform<'a>(
meta: vec![source_range.into()],
});
let transform_fn_args = vec![repetition_num];
let transform_fn_return = transform_function.call(transform_fn_args).await?.0;
let transform_fn_return = transform_function.call(transform_fn_args).await?;
// Unpack the returned transform object.
let source_ranges = vec![source_range];

View File

@ -1,5 +1,7 @@
//! Functions related to sketching.
use std::collections::HashMap;
use anyhow::Result;
use derive_docs::stdlib;
use kittycad::types::{Angle, ModelingCmd, Point3D};
@ -127,6 +129,11 @@ async fn inner_line_to(
)
.await?;
let mut new_sketch_group = sketch_group.clone();
if let Some(tag) = &tag {
new_sketch_group.tags.insert(tag.name.to_string(), tag.into());
}
let current_path = Path::ToPoint {
base: BasePath {
from: from.into(),
@ -139,7 +146,6 @@ async fn inner_line_to(
},
};
let mut new_sketch_group = sketch_group.clone();
new_sketch_group.value.push(current_path);
Ok(new_sketch_group)
@ -291,6 +297,11 @@ async fn inner_line(
)
.await?;
let mut new_sketch_group = sketch_group.clone();
if let Some(tag) = &tag {
new_sketch_group.tags.insert(tag.name.to_string(), tag.into());
}
let current_path = Path::ToPoint {
base: BasePath {
from: from.into(),
@ -303,7 +314,6 @@ async fn inner_line(
},
};
let mut new_sketch_group = sketch_group.clone();
new_sketch_group.value.push(current_path);
Ok(new_sketch_group)
@ -455,18 +465,6 @@ async fn inner_angled_line(
let id = uuid::Uuid::new_v4();
let current_path = Path::ToPoint {
base: BasePath {
from: from.into(),
to,
tag,
geo_meta: GeoMeta {
id,
metadata: args.source_range.into(),
},
},
};
args.batch_modeling_cmd(
id,
ModelingCmd::ExtendPath {
@ -484,6 +482,22 @@ async fn inner_angled_line(
.await?;
let mut new_sketch_group = sketch_group.clone();
if let Some(tag) = &tag {
new_sketch_group.tags.insert(tag.name.to_string(), tag.into());
}
let current_path = Path::ToPoint {
base: BasePath {
from: from.into(),
to,
tag,
geo_meta: GeoMeta {
id,
metadata: args.source_range.into(),
},
},
};
new_sketch_group.value.push(current_path);
Ok(new_sketch_group)
}
@ -1206,7 +1220,7 @@ pub(crate) async fn inner_start_profile_at(
let current_path = BasePath {
from: to,
to,
tag,
tag: tag.clone(),
geo_meta: GeoMeta {
id,
metadata: args.source_range.into(),
@ -1219,6 +1233,11 @@ pub(crate) async fn inner_start_profile_at(
value: vec![],
start: current_path,
meta: vec![args.source_range.into()],
tags: if let Some(tag) = &tag {
HashMap::from([(tag.name.to_string(), tag.into())])
} else {
Default::default()
},
};
Ok(Box::new(sketch_group))
}
@ -1353,6 +1372,9 @@ pub(crate) async fn inner_close(
}
let mut new_sketch_group = sketch_group.clone();
if let Some(ref tag) = tag {
new_sketch_group.tags.insert(tag.name.to_string(), tag.into());
}
new_sketch_group.value.push(Path::ToPoint {
base: BasePath {
from: from.into(),
@ -1461,6 +1483,11 @@ pub(crate) async fn inner_arc(
)
.await?;
let mut new_sketch_group = sketch_group.clone();
if let Some(tag) = &tag {
new_sketch_group.tags.insert(tag.name.to_string(), tag.into());
}
let current_path = Path::ToPoint {
base: BasePath {
from: from.into(),
@ -1473,7 +1500,6 @@ pub(crate) async fn inner_arc(
},
};
let mut new_sketch_group = sketch_group.clone();
new_sketch_group.value.push(current_path);
Ok(new_sketch_group)
@ -1567,6 +1593,11 @@ async fn inner_tangential_arc(
let to = [from.x + to[0], from.y + to[1]];
let mut new_sketch_group = sketch_group.clone();
if let Some(tag) = &tag {
new_sketch_group.tags.insert(tag.name.to_string(), tag.into());
}
let current_path = Path::TangentialArc {
base: BasePath {
from: from.into(),
@ -1579,7 +1610,6 @@ async fn inner_tangential_arc(
},
};
let mut new_sketch_group = sketch_group.clone();
new_sketch_group.value.push(current_path);
Ok(new_sketch_group)
@ -1671,6 +1701,11 @@ async fn inner_tangential_arc_to(
let id = uuid::Uuid::new_v4();
args.batch_modeling_cmd(id, tan_arc_to(&sketch_group, &delta)).await?;
let mut new_sketch_group = sketch_group.clone();
if let Some(tag) = &tag {
new_sketch_group.tags.insert(tag.name.to_string(), tag.into());
}
let current_path = Path::TangentialArcTo {
base: BasePath {
from: from.into(),
@ -1685,7 +1720,6 @@ async fn inner_tangential_arc_to(
ccw: result.ccw > 0,
};
let mut new_sketch_group = sketch_group.clone();
new_sketch_group.value.push(current_path);
Ok(new_sketch_group)
@ -1772,6 +1806,11 @@ async fn inner_bezier_curve(
)
.await?;
let mut new_sketch_group = sketch_group.clone();
if let Some(tag) = &tag {
new_sketch_group.tags.insert(tag.name.to_string(), tag.into());
}
let current_path = Path::ToPoint {
base: BasePath {
from: from.into(),
@ -1784,7 +1823,6 @@ async fn inner_bezier_curve(
},
};
let mut new_sketch_group = sketch_group.clone();
new_sketch_group.value.push(current_path);
Ok(new_sketch_group)

View File

@ -1,6 +1,7 @@
// A mounting bracket for the Focusrite Scarlett Solo audio interface
// This is a bracket that holds an audio device underneath a desk or shelf. The audio device has dimensions of 144mm wide, 80mm length and 45mm depth with fillets of 6mm. This mounting bracket is designed to be 3D printed with PLA material
// define constants in mm
const radius = 6.0
const width = 144.0
@ -16,10 +17,10 @@ const tabThk = 4
fn rectShape = (pos, w, l) => {
const rr = startSketchOn('xy')
|> startProfileAt([pos[0] - (w / 2), pos[1] - (l / 2)], %)
|> lineTo([pos[0] + w / 2, pos[1] - (l / 2)], %, "edge01")
|> lineTo([pos[0] + w / 2, pos[1] + l / 2], %, "edge02")
|> lineTo([pos[0] - (w / 2), pos[1] + l / 2], %, "edge03")
|> close(%, "edge04")
|> lineTo([pos[0] + w / 2, pos[1] - (l / 2)], %, $edge01)
|> lineTo([pos[0] + w / 2, pos[1] + l / 2], %, $edge02)
|> lineTo([pos[0] - (w / 2), pos[1] + l / 2], %, $edge03)
|> close(%, $edge04)
return rr
}
@ -37,27 +38,28 @@ const bracketPlane = {
fn bracketSketch = (w, d, t) => {
const s = startSketchOn(bracketPlane)
|> 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")
|> 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)
return s
}
// build the body of the bracket
const bracketBody = bracketSketch(width, depth, thk)
const bs = bracketSketch(width, depth, thk)
const bracketBody = bs
|> extrude(length + 2 * thk, %)
|> fillet({
radius: radius,
tags: [
getNextAdjacentEdge("edge7", %),
getNextAdjacentEdge("edge2", %),
getNextAdjacentEdge("edge3", %),
getNextAdjacentEdge("edge6", %)
getNextAdjacentEdge(bs.tags.edge7, %),
getNextAdjacentEdge(bs.tags.edge2, %),
getNextAdjacentEdge(bs.tags.edge3, %),
getNextAdjacentEdge(bs.tags.edge6, %)
]
}, %)
@ -74,10 +76,10 @@ const tabPlane = {
// build the tabs of the mounting bracket (right side)
const tabsR = startSketchOn(tabPlane)
|> startProfileAt([width / 2 + thk, length / 2 + thk], %)
|> line([tabWidth, -tabLength / 3], %, "edge11")
|> line([0, -tabLength / 3 * 2], %, "edge12")
|> line([-tabWidth, -tabLength / 3], %, "edge13")
|> close(%, "edge14")
|> line([tabWidth, -tabLength / 3], %, $edge11)
|> line([0, -tabLength / 3 * 2], %, $edge12)
|> line([-tabWidth, -tabLength / 3], %, $edge13)
|> close(%, $edge14)
|> hole(circle([
width / 2 + thk + tabWidth / 2,
length / 2 + thk - (tabLength / (3 / 2))
@ -86,8 +88,8 @@ const tabsR = startSketchOn(tabPlane)
|> fillet({
radius: holeDiam / 2,
tags: [
getNextAdjacentEdge("edge12", %),
getNextAdjacentEdge("edge13", %)
getNextAdjacentEdge(edge12, %),
getNextAdjacentEdge(edge13, %)
]
}, %)
|> patternLinear3d({
@ -99,10 +101,10 @@ const tabsR = startSketchOn(tabPlane)
// build the tabs of the mounting bracket (left side)
const tabsL = startSketchOn(tabPlane)
|> startProfileAt([-width / 2 - thk, length / 2 + thk], %)
|> line([-tabWidth, -tabLength / 3], %, "edge21")
|> line([0, -tabLength / 3 * 2], %, "edge22")
|> line([tabWidth, -tabLength / 3], %, "edge23")
|> close(%, "edge24")
|> line([-tabWidth, -tabLength / 3], %, $edge21)
|> line([0, -tabLength / 3 * 2], %, $edge22)
|> line([tabWidth, -tabLength / 3], %, $edge23)
|> close(%, $edge24)
|> hole(circle([
-width / 2 - thk - (tabWidth / 2),
length / 2 + thk - (tabLength / (3 / 2))
@ -111,8 +113,8 @@ const tabsL = startSketchOn(tabPlane)
|> fillet({
radius: holeDiam / 2,
tags: [
getNextAdjacentEdge("edge21", %),
getNextAdjacentEdge("edge22", %)
getNextAdjacentEdge(edge21, %),
getNextAdjacentEdge(edge22, %)
]
}, %)
|> patternLinear3d({

View File

@ -0,0 +1,18 @@
fn rect = (origin) => {
return startSketchOn('XZ')
|> startProfileAt(origin, %)
|> angledLine([0, 191.26], %, $rectangleSegmentA001)
|> angledLine([
segAng(rectangleSegmentA001, %) - 90,
196.99
], %, $rectangleSegmentB001)
|> angledLine([
segAng(rectangleSegmentA001, %),
-segLen(rectangleSegmentA001, %)
], %, $rectangleSegmentC001)
|> lineTo([profileStartX(%), profileStartY(%)], %)
|> close(%)
}
rect([0, 0])
rect([20, 0])

View File

@ -2473,6 +2473,13 @@ async fn serial_test_pattern_vase() {
twenty_twenty::assert_image("tests/executor/outputs/pattern_vase.png", &result, 0.999);
}
#[tokio::test(flavor = "multi_thread")]
async fn serial_test_scoped_tags() {
let code = include_str!("inputs/scoped-tags.kcl");
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
twenty_twenty::assert_image("tests/executor/outputs/scoped_tags.png", &result, 0.999);
}
#[tokio::test(flavor = "multi_thread")]
async fn serial_test_order_sketch_extrude_in_order() {
let code = include_str!("inputs/order-sketch-extrude-in-order.kcl");

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB