Show offset planes in the scene, let user select them (#4481)
* Update offset_plane to actually create and show the plane in-engine * Fix broken ability to use offsetPlanes in startSketchOn * Make the newly-visible offset planes usable for sketching via UI * Add a playwright test for sketching on an offset plane via point-and-click * cargo clippy & cargo fmt * Make `PlaneData` the first item of `SketchData` so autocomplete continues to work well for `startSketchOn` * @nadr0 feedback re: `offsetIndex` * From @jtran: "Need to call the ID generator so that IDs are stable." * More feedback from @jtran and fix incomplete use of `id_generator` in last commit * Oops I missed saving `isPathToNodeNumber` earlier 🤦🏻 * Make the distinction between `Plane` and `PlaneOrientationData` more clear per @nadr0 and @lf94's feedback * Make `newPathToNode` less hardcoded, per @lf94's feedback * Don't need to unbox and rebox `plane` * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Rearranging of enums and structs, but the offsetPlanes are still not used by their sketches * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Revert all my little newtype fiddling it's a waste of time. * Update docs * cargo fmt * Remove log * Print the unexpected diagnostics * Undo renaming of `PlaneData` * Remove generated PlaneRientationData docs page * Redo doc generation after undoing `PlaneData` rename * Impl FromKclValue for the new plane datatypes * Clippy lint * When starting a sketch, only hide the plane if it's a custom plane * Fix FromKclValue and macro use since merge * Fix to not convert Plane to PlaneData * Make sure offset planes are `Custom` type * SketchData actually doesn't need to be in a certain order This avoids the autocompletion issue I was having. --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Adam Chalmers <adam.chalmers@zoo.dev> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
This commit is contained in:
@ -9,7 +9,7 @@ Offset a plane by a distance along its normal.
|
||||
For example, if you offset the 'XZ' plane by 10, the new plane will be parallel to the 'XZ' plane and 10 units away from it.
|
||||
|
||||
```js
|
||||
offsetPlane(std_plane: StandardPlane, offset: number) -> PlaneData
|
||||
offsetPlane(std_plane: StandardPlane, offset: number) -> Plane
|
||||
```
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ offsetPlane(std_plane: StandardPlane, offset: number) -> PlaneData
|
||||
|
||||
### Returns
|
||||
|
||||
[`PlaneData`](/docs/kcl/types/PlaneData) - Data for a plane.
|
||||
[`Plane`](/docs/kcl/types/Plane) - A plane.
|
||||
|
||||
|
||||
### Examples
|
||||
|
||||
@ -105747,109 +105747,90 @@
|
||||
],
|
||||
"returnValue": {
|
||||
"name": "",
|
||||
"type": "PlaneData",
|
||||
"type": "Plane",
|
||||
"schema": {
|
||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||
"title": "PlaneData",
|
||||
"description": "Data for a plane.",
|
||||
"oneOf": [
|
||||
{
|
||||
"description": "The XY plane.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"XY"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "The opposite side of the XY plane.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"-XY"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "The XZ plane.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"XZ"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "The opposite side of the XZ plane.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"-XZ"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "The YZ plane.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"YZ"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "The opposite side of the YZ plane.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"-YZ"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "A defined plane.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"plane"
|
||||
],
|
||||
"properties": {
|
||||
"plane": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"origin",
|
||||
"xAxis",
|
||||
"yAxis",
|
||||
"zAxis"
|
||||
],
|
||||
"properties": {
|
||||
"origin": {
|
||||
"description": "Origin of the plane.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/Point3d"
|
||||
}
|
||||
]
|
||||
},
|
||||
"xAxis": {
|
||||
"description": "What should the plane’s X axis be?",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/Point3d"
|
||||
}
|
||||
]
|
||||
},
|
||||
"yAxis": {
|
||||
"description": "What should the plane’s Y axis be?",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/Point3d"
|
||||
}
|
||||
]
|
||||
},
|
||||
"zAxis": {
|
||||
"description": "The z-axis (normal).",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/Point3d"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
"title": "Plane",
|
||||
"description": "A plane.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"__meta",
|
||||
"id",
|
||||
"origin",
|
||||
"value",
|
||||
"xAxis",
|
||||
"yAxis",
|
||||
"zAxis"
|
||||
],
|
||||
"properties": {
|
||||
"id": {
|
||||
"description": "The id of the plane.",
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"value": {
|
||||
"$ref": "#/components/schemas/PlaneType"
|
||||
},
|
||||
"origin": {
|
||||
"description": "Origin of the plane.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/Point3d"
|
||||
}
|
||||
]
|
||||
},
|
||||
"xAxis": {
|
||||
"description": "What should the plane’s X axis be?",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/Point3d"
|
||||
}
|
||||
]
|
||||
},
|
||||
"yAxis": {
|
||||
"description": "What should the plane’s Y axis be?",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/Point3d"
|
||||
}
|
||||
]
|
||||
},
|
||||
"zAxis": {
|
||||
"description": "The z-axis (normal).",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/Point3d"
|
||||
}
|
||||
]
|
||||
},
|
||||
"__meta": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/Metadata"
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"PlaneType": {
|
||||
"description": "Type for a plane.",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"XY",
|
||||
"XZ",
|
||||
"YZ"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "A custom plane.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Custom"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"Point3d": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
@ -105871,6 +105852,33 @@
|
||||
"format": "double"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Metadata": {
|
||||
"description": "Metadata.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"sourceRange"
|
||||
],
|
||||
"properties": {
|
||||
"sourceRange": {
|
||||
"description": "The source range.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/SourceRange"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SourceRange": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"format": "uint",
|
||||
"minimum": 0.0
|
||||
},
|
||||
"maxItems": 3,
|
||||
"minItems": 3
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -179036,13 +179044,16 @@
|
||||
{
|
||||
"$ref": "#/components/schemas/PlaneData"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/Plane"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/Solid"
|
||||
}
|
||||
],
|
||||
"definitions": {
|
||||
"PlaneData": {
|
||||
"description": "Data for a plane.",
|
||||
"description": "Orientation data that can be used to construct a plane, not a plane in itself.",
|
||||
"oneOf": [
|
||||
{
|
||||
"description": "The XY plane.",
|
||||
@ -179163,6 +179174,114 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"Plane": {
|
||||
"description": "A plane.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"__meta",
|
||||
"id",
|
||||
"origin",
|
||||
"value",
|
||||
"xAxis",
|
||||
"yAxis",
|
||||
"zAxis"
|
||||
],
|
||||
"properties": {
|
||||
"id": {
|
||||
"description": "The id of the plane.",
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"value": {
|
||||
"$ref": "#/components/schemas/PlaneType"
|
||||
},
|
||||
"origin": {
|
||||
"description": "Origin of the plane.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/Point3d"
|
||||
}
|
||||
]
|
||||
},
|
||||
"xAxis": {
|
||||
"description": "What should the plane’s X axis be?",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/Point3d"
|
||||
}
|
||||
]
|
||||
},
|
||||
"yAxis": {
|
||||
"description": "What should the plane’s Y axis be?",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/Point3d"
|
||||
}
|
||||
]
|
||||
},
|
||||
"zAxis": {
|
||||
"description": "The z-axis (normal).",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/Point3d"
|
||||
}
|
||||
]
|
||||
},
|
||||
"__meta": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/Metadata"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"PlaneType": {
|
||||
"description": "Type for a plane.",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"XY",
|
||||
"XZ",
|
||||
"YZ"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "A custom plane.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Custom"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"Metadata": {
|
||||
"description": "Metadata.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"sourceRange"
|
||||
],
|
||||
"properties": {
|
||||
"sourceRange": {
|
||||
"description": "The source range.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/SourceRange"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SourceRange": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"format": "uint",
|
||||
"minimum": 0.0
|
||||
},
|
||||
"maxItems": 3,
|
||||
"minItems": 3
|
||||
},
|
||||
"Solid": {
|
||||
"description": "An solid is a collection of extrude surfaces.",
|
||||
"type": "object",
|
||||
@ -179444,16 +179563,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"SourceRange": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"format": "uint",
|
||||
"minimum": 0.0
|
||||
},
|
||||
"maxItems": 3,
|
||||
"minItems": 3
|
||||
},
|
||||
"Sketch": {
|
||||
"description": "A sketch is a collection of paths.",
|
||||
"type": "object",
|
||||
@ -180208,43 +180317,6 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"PlaneType": {
|
||||
"description": "Type for a plane.",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"XY",
|
||||
"XZ",
|
||||
"YZ"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "A custom plane.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Custom"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"Metadata": {
|
||||
"description": "Metadata.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"sourceRange"
|
||||
],
|
||||
"properties": {
|
||||
"sourceRange": {
|
||||
"description": "The source range.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/SourceRange"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"BasePath": {
|
||||
"description": "A base path.",
|
||||
"type": "object",
|
||||
@ -180460,7 +180532,7 @@
|
||||
"nullable": true,
|
||||
"definitions": {
|
||||
"PlaneData": {
|
||||
"description": "Data for a plane.",
|
||||
"description": "Orientation data that can be used to construct a plane, not a plane in itself.",
|
||||
"oneOf": [
|
||||
{
|
||||
"description": "The XY plane.",
|
||||
@ -180581,6 +180653,114 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"Plane": {
|
||||
"description": "A plane.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"__meta",
|
||||
"id",
|
||||
"origin",
|
||||
"value",
|
||||
"xAxis",
|
||||
"yAxis",
|
||||
"zAxis"
|
||||
],
|
||||
"properties": {
|
||||
"id": {
|
||||
"description": "The id of the plane.",
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"value": {
|
||||
"$ref": "#/components/schemas/PlaneType"
|
||||
},
|
||||
"origin": {
|
||||
"description": "Origin of the plane.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/Point3d"
|
||||
}
|
||||
]
|
||||
},
|
||||
"xAxis": {
|
||||
"description": "What should the plane’s X axis be?",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/Point3d"
|
||||
}
|
||||
]
|
||||
},
|
||||
"yAxis": {
|
||||
"description": "What should the plane’s Y axis be?",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/Point3d"
|
||||
}
|
||||
]
|
||||
},
|
||||
"zAxis": {
|
||||
"description": "The z-axis (normal).",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/Point3d"
|
||||
}
|
||||
]
|
||||
},
|
||||
"__meta": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/Metadata"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"PlaneType": {
|
||||
"description": "Type for a plane.",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"XY",
|
||||
"XZ",
|
||||
"YZ"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "A custom plane.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Custom"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"Metadata": {
|
||||
"description": "Metadata.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"sourceRange"
|
||||
],
|
||||
"properties": {
|
||||
"sourceRange": {
|
||||
"description": "The source range.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/SourceRange"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SourceRange": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"format": "uint",
|
||||
"minimum": 0.0
|
||||
},
|
||||
"maxItems": 3,
|
||||
"minItems": 3
|
||||
},
|
||||
"Solid": {
|
||||
"description": "An solid is a collection of extrude surfaces.",
|
||||
"type": "object",
|
||||
@ -180862,16 +181042,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"SourceRange": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"format": "uint",
|
||||
"minimum": 0.0
|
||||
},
|
||||
"maxItems": 3,
|
||||
"minItems": 3
|
||||
},
|
||||
"Sketch": {
|
||||
"description": "A sketch is a collection of paths.",
|
||||
"type": "object",
|
||||
@ -181626,43 +181796,6 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"PlaneType": {
|
||||
"description": "Type for a plane.",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"XY",
|
||||
"XZ",
|
||||
"YZ"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "A custom plane.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Custom"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"Metadata": {
|
||||
"description": "Metadata.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"sourceRange"
|
||||
],
|
||||
"properties": {
|
||||
"sourceRange": {
|
||||
"description": "The source range.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/SourceRange"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"BasePath": {
|
||||
"description": "A base path.",
|
||||
"type": "object",
|
||||
|
||||
@ -180,7 +180,7 @@ A plane.
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `Plane`| | No |
|
||||
| `type` |enum: [`Plane`](/docs/kcl/types/Plane)| | No |
|
||||
| `id` |`string`| The id of the plane. | No |
|
||||
| `value` |[`PlaneType`](/docs/kcl/types/PlaneType)| Any KCL value. | No |
|
||||
| `origin` |[`Point3d`](/docs/kcl/types/Point3d)| Origin of the plane. | No |
|
||||
|
||||
27
docs/kcl/types/Plane.md
Normal file
27
docs/kcl/types/Plane.md
Normal file
@ -0,0 +1,27 @@
|
||||
---
|
||||
title: "Plane"
|
||||
excerpt: "A plane."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
A plane.
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `id` |`string`| The id of the plane. | No |
|
||||
| `value` |[`PlaneType`](/docs/kcl/types/PlaneType)| A plane. | No |
|
||||
| `origin` |[`Point3d`](/docs/kcl/types/Point3d)| Origin of the plane. | No |
|
||||
| `xAxis` |[`Point3d`](/docs/kcl/types/Point3d)| What should the plane’s X axis be? | No |
|
||||
| `yAxis` |[`Point3d`](/docs/kcl/types/Point3d)| What should the plane’s Y axis be? | No |
|
||||
| `zAxis` |[`Point3d`](/docs/kcl/types/Point3d)| The z-axis (normal). | No |
|
||||
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
|
||||
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
---
|
||||
title: "PlaneData"
|
||||
excerpt: "Data for a plane."
|
||||
excerpt: "Orientation data that can be used to construct a plane, not a plane in itself."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Data for a plane.
|
||||
Orientation data that can be used to construct a plane, not a plane in itself.
|
||||
|
||||
|
||||
|
||||
|
||||
@ -22,6 +22,18 @@ Data for start sketch on. You can start a sketch on a plane or an solid.
|
||||
|
||||
|
||||
|
||||
----
|
||||
Data for start sketch on. You can start a sketch on a plane or an solid.
|
||||
|
||||
[`Plane`](/docs/kcl/types/Plane)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
Data for start sketch on. You can start a sketch on a plane or an solid.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user