remove getExtrudeWallTransform (#2342)
* remove getExtrudeWallTransform Signed-off-by: Jess Frazelle <github@jessfraz.com> * docs Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
File diff suppressed because one or more lines are too long
@ -31,7 +31,6 @@ layout: manual
|
||||
* [`fillet`](kcl/fillet)
|
||||
* [`floor`](kcl/floor)
|
||||
* [`getEdge`](kcl/getEdge)
|
||||
* [`getExtrudeWallTransform`](kcl/getExtrudeWallTransform)
|
||||
* [`getNextAdjacentEdge`](kcl/getNextAdjacentEdge)
|
||||
* [`getOppositeEdge`](kcl/getOppositeEdge)
|
||||
* [`getPreviousAdjacentEdge`](kcl/getPreviousAdjacentEdge)
|
||||
|
@ -28338,839 +28338,6 @@
|
||||
"const box = startSketchOn('XY')\n |> startProfileAt([0, 0], %)\n |> line([0, 10], %)\n |> line([10, 0], %)\n |> line([0, -10], %, 'revolveAxis')\n |> close(%)\n |> extrude(10, %)\n\nconst sketch001 = startSketchOn('XY')\n |> startProfileAt([0, -10], %)\n |> line([0, -10], %)\n |> line([2, 0], %)\n |> line([0, 10], %)\n |> close(%)\n |> revolve({\n axis: getEdge('revolveAxis', box),\n angle: 90\n }, %)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "getExtrudeWallTransform",
|
||||
"summary": "Returns the extrude wall transform.",
|
||||
"description": "",
|
||||
"tags": [],
|
||||
"args": [
|
||||
{
|
||||
"name": "surface_name",
|
||||
"type": "string",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"name": "extrude_group",
|
||||
"type": "ExtrudeGroup",
|
||||
"schema": {
|
||||
"description": "An extrude group is a collection of extrude surfaces.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"__meta",
|
||||
"height",
|
||||
"id",
|
||||
"position",
|
||||
"rotation",
|
||||
"sketchGroupValues",
|
||||
"value",
|
||||
"xAxis",
|
||||
"yAxis",
|
||||
"zAxis"
|
||||
],
|
||||
"properties": {
|
||||
"__meta": {
|
||||
"description": "Metadata.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "Metadata.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"sourceRange"
|
||||
],
|
||||
"properties": {
|
||||
"sourceRange": {
|
||||
"description": "The source range.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"format": "uint",
|
||||
"minimum": 0.0
|
||||
},
|
||||
"maxItems": 2,
|
||||
"minItems": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"endCapId": {
|
||||
"description": "The id of the extrusion end cap",
|
||||
"type": "string",
|
||||
"format": "uuid",
|
||||
"nullable": true
|
||||
},
|
||||
"height": {
|
||||
"description": "The height of the extrude group.",
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"id": {
|
||||
"description": "The id of the extrude group.",
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"position": {
|
||||
"description": "The position of the extrude group.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"maxItems": 3,
|
||||
"minItems": 3
|
||||
},
|
||||
"rotation": {
|
||||
"description": "The rotation of the extrude group.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"maxItems": 4,
|
||||
"minItems": 4
|
||||
},
|
||||
"sketchGroupValues": {
|
||||
"description": "The sketch group paths.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "A path.",
|
||||
"oneOf": [
|
||||
{
|
||||
"description": "A path that goes to a point.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"__geoMeta",
|
||||
"from",
|
||||
"name",
|
||||
"to",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"__geoMeta": {
|
||||
"description": "Metadata.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"id",
|
||||
"sourceRange"
|
||||
],
|
||||
"properties": {
|
||||
"id": {
|
||||
"description": "The id of the geometry.",
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"sourceRange": {
|
||||
"description": "The source range.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"format": "uint",
|
||||
"minimum": 0.0
|
||||
},
|
||||
"maxItems": 2,
|
||||
"minItems": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
"from": {
|
||||
"description": "The from point.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"maxItems": 2,
|
||||
"minItems": 2
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the path.",
|
||||
"type": "string"
|
||||
},
|
||||
"to": {
|
||||
"description": "The to point.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"maxItems": 2,
|
||||
"minItems": 2
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"ToPoint"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "A arc that is tangential to the last path segment that goes to a point",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"__geoMeta",
|
||||
"ccw",
|
||||
"center",
|
||||
"from",
|
||||
"name",
|
||||
"to",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"__geoMeta": {
|
||||
"description": "Metadata.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"id",
|
||||
"sourceRange"
|
||||
],
|
||||
"properties": {
|
||||
"id": {
|
||||
"description": "The id of the geometry.",
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"sourceRange": {
|
||||
"description": "The source range.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"format": "uint",
|
||||
"minimum": 0.0
|
||||
},
|
||||
"maxItems": 2,
|
||||
"minItems": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
"ccw": {
|
||||
"description": "arc's direction",
|
||||
"type": "boolean"
|
||||
},
|
||||
"center": {
|
||||
"description": "the arc's center",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"maxItems": 2,
|
||||
"minItems": 2
|
||||
},
|
||||
"from": {
|
||||
"description": "The from point.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"maxItems": 2,
|
||||
"minItems": 2
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the path.",
|
||||
"type": "string"
|
||||
},
|
||||
"to": {
|
||||
"description": "The to point.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"maxItems": 2,
|
||||
"minItems": 2
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"TangentialArcTo"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "A arc that is tangential to the last path segment",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"__geoMeta",
|
||||
"from",
|
||||
"name",
|
||||
"to",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"__geoMeta": {
|
||||
"description": "Metadata.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"id",
|
||||
"sourceRange"
|
||||
],
|
||||
"properties": {
|
||||
"id": {
|
||||
"description": "The id of the geometry.",
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"sourceRange": {
|
||||
"description": "The source range.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"format": "uint",
|
||||
"minimum": 0.0
|
||||
},
|
||||
"maxItems": 2,
|
||||
"minItems": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
"from": {
|
||||
"description": "The from point.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"maxItems": 2,
|
||||
"minItems": 2
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the path.",
|
||||
"type": "string"
|
||||
},
|
||||
"to": {
|
||||
"description": "The to point.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"maxItems": 2,
|
||||
"minItems": 2
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"TangentialArc"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "A path that is horizontal.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"__geoMeta",
|
||||
"from",
|
||||
"name",
|
||||
"to",
|
||||
"type",
|
||||
"x"
|
||||
],
|
||||
"properties": {
|
||||
"__geoMeta": {
|
||||
"description": "Metadata.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"id",
|
||||
"sourceRange"
|
||||
],
|
||||
"properties": {
|
||||
"id": {
|
||||
"description": "The id of the geometry.",
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"sourceRange": {
|
||||
"description": "The source range.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"format": "uint",
|
||||
"minimum": 0.0
|
||||
},
|
||||
"maxItems": 2,
|
||||
"minItems": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
"from": {
|
||||
"description": "The from point.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"maxItems": 2,
|
||||
"minItems": 2
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the path.",
|
||||
"type": "string"
|
||||
},
|
||||
"to": {
|
||||
"description": "The to point.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"maxItems": 2,
|
||||
"minItems": 2
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Horizontal"
|
||||
]
|
||||
},
|
||||
"x": {
|
||||
"description": "The x coordinate.",
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "An angled line to.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"__geoMeta",
|
||||
"from",
|
||||
"name",
|
||||
"to",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"__geoMeta": {
|
||||
"description": "Metadata.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"id",
|
||||
"sourceRange"
|
||||
],
|
||||
"properties": {
|
||||
"id": {
|
||||
"description": "The id of the geometry.",
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"sourceRange": {
|
||||
"description": "The source range.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"format": "uint",
|
||||
"minimum": 0.0
|
||||
},
|
||||
"maxItems": 2,
|
||||
"minItems": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
"from": {
|
||||
"description": "The from point.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"maxItems": 2,
|
||||
"minItems": 2
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the path.",
|
||||
"type": "string"
|
||||
},
|
||||
"to": {
|
||||
"description": "The to point.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"maxItems": 2,
|
||||
"minItems": 2
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"AngledLineTo"
|
||||
]
|
||||
},
|
||||
"x": {
|
||||
"description": "The x coordinate.",
|
||||
"type": "number",
|
||||
"format": "double",
|
||||
"nullable": true
|
||||
},
|
||||
"y": {
|
||||
"description": "The y coordinate.",
|
||||
"type": "number",
|
||||
"format": "double",
|
||||
"nullable": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "A base path.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"__geoMeta",
|
||||
"from",
|
||||
"name",
|
||||
"to",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"__geoMeta": {
|
||||
"description": "Metadata.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"id",
|
||||
"sourceRange"
|
||||
],
|
||||
"properties": {
|
||||
"id": {
|
||||
"description": "The id of the geometry.",
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"sourceRange": {
|
||||
"description": "The source range.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"format": "uint",
|
||||
"minimum": 0.0
|
||||
},
|
||||
"maxItems": 2,
|
||||
"minItems": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
"from": {
|
||||
"description": "The from point.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"maxItems": 2,
|
||||
"minItems": 2
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the path.",
|
||||
"type": "string"
|
||||
},
|
||||
"to": {
|
||||
"description": "The to point.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"maxItems": 2,
|
||||
"minItems": 2
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Base"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"startCapId": {
|
||||
"description": "The id of the extrusion start cap",
|
||||
"type": "string",
|
||||
"format": "uuid",
|
||||
"nullable": true
|
||||
},
|
||||
"value": {
|
||||
"description": "The extrude surfaces.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "An extrude surface.",
|
||||
"oneOf": [
|
||||
{
|
||||
"description": "An extrude plane.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"faceId",
|
||||
"id",
|
||||
"name",
|
||||
"position",
|
||||
"rotation",
|
||||
"sourceRange",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"faceId": {
|
||||
"description": "The face id for the extrude plane.",
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"id": {
|
||||
"description": "The id of the geometry.",
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name.",
|
||||
"type": "string"
|
||||
},
|
||||
"position": {
|
||||
"description": "The position.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"maxItems": 3,
|
||||
"minItems": 3
|
||||
},
|
||||
"rotation": {
|
||||
"description": "The rotation.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"maxItems": 4,
|
||||
"minItems": 4
|
||||
},
|
||||
"sourceRange": {
|
||||
"description": "The source range.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"format": "uint",
|
||||
"minimum": 0.0
|
||||
},
|
||||
"maxItems": 2,
|
||||
"minItems": 2
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"extrudePlane"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "An extruded arc.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"faceId",
|
||||
"id",
|
||||
"name",
|
||||
"position",
|
||||
"rotation",
|
||||
"sourceRange",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"faceId": {
|
||||
"description": "The face id for the extrude plane.",
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"id": {
|
||||
"description": "The id of the geometry.",
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name.",
|
||||
"type": "string"
|
||||
},
|
||||
"position": {
|
||||
"description": "The position.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"maxItems": 3,
|
||||
"minItems": 3
|
||||
},
|
||||
"rotation": {
|
||||
"description": "The rotation.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"maxItems": 4,
|
||||
"minItems": 4
|
||||
},
|
||||
"sourceRange": {
|
||||
"description": "The source range.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"format": "uint",
|
||||
"minimum": 0.0
|
||||
},
|
||||
"maxItems": 2,
|
||||
"minItems": 2
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"extrudeArc"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"xAxis": {
|
||||
"description": "The x-axis of the extrude group base plane in the 3D space",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"x",
|
||||
"y",
|
||||
"z"
|
||||
],
|
||||
"properties": {
|
||||
"x": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"y": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"z": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
}
|
||||
}
|
||||
},
|
||||
"yAxis": {
|
||||
"description": "The y-axis of the extrude group base plane in the 3D space",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"x",
|
||||
"y",
|
||||
"z"
|
||||
],
|
||||
"properties": {
|
||||
"x": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"y": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"z": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
}
|
||||
}
|
||||
},
|
||||
"zAxis": {
|
||||
"description": "The z-axis of the extrude group base plane in the 3D space",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"x",
|
||||
"y",
|
||||
"z"
|
||||
],
|
||||
"properties": {
|
||||
"x": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"y": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"z": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"returnValue": {
|
||||
"name": "",
|
||||
"type": "ExtrudeTransform",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"__meta",
|
||||
"position",
|
||||
"rotation"
|
||||
],
|
||||
"properties": {
|
||||
"__meta": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "Metadata.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"sourceRange"
|
||||
],
|
||||
"properties": {
|
||||
"sourceRange": {
|
||||
"description": "The source range.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"format": "uint",
|
||||
"minimum": 0.0
|
||||
},
|
||||
"maxItems": 2,
|
||||
"minItems": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"position": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"maxItems": 3,
|
||||
"minItems": 3
|
||||
},
|
||||
"rotation": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"maxItems": 4,
|
||||
"minItems": 4
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"unpublished": false,
|
||||
"deprecated": false,
|
||||
"examples": [
|
||||
"const box = startSketchOn('XY')\n |> startProfileAt([0, 0], %)\n |> line([0, 10], %)\n |> line([10, 0], %)\n |> line([0, -10], %, \"surface\")\n |> close(%)\n |> extrude(5, %)\n\nconst transform = getExtrudeWallTransform('surface', box)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "getNextAdjacentEdge",
|
||||
"summary": "Get the next adjacent edge to the edge given.",
|
||||
|
@ -144,8 +144,6 @@ pub enum MemoryItem {
|
||||
},
|
||||
ImportedGeometry(ImportedGeometry),
|
||||
#[ts(skip)]
|
||||
ExtrudeTransform(Box<ExtrudeTransform>),
|
||||
#[ts(skip)]
|
||||
Function {
|
||||
#[serde(skip)]
|
||||
func: Option<MemoryFunction>,
|
||||
@ -300,16 +298,6 @@ pub struct UserVal {
|
||||
pub meta: Vec<Metadata>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type", rename_all = "camelCase")]
|
||||
pub struct ExtrudeTransform {
|
||||
pub position: Position,
|
||||
pub rotation: Rotation,
|
||||
#[serde(rename = "__meta")]
|
||||
pub meta: Vec<Metadata>,
|
||||
}
|
||||
|
||||
pub type MemoryFunction =
|
||||
fn(
|
||||
s: Vec<MemoryItem>,
|
||||
@ -348,7 +336,6 @@ impl From<MemoryItem> for Vec<SourceRange> {
|
||||
.flat_map(|eg| eg.meta.iter().map(|m| m.source_range))
|
||||
.collect(),
|
||||
MemoryItem::ImportedGeometry(i) => i.meta.iter().map(|m| m.source_range).collect(),
|
||||
MemoryItem::ExtrudeTransform(e) => e.meta.iter().map(|m| m.source_range).collect(),
|
||||
MemoryItem::Function { meta, .. } => meta.iter().map(|m| m.source_range).collect(),
|
||||
MemoryItem::Plane(p) => p.meta.iter().map(|m| m.source_range).collect(),
|
||||
MemoryItem::Face(f) => f.meta.iter().map(|m| m.source_range).collect(),
|
||||
|
@ -8,8 +8,8 @@ use uuid::Uuid;
|
||||
use crate::{
|
||||
errors::{KclError, KclErrorDetails},
|
||||
executor::{
|
||||
ExtrudeGroup, ExtrudeGroupSet, ExtrudeSurface, ExtrudeTransform, GeoMeta, MemoryItem, Path, SketchGroup,
|
||||
SketchGroupSet, SketchSurface,
|
||||
ExtrudeGroup, ExtrudeGroupSet, ExtrudeSurface, GeoMeta, MemoryItem, Path, SketchGroup, SketchGroupSet,
|
||||
SketchSurface,
|
||||
},
|
||||
std::Args,
|
||||
};
|
||||
@ -224,48 +224,3 @@ pub(crate) async fn do_post_extrude(
|
||||
meta: sketch_group.meta,
|
||||
}))
|
||||
}
|
||||
|
||||
/// Returns the extrude wall transform.
|
||||
pub async fn get_extrude_wall_transform(args: Args) -> Result<MemoryItem, KclError> {
|
||||
let (surface_name, extrude_group) = args.get_path_name_extrude_group()?;
|
||||
let result = inner_get_extrude_wall_transform(&surface_name, *extrude_group, args)?;
|
||||
Ok(MemoryItem::ExtrudeTransform(result))
|
||||
}
|
||||
|
||||
/// Returns the extrude wall transform.
|
||||
///
|
||||
/// ```no_run
|
||||
/// const box = startSketchOn('XY')
|
||||
/// |> startProfileAt([0, 0], %)
|
||||
/// |> line([0, 10], %)
|
||||
/// |> line([10, 0], %)
|
||||
/// |> line([0, -10], %, "surface")
|
||||
/// |> close(%)
|
||||
/// |> extrude(5, %)
|
||||
///
|
||||
/// const transform = getExtrudeWallTransform('surface', box)
|
||||
/// ```
|
||||
#[stdlib {
|
||||
name = "getExtrudeWallTransform"
|
||||
}]
|
||||
fn inner_get_extrude_wall_transform(
|
||||
surface_name: &str,
|
||||
extrude_group: ExtrudeGroup,
|
||||
args: Args,
|
||||
) -> Result<Box<ExtrudeTransform>, KclError> {
|
||||
let surface = extrude_group.get_path_by_name(surface_name).ok_or_else(|| {
|
||||
KclError::Type(KclErrorDetails {
|
||||
message: format!(
|
||||
"Expected a surface name that exists in the given ExtrudeGroup, found `{}`",
|
||||
surface_name
|
||||
),
|
||||
source_ranges: vec![args.source_range],
|
||||
})
|
||||
})?;
|
||||
|
||||
Ok(Box::new(ExtrudeTransform {
|
||||
position: surface.get_position(),
|
||||
rotation: surface.get_rotation(),
|
||||
meta: extrude_group.meta,
|
||||
}))
|
||||
}
|
||||
|
@ -44,7 +44,6 @@ lazy_static! {
|
||||
Box::new(LegAngX),
|
||||
Box::new(LegAngY),
|
||||
Box::new(crate::std::extrude::Extrude),
|
||||
Box::new(crate::std::extrude::GetExtrudeWallTransform),
|
||||
Box::new(crate::std::segment::SegEndX),
|
||||
Box::new(crate::std::segment::SegEndY),
|
||||
Box::new(crate::std::segment::LastSegX),
|
||||
@ -906,54 +905,6 @@ impl Args {
|
||||
|
||||
Ok((number, sketch_set))
|
||||
}
|
||||
|
||||
fn get_path_name_extrude_group(&self) -> Result<(String, Box<ExtrudeGroup>), KclError> {
|
||||
// Iterate over our args, the first argument should be a UserVal with a string value.
|
||||
// The second argument should be a ExtrudeGroup.
|
||||
let first_value = self
|
||||
.args
|
||||
.first()
|
||||
.ok_or_else(|| {
|
||||
KclError::Type(KclErrorDetails {
|
||||
message: format!("Expected a string as the first argument, found `{:?}`", self.args),
|
||||
source_ranges: vec![self.source_range],
|
||||
})
|
||||
})?
|
||||
.get_json_value()?;
|
||||
|
||||
let path_name = if let serde_json::Value::String(s) = first_value {
|
||||
s.to_string()
|
||||
} else {
|
||||
return Err(KclError::Type(KclErrorDetails {
|
||||
message: format!("Expected a string as the first argument, found `{:?}`", self.args),
|
||||
source_ranges: vec![self.source_range],
|
||||
}));
|
||||
};
|
||||
|
||||
let second_value = self.args.get(1).ok_or_else(|| {
|
||||
KclError::Type(KclErrorDetails {
|
||||
message: format!(
|
||||
"Expected a ExtrudeGroup as the second argument, found `{:?}`",
|
||||
self.args
|
||||
),
|
||||
source_ranges: vec![self.source_range],
|
||||
})
|
||||
})?;
|
||||
|
||||
let extrude_group = if let MemoryItem::ExtrudeGroup(sg) = second_value {
|
||||
sg.clone()
|
||||
} else {
|
||||
return Err(KclError::Type(KclErrorDetails {
|
||||
message: format!(
|
||||
"Expected a ExtrudeGroup as the second argument, found `{:?}`",
|
||||
self.args
|
||||
),
|
||||
source_ranges: vec![self.source_range],
|
||||
}));
|
||||
};
|
||||
|
||||
Ok((path_name, extrude_group))
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the length of the given leg.
|
||||
|
Reference in New Issue
Block a user