Files
modeling-app/rust/kcl-lib/tests/sketch-on-chamfer-two-times/program_memory.snap

2325 lines
55 KiB
Plaintext
Raw Normal View History

---
source: kcl-lib/src/simulation_tests.rs
description: Variables in memory after executing sketch-on-chamfer-two-times.kcl
---
{
"extrude001": {
"type": "Solid",
"value": {
"type": "Solid",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": [
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": {
"commentStart": 150,
"end": 171,
"start": 150,
"type": "TagDeclarator",
"value": "rectangleSegmentA001"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": {
"commentStart": 255,
"end": 261,
"start": 255,
"type": "TagDeclarator",
"value": "seg01"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": {
"commentStart": 425,
"end": 431,
"start": 425,
"type": "TagDeclarator",
"value": "seg02"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": {
"commentStart": 582,
"end": 588,
"start": 582,
"type": "TagDeclarator",
"value": "seg04"
},
"type": "chamfer"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": {
"commentStart": 655,
"end": 661,
"start": 655,
"type": "TagDeclarator",
"value": "seg03"
},
"type": "chamfer"
}
],
"sketch": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
75.8,
317.2
],
"tag": {
"commentStart": 150,
"end": 171,
"start": 150,
"type": "TagDeclarator",
"value": "rectangleSegmentA001"
},
"to": [
344.23,
317.2
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
344.23,
317.2
],
"tag": {
"commentStart": 255,
"end": 261,
"start": 255,
"type": "TagDeclarator",
"value": "seg01"
},
"to": [
344.23,
99.94
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
344.23,
99.94
],
"tag": null,
"to": [
75.8,
99.94
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
75.8,
99.94
],
"tag": {
"commentStart": 425,
"end": 431,
"start": 425,
"type": "TagDeclarator",
"value": "seg02"
},
"to": [
75.8,
317.2
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
75.8,
317.2
],
"tag": null,
"to": [
75.8,
317.2
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
}
],
"on": {
"type": "plane",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": "XZ",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"units": {
"type": "Mm"
}
},
"xAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0,
"units": {
"type": "Mm"
}
},
"yAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0,
"units": {
"type": "Mm"
}
},
"zAxis": {
"x": 0.0,
"y": -1.0,
"z": 0.0,
"units": {
"type": "Mm"
}
}
},
"start": {
"from": [
75.8,
317.2
],
"to": [
75.8,
317.2
],
"units": {
"type": "Mm"
},
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
}
},
"tags": {
"rectangleSegmentA001": {
"type": "TagIdentifier",
"value": "rectangleSegmentA001"
},
"seg01": {
"type": "TagIdentifier",
"value": "seg01"
},
"seg02": {
"type": "TagIdentifier",
"value": "seg02"
},
"seg03": {
"type": "TagIdentifier",
"value": "seg03"
},
"seg04": {
"type": "TagIdentifier",
"value": "seg04"
}
},
"artifactId": "[uuid]",
"originalId": "[uuid]",
"units": {
"type": "Mm"
}
},
"height": 100.0,
"startCapId": "[uuid]",
"endCapId": "[uuid]",
"edgeCuts": [
{
"type": "fillet",
"id": "[uuid]",
"radius": {
"n": 20.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"edgeId": "[uuid]",
"tag": null
},
{
"type": "chamfer",
"id": "[uuid]",
"length": {
"n": 50.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"edgeId": "[uuid]",
"tag": {
"commentStart": 582,
"end": 588,
"start": 582,
"type": "TagDeclarator",
"value": "seg04"
}
},
{
"type": "chamfer",
"id": "[uuid]",
"length": {
"n": 50.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"edgeId": "[uuid]",
"tag": {
"commentStart": 655,
"end": 661,
"start": 655,
"type": "TagDeclarator",
"value": "seg03"
}
}
],
"units": {
"type": "Mm"
}
}
},
"extrude002": {
"type": "Solid",
"value": {
"type": "Solid",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": [
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": {
"commentStart": 1273,
"end": 1294,
"start": 1273,
"type": "TagDeclarator",
"value": "rectangleSegmentA002"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": {
"commentStart": 1378,
"end": 1399,
"start": 1378,
"type": "TagDeclarator",
"value": "rectangleSegmentB001"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": {
"commentStart": 1501,
"end": 1522,
"start": 1501,
"type": "TagDeclarator",
"value": "rectangleSegmentC001"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
}
],
"sketch": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
159.25,
278.35
],
"tag": {
"commentStart": 1273,
"end": 1294,
"start": 1273,
"type": "TagDeclarator",
"value": "rectangleSegmentA002"
},
"to": [
200.07,
278.35
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
200.07,
278.35
],
"tag": {
"commentStart": 1378,
"end": 1399,
"start": 1378,
"type": "TagDeclarator",
"value": "rectangleSegmentB001"
},
"to": [
200.07,
146.08
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
200.07,
146.08
],
"tag": {
"commentStart": 1501,
"end": 1522,
"start": 1501,
"type": "TagDeclarator",
"value": "rectangleSegmentC001"
},
"to": [
159.25,
146.08
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
159.25,
146.08
],
"tag": null,
"to": [
159.25,
278.35
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
159.25,
278.35
],
"tag": null,
"to": [
159.25,
278.35
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
}
],
"on": {
"type": "face",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": "seg03",
"xAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0,
"units": {
"type": "Mm"
}
},
"yAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0,
"units": {
"type": "Mm"
}
},
"zAxis": {
"x": 0.0,
"y": -1.0,
"z": 0.0,
"units": {
"type": "Mm"
}
},
"solid": {
"type": "Solid",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": [
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": {
"commentStart": 150,
"end": 171,
"start": 150,
"type": "TagDeclarator",
"value": "rectangleSegmentA001"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": {
"commentStart": 255,
"end": 261,
"start": 255,
"type": "TagDeclarator",
"value": "seg01"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": {
"commentStart": 425,
"end": 431,
"start": 425,
"type": "TagDeclarator",
"value": "seg02"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": {
"commentStart": 582,
"end": 588,
"start": 582,
"type": "TagDeclarator",
"value": "seg04"
},
"type": "chamfer"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": {
"commentStart": 655,
"end": 661,
"start": 655,
"type": "TagDeclarator",
"value": "seg03"
},
"type": "chamfer"
}
],
"sketch": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
75.8,
317.2
],
"tag": {
"commentStart": 150,
"end": 171,
"start": 150,
"type": "TagDeclarator",
"value": "rectangleSegmentA001"
},
"to": [
344.23,
317.2
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
344.23,
317.2
],
"tag": {
"commentStart": 255,
"end": 261,
"start": 255,
"type": "TagDeclarator",
"value": "seg01"
},
"to": [
344.23,
99.94
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
344.23,
99.94
],
"tag": null,
"to": [
75.8,
99.94
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
75.8,
99.94
],
"tag": {
"commentStart": 425,
"end": 431,
"start": 425,
"type": "TagDeclarator",
"value": "seg02"
},
"to": [
75.8,
317.2
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
75.8,
317.2
],
"tag": null,
"to": [
75.8,
317.2
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
}
],
"on": {
"type": "plane",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": "XZ",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"units": {
"type": "Mm"
}
},
"xAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0,
"units": {
"type": "Mm"
}
},
"yAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0,
"units": {
"type": "Mm"
}
},
"zAxis": {
"x": 0.0,
"y": -1.0,
"z": 0.0,
"units": {
"type": "Mm"
}
}
},
"start": {
"from": [
75.8,
317.2
],
"to": [
75.8,
317.2
],
"units": {
"type": "Mm"
},
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
}
},
"tags": {
"rectangleSegmentA001": {
"type": "TagIdentifier",
"value": "rectangleSegmentA001"
},
"seg01": {
"type": "TagIdentifier",
"value": "seg01"
},
"seg02": {
"type": "TagIdentifier",
"value": "seg02"
},
"seg03": {
"type": "TagIdentifier",
"value": "seg03"
},
"seg04": {
"type": "TagIdentifier",
"value": "seg04"
}
},
"artifactId": "[uuid]",
KCL: Patterns of patterns can use the original sketch/solid as target (#5284) Right now, if you model something like this box with a button: <img width="413" alt="Screenshot 2025-02-06 at 3 08 03 PM" src="https://github.com/user-attachments/assets/04818a70-7cf3-4ee3-b8c5-df5959ac10db" /> Let's say you want to pattern the button, and repeat it a second time. If you try, you'll actually pattern the entire model (box + button). <img width="486" alt="Screenshot 2025-02-06 at 3 08 52 PM" src="https://github.com/user-attachments/assets/09fc28d9-5d80-4ab3-b4dc-b8de2945fcba" /> Why? Because right now, when you sketch on a face (like the button was), both the box and the button share the same ID. All extrusions from a solid will share the same ID, because they all refer to the same composite solid. This is helpful in some ways -- arguably the solid _is_ just one big complex shape now -- but it's not helpful in other ways. What if I want to only pattern the button? Luckily there's an original ID for the button part, which is still stored. So we just need a way to tell the pattern stdlib functions whether to use the target's main ID or its original ID. This PR adds a new optional bool, `useOriginal`, to patterns. It's false by default, to keep backwards-compatibility (make sure that old KCL code doesn't change). This PR is based on https://github.com/KittyCAD/modeling-app/pull/3914. It's based on work Serena and I are doing to fix a bug (engine does not allow patterning a 3D solid which was sketched on a face of another solid). @gserena01 our test program is now: ``` w = 400 case = startSketchOn('XY') |> startProfileAt([-w, -w], %) |> line(endAbsolute = [-w, w]) |> line(endAbsolute = [w, -w]) |> line(endAbsolute = [-w, -w]) |> close() |> extrude(length = 200) bump1 = startSketchOn(case, 'end') |> circle({ center = [-50, -50], radius = 40 }, %) |> extrude(length = 20) // We pass in "bump1" here since we want to pattern just this object on the face. useOriginal = true target = bump1 transform = { axis = [1, 0, 0], instances = 3, distance = -100 } patternLinear3d(transform, target, useOriginal) ``` If you change the `useOriginal = true` to `false` you can see the difference.
2025-02-06 17:46:47 -06:00
"originalId": "[uuid]",
"units": {
"type": "Mm"
}
},
"height": 100.0,
"startCapId": "[uuid]",
"endCapId": "[uuid]",
"edgeCuts": [
{
"type": "fillet",
"id": "[uuid]",
"radius": {
"n": 20.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"edgeId": "[uuid]",
"tag": null
},
{
"type": "chamfer",
"id": "[uuid]",
"length": {
"n": 50.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"edgeId": "[uuid]",
"tag": {
"commentStart": 582,
"end": 588,
"start": 582,
"type": "TagDeclarator",
"value": "seg04"
}
},
{
"type": "chamfer",
"id": "[uuid]",
"length": {
"n": 50.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"edgeId": "[uuid]",
"tag": {
"commentStart": 655,
"end": 661,
"start": 655,
"type": "TagDeclarator",
"value": "seg03"
}
}
],
"units": {
"type": "Mm"
}
},
"units": {
"type": "Mm"
}
},
"start": {
"from": [
159.25,
278.35
],
"to": [
159.25,
278.35
],
"units": {
"type": "Mm"
},
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
}
},
"tags": {
"rectangleSegmentA002": {
"type": "TagIdentifier",
"value": "rectangleSegmentA002"
},
"rectangleSegmentB001": {
"type": "TagIdentifier",
"value": "rectangleSegmentB001"
},
"rectangleSegmentC001": {
"type": "TagIdentifier",
"value": "rectangleSegmentC001"
}
},
"artifactId": "[uuid]",
"originalId": "[uuid]",
"units": {
"type": "Mm"
}
},
"height": 50.0,
"startCapId": null,
"endCapId": "[uuid]",
"units": {
"type": "Mm"
}
}
},
"rectangleSegmentA001": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "rectangleSegmentA001"
},
"rectangleSegmentA002": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "rectangleSegmentA002"
},
"rectangleSegmentA003": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "rectangleSegmentA003"
},
"rectangleSegmentB001": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "rectangleSegmentB001"
},
"rectangleSegmentB002": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "rectangleSegmentB002"
},
"rectangleSegmentC001": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "rectangleSegmentC001"
},
"rectangleSegmentC002": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "rectangleSegmentC002"
},
"seg01": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "seg01"
},
"seg02": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "seg02"
},
"seg03": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "seg03"
},
"seg04": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "seg04"
},
"sketch001": {
"type": "Sketch",
"value": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
75.8,
317.2
],
"tag": {
"commentStart": 150,
"end": 171,
"start": 150,
"type": "TagDeclarator",
"value": "rectangleSegmentA001"
},
"to": [
344.23,
317.2
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
344.23,
317.2
],
"tag": {
"commentStart": 255,
"end": 261,
"start": 255,
"type": "TagDeclarator",
"value": "seg01"
},
"to": [
344.23,
99.94
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
344.23,
99.94
],
"tag": null,
"to": [
75.8,
99.94
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
75.8,
99.94
],
"tag": {
"commentStart": 425,
"end": 431,
"start": 425,
"type": "TagDeclarator",
"value": "seg02"
},
"to": [
75.8,
317.2
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
75.8,
317.2
],
"tag": null,
"to": [
75.8,
317.2
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
}
],
"on": {
"type": "plane",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": "XZ",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"units": {
"type": "Mm"
}
},
"xAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0,
"units": {
"type": "Mm"
}
},
"yAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0,
"units": {
"type": "Mm"
}
},
"zAxis": {
"x": 0.0,
"y": -1.0,
"z": 0.0,
"units": {
"type": "Mm"
}
}
},
"start": {
"from": [
75.8,
317.2
],
"to": [
75.8,
317.2
],
"units": {
"type": "Mm"
},
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
}
},
"tags": {
"rectangleSegmentA001": {
"type": "TagIdentifier",
"value": "rectangleSegmentA001"
},
"seg01": {
"type": "TagIdentifier",
"value": "seg01"
},
"seg02": {
"type": "TagIdentifier",
"value": "seg02"
},
"seg03": {
"type": "TagIdentifier",
"value": "seg03"
},
"seg04": {
"type": "TagIdentifier",
"value": "seg04"
}
},
"artifactId": "[uuid]",
"originalId": "[uuid]",
"units": {
"type": "Mm"
}
}
},
"sketch002": {
"type": "Sketch",
"value": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
159.25,
278.35
],
"tag": {
"commentStart": 1273,
"end": 1294,
"start": 1273,
"type": "TagDeclarator",
"value": "rectangleSegmentA002"
},
"to": [
200.07,
278.35
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
200.07,
278.35
],
"tag": {
"commentStart": 1378,
"end": 1399,
"start": 1378,
"type": "TagDeclarator",
"value": "rectangleSegmentB001"
},
"to": [
200.07,
146.08
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
200.07,
146.08
],
"tag": {
"commentStart": 1501,
"end": 1522,
"start": 1501,
"type": "TagDeclarator",
"value": "rectangleSegmentC001"
},
"to": [
159.25,
146.08
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
159.25,
146.08
],
"tag": null,
"to": [
159.25,
278.35
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
159.25,
278.35
],
"tag": null,
"to": [
159.25,
278.35
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
}
],
"on": {
"type": "face",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": "seg03",
"xAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0,
"units": {
"type": "Mm"
}
},
"yAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0,
"units": {
"type": "Mm"
}
},
"zAxis": {
"x": 0.0,
"y": -1.0,
"z": 0.0,
"units": {
"type": "Mm"
}
},
"solid": {
"type": "Solid",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": [
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": {
"commentStart": 150,
"end": 171,
"start": 150,
"type": "TagDeclarator",
"value": "rectangleSegmentA001"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": {
"commentStart": 255,
"end": 261,
"start": 255,
"type": "TagDeclarator",
"value": "seg01"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": {
"commentStart": 425,
"end": 431,
"start": 425,
"type": "TagDeclarator",
"value": "seg02"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": {
"commentStart": 582,
"end": 588,
"start": 582,
"type": "TagDeclarator",
"value": "seg04"
},
"type": "chamfer"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": {
"commentStart": 655,
"end": 661,
"start": 655,
"type": "TagDeclarator",
"value": "seg03"
},
"type": "chamfer"
}
],
"sketch": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
75.8,
317.2
],
"tag": {
"commentStart": 150,
"end": 171,
"start": 150,
"type": "TagDeclarator",
"value": "rectangleSegmentA001"
},
"to": [
344.23,
317.2
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
344.23,
317.2
],
"tag": {
"commentStart": 255,
"end": 261,
"start": 255,
"type": "TagDeclarator",
"value": "seg01"
},
"to": [
344.23,
99.94
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
344.23,
99.94
],
"tag": null,
"to": [
75.8,
99.94
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
75.8,
99.94
],
"tag": {
"commentStart": 425,
"end": 431,
"start": 425,
"type": "TagDeclarator",
"value": "seg02"
},
"to": [
75.8,
317.2
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
75.8,
317.2
],
"tag": null,
"to": [
75.8,
317.2
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
}
],
"on": {
"type": "plane",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": "XZ",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"units": {
"type": "Mm"
}
},
"xAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0,
"units": {
"type": "Mm"
}
},
"yAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0,
"units": {
"type": "Mm"
}
},
"zAxis": {
"x": 0.0,
"y": -1.0,
"z": 0.0,
"units": {
"type": "Mm"
}
}
},
"start": {
"from": [
75.8,
317.2
],
"to": [
75.8,
317.2
],
"units": {
"type": "Mm"
},
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
}
},
"tags": {
"rectangleSegmentA001": {
"type": "TagIdentifier",
"value": "rectangleSegmentA001"
},
"seg01": {
"type": "TagIdentifier",
"value": "seg01"
},
"seg02": {
"type": "TagIdentifier",
"value": "seg02"
},
"seg03": {
"type": "TagIdentifier",
"value": "seg03"
},
"seg04": {
"type": "TagIdentifier",
"value": "seg04"
}
},
"artifactId": "[uuid]",
KCL: Patterns of patterns can use the original sketch/solid as target (#5284) Right now, if you model something like this box with a button: <img width="413" alt="Screenshot 2025-02-06 at 3 08 03 PM" src="https://github.com/user-attachments/assets/04818a70-7cf3-4ee3-b8c5-df5959ac10db" /> Let's say you want to pattern the button, and repeat it a second time. If you try, you'll actually pattern the entire model (box + button). <img width="486" alt="Screenshot 2025-02-06 at 3 08 52 PM" src="https://github.com/user-attachments/assets/09fc28d9-5d80-4ab3-b4dc-b8de2945fcba" /> Why? Because right now, when you sketch on a face (like the button was), both the box and the button share the same ID. All extrusions from a solid will share the same ID, because they all refer to the same composite solid. This is helpful in some ways -- arguably the solid _is_ just one big complex shape now -- but it's not helpful in other ways. What if I want to only pattern the button? Luckily there's an original ID for the button part, which is still stored. So we just need a way to tell the pattern stdlib functions whether to use the target's main ID or its original ID. This PR adds a new optional bool, `useOriginal`, to patterns. It's false by default, to keep backwards-compatibility (make sure that old KCL code doesn't change). This PR is based on https://github.com/KittyCAD/modeling-app/pull/3914. It's based on work Serena and I are doing to fix a bug (engine does not allow patterning a 3D solid which was sketched on a face of another solid). @gserena01 our test program is now: ``` w = 400 case = startSketchOn('XY') |> startProfileAt([-w, -w], %) |> line(endAbsolute = [-w, w]) |> line(endAbsolute = [w, -w]) |> line(endAbsolute = [-w, -w]) |> close() |> extrude(length = 200) bump1 = startSketchOn(case, 'end') |> circle({ center = [-50, -50], radius = 40 }, %) |> extrude(length = 20) // We pass in "bump1" here since we want to pattern just this object on the face. useOriginal = true target = bump1 transform = { axis = [1, 0, 0], instances = 3, distance = -100 } patternLinear3d(transform, target, useOriginal) ``` If you change the `useOriginal = true` to `false` you can see the difference.
2025-02-06 17:46:47 -06:00
"originalId": "[uuid]",
"units": {
"type": "Mm"
}
},
"height": 100.0,
"startCapId": "[uuid]",
"endCapId": "[uuid]",
"edgeCuts": [
{
"type": "fillet",
"id": "[uuid]",
"radius": {
"n": 20.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"edgeId": "[uuid]",
"tag": null
},
{
"type": "chamfer",
"id": "[uuid]",
"length": {
"n": 50.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"edgeId": "[uuid]",
"tag": {
"commentStart": 582,
"end": 588,
"start": 582,
"type": "TagDeclarator",
"value": "seg04"
}
},
{
"type": "chamfer",
"id": "[uuid]",
"length": {
"n": 50.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"edgeId": "[uuid]",
"tag": {
"commentStart": 655,
"end": 661,
"start": 655,
"type": "TagDeclarator",
"value": "seg03"
}
}
],
"units": {
"type": "Mm"
}
},
"units": {
"type": "Mm"
}
},
"start": {
"from": [
159.25,
278.35
],
"to": [
159.25,
278.35
],
"units": {
"type": "Mm"
},
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
}
},
"tags": {
"rectangleSegmentA002": {
"type": "TagIdentifier",
"value": "rectangleSegmentA002"
},
"rectangleSegmentB001": {
"type": "TagIdentifier",
"value": "rectangleSegmentB001"
},
"rectangleSegmentC001": {
"type": "TagIdentifier",
"value": "rectangleSegmentC001"
}
},
"artifactId": "[uuid]",
"originalId": "[uuid]",
"units": {
"type": "Mm"
}
}
},
"sketch003": {
"type": "Sketch",
"value": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
-69.1,
277.34
],
"tag": {
"commentStart": 805,
"end": 826,
"start": 805,
"type": "TagDeclarator",
"value": "rectangleSegmentA003"
},
"to": [
-27.62,
277.34
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
-27.62,
277.34
],
"tag": {
"commentStart": 909,
"end": 930,
"start": 909,
"type": "TagDeclarator",
"value": "rectangleSegmentB002"
},
"to": [
-27.62,
172.54
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
-27.62,
172.54
],
"tag": {
"commentStart": 1032,
"end": 1053,
"start": 1032,
"type": "TagDeclarator",
"value": "rectangleSegmentC002"
},
"to": [
-69.1,
172.54
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
-69.1,
172.54
],
"tag": null,
"to": [
-69.1,
277.34
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
-69.1,
277.34
],
"tag": null,
"to": [
-69.1,
277.34
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
}
],
"on": {
"type": "face",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": "seg04",
"xAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0,
"units": {
"type": "Mm"
}
},
"yAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0,
"units": {
"type": "Mm"
}
},
"zAxis": {
"x": 0.0,
"y": -1.0,
"z": 0.0,
"units": {
"type": "Mm"
}
},
"solid": {
"type": "Solid",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": [
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": {
"commentStart": 150,
"end": 171,
"start": 150,
"type": "TagDeclarator",
"value": "rectangleSegmentA001"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": {
"commentStart": 255,
"end": 261,
"start": 255,
"type": "TagDeclarator",
"value": "seg01"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": {
"commentStart": 425,
"end": 431,
"start": 425,
"type": "TagDeclarator",
"value": "seg02"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": {
"commentStart": 582,
"end": 588,
"start": 582,
"type": "TagDeclarator",
"value": "seg04"
},
"type": "chamfer"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [],
"tag": {
"commentStart": 655,
"end": 661,
"start": 655,
"type": "TagDeclarator",
"value": "seg03"
},
"type": "chamfer"
}
],
"sketch": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
75.8,
317.2
],
"tag": {
"commentStart": 150,
"end": 171,
"start": 150,
"type": "TagDeclarator",
"value": "rectangleSegmentA001"
},
"to": [
344.23,
317.2
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
344.23,
317.2
],
"tag": {
"commentStart": 255,
"end": 261,
"start": 255,
"type": "TagDeclarator",
"value": "seg01"
},
"to": [
344.23,
99.94
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
344.23,
99.94
],
"tag": null,
"to": [
75.8,
99.94
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
75.8,
99.94
],
"tag": {
"commentStart": 425,
"end": 431,
"start": 425,
"type": "TagDeclarator",
"value": "seg02"
},
"to": [
75.8,
317.2
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
75.8,
317.2
],
"tag": null,
"to": [
75.8,
317.2
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
}
],
"on": {
"type": "plane",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": "XZ",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"units": {
"type": "Mm"
}
},
"xAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0,
"units": {
"type": "Mm"
}
},
"yAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0,
"units": {
"type": "Mm"
}
},
"zAxis": {
"x": 0.0,
"y": -1.0,
"z": 0.0,
"units": {
"type": "Mm"
}
}
},
"start": {
"from": [
75.8,
317.2
],
"to": [
75.8,
317.2
],
"units": {
"type": "Mm"
},
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
}
},
"tags": {
"rectangleSegmentA001": {
"type": "TagIdentifier",
"value": "rectangleSegmentA001"
},
"seg01": {
"type": "TagIdentifier",
"value": "seg01"
},
"seg02": {
"type": "TagIdentifier",
"value": "seg02"
},
"seg03": {
"type": "TagIdentifier",
"value": "seg03"
},
"seg04": {
"type": "TagIdentifier",
"value": "seg04"
}
},
"artifactId": "[uuid]",
KCL: Patterns of patterns can use the original sketch/solid as target (#5284) Right now, if you model something like this box with a button: <img width="413" alt="Screenshot 2025-02-06 at 3 08 03 PM" src="https://github.com/user-attachments/assets/04818a70-7cf3-4ee3-b8c5-df5959ac10db" /> Let's say you want to pattern the button, and repeat it a second time. If you try, you'll actually pattern the entire model (box + button). <img width="486" alt="Screenshot 2025-02-06 at 3 08 52 PM" src="https://github.com/user-attachments/assets/09fc28d9-5d80-4ab3-b4dc-b8de2945fcba" /> Why? Because right now, when you sketch on a face (like the button was), both the box and the button share the same ID. All extrusions from a solid will share the same ID, because they all refer to the same composite solid. This is helpful in some ways -- arguably the solid _is_ just one big complex shape now -- but it's not helpful in other ways. What if I want to only pattern the button? Luckily there's an original ID for the button part, which is still stored. So we just need a way to tell the pattern stdlib functions whether to use the target's main ID or its original ID. This PR adds a new optional bool, `useOriginal`, to patterns. It's false by default, to keep backwards-compatibility (make sure that old KCL code doesn't change). This PR is based on https://github.com/KittyCAD/modeling-app/pull/3914. It's based on work Serena and I are doing to fix a bug (engine does not allow patterning a 3D solid which was sketched on a face of another solid). @gserena01 our test program is now: ``` w = 400 case = startSketchOn('XY') |> startProfileAt([-w, -w], %) |> line(endAbsolute = [-w, w]) |> line(endAbsolute = [w, -w]) |> line(endAbsolute = [-w, -w]) |> close() |> extrude(length = 200) bump1 = startSketchOn(case, 'end') |> circle({ center = [-50, -50], radius = 40 }, %) |> extrude(length = 20) // We pass in "bump1" here since we want to pattern just this object on the face. useOriginal = true target = bump1 transform = { axis = [1, 0, 0], instances = 3, distance = -100 } patternLinear3d(transform, target, useOriginal) ``` If you change the `useOriginal = true` to `false` you can see the difference.
2025-02-06 17:46:47 -06:00
"originalId": "[uuid]",
"units": {
"type": "Mm"
}
},
"height": 100.0,
"startCapId": "[uuid]",
"endCapId": "[uuid]",
"edgeCuts": [
{
"type": "fillet",
"id": "[uuid]",
"radius": {
"n": 20.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"edgeId": "[uuid]",
"tag": null
},
{
"type": "chamfer",
"id": "[uuid]",
"length": {
"n": 50.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"edgeId": "[uuid]",
"tag": {
"commentStart": 582,
"end": 588,
"start": 582,
"type": "TagDeclarator",
"value": "seg04"
}
},
{
"type": "chamfer",
"id": "[uuid]",
"length": {
"n": 50.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"edgeId": "[uuid]",
"tag": {
"commentStart": 655,
"end": 661,
"start": 655,
"type": "TagDeclarator",
"value": "seg03"
}
}
],
"units": {
"type": "Mm"
}
},
"units": {
"type": "Mm"
}
},
"start": {
"from": [
-69.1,
277.34
],
"to": [
-69.1,
277.34
],
"units": {
"type": "Mm"
},
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
}
},
"tags": {
"rectangleSegmentA003": {
"type": "TagIdentifier",
"value": "rectangleSegmentA003"
},
"rectangleSegmentB002": {
"type": "TagIdentifier",
"value": "rectangleSegmentB002"
},
"rectangleSegmentC002": {
"type": "TagIdentifier",
"value": "rectangleSegmentC002"
}
},
"artifactId": "[uuid]",
"originalId": "[uuid]",
"units": {
"type": "Mm"
}
}
}
}