Revolve/Sweep multiple sketches at once (#5779)

* revolve multiple sketches at once

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>

* updates

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

* updates

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

* do the same for swweep

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

* updates

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

* do the same for swweep

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

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2025-03-13 09:38:22 -07:00
committed by GitHub
parent c441a3ab1c
commit 80f78e1c61
28 changed files with 1153 additions and 899 deletions

View File

@ -6,7 +6,7 @@ layout: manual
Extend a 2-dimensional sketch through a third dimension in order to create new 3-dimensional volume, or if extruded into an existing volume, cut into an existing solid.
You can provide more than one sketch to extrude, and they will all be extruded in the same direction.
```js
extrude(
@ -20,7 +20,7 @@ extrude(
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `sketchSet` | [`SketchSet`](/docs/kcl/types/SketchSet) | Which sketches should be extruded | Yes |
| `sketchSet` | [`SketchSet`](/docs/kcl/types/SketchSet) | Which sketch or set of sketches should be extruded | Yes |
| `length` | [`number`](/docs/kcl/types/number) | How far to extrude the given sketches | Yes |
### Returns

File diff suppressed because one or more lines are too long

View File

@ -89138,7 +89138,7 @@
{
"name": "extrude",
"summary": "Extend a 2-dimensional sketch through a third dimension in order to create new 3-dimensional volume, or if extruded into an existing volume, cut into an existing solid.",
"description": "",
"description": "You can provide more than one sketch to extrude, and they will all be extruded in the same direction.",
"tags": [],
"keywordArguments": true,
"args": [
@ -90844,7 +90844,7 @@
},
"required": true,
"includeInSnippet": true,
"description": "Which sketches should be extruded",
"description": "Which sketch or set of sketches should be extruded",
"labelRequired": false
},
{
@ -254139,7 +254139,7 @@
{
"name": "revolve",
"summary": "Rotate a sketch around some provided axis, creating a solid from its extent.",
"description": "This, like extrude, is able to create a 3-dimensional solid from a 2-dimensional sketch. However, unlike extrude, this creates a solid by using the extent of the sketch as its revolved around an axis rather than using the extent of the sketch linearly translated through a third dimension.\n\nRevolve occurs around a local sketch axis rather than a global axis.",
"description": "This, like extrude, is able to create a 3-dimensional solid from a 2-dimensional sketch. However, unlike extrude, this creates a solid by using the extent of the sketch as its revolved around an axis rather than using the extent of the sketch linearly translated through a third dimension.\n\nRevolve occurs around a local sketch axis rather than a global axis.\n\nYou can provide more than one sketch to revolve, and they will all be revolved around the same axis.",
"tags": [],
"keywordArguments": false,
"args": [
@ -255382,81 +255382,113 @@
"labelRequired": true
},
{
"name": "sketch",
"type": "Sketch",
"name": "sketchSet",
"type": "SketchSet",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
"title": "Sketch",
"type": "object",
"required": [
"__meta",
"artifactId",
"id",
"on",
"originalId",
"paths",
"start",
"units"
],
"properties": {
"id": {
"description": "The id of the sketch (this will change when the engine's reference to it changes).",
"type": "string",
"format": "uuid"
},
"paths": {
"description": "The paths in the sketch.",
"type": "array",
"items": {
"$ref": "#/components/schemas/Path"
}
},
"on": {
"description": "What the sketch is on (can be a plane or a face).",
"allOf": [
{
"$ref": "#/components/schemas/SketchSurface"
}
]
},
"start": {
"description": "The starting path.",
"allOf": [
{
"$ref": "#/components/schemas/BasePath"
}
]
},
"tags": {
"description": "Tag identifiers that have been declared in this sketch.",
"title": "SketchSet",
"description": "A sketch or a group of sketches.",
"oneOf": [
{
"type": "object",
"additionalProperties": {
"$ref": "#/components/schemas/TagIdentifier"
"required": [
"__meta",
"artifactId",
"id",
"on",
"originalId",
"paths",
"start",
"type",
"units"
],
"properties": {
"type": {
"type": "string",
"enum": [
"sketch"
]
},
"id": {
"description": "The id of the sketch (this will change when the engine's reference to it changes).",
"type": "string",
"format": "uuid"
},
"paths": {
"description": "The paths in the sketch.",
"type": "array",
"items": {
"$ref": "#/components/schemas/Path"
}
},
"on": {
"description": "What the sketch is on (can be a plane or a face).",
"allOf": [
{
"$ref": "#/components/schemas/SketchSurface"
}
]
},
"start": {
"description": "The starting path.",
"allOf": [
{
"$ref": "#/components/schemas/BasePath"
}
]
},
"tags": {
"description": "Tag identifiers that have been declared in this sketch.",
"type": "object",
"additionalProperties": {
"$ref": "#/components/schemas/TagIdentifier"
}
},
"artifactId": {
"description": "The original id of the sketch. This stays the same even if the sketch is is sketched on face etc.",
"allOf": [
{
"$ref": "#/components/schemas/ArtifactId"
}
]
},
"originalId": {
"type": "string",
"format": "uuid"
},
"units": {
"$ref": "#/components/schemas/UnitLen"
},
"__meta": {
"description": "Metadata.",
"type": "array",
"items": {
"$ref": "#/components/schemas/Metadata"
}
}
}
},
"artifactId": {
"description": "The original id of the sketch. This stays the same even if the sketch is is sketched on face etc.",
"allOf": [
{
"$ref": "#/components/schemas/ArtifactId"
}
]
},
"originalId": {
"type": "string",
"format": "uuid"
},
"units": {
"$ref": "#/components/schemas/UnitLen"
},
"__meta": {
"description": "Metadata.",
"type": "array",
{
"type": [
"object",
"array"
],
"items": {
"$ref": "#/components/schemas/Metadata"
"$ref": "#/components/schemas/Sketch"
},
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"enum": [
"sketches"
]
}
}
}
},
],
"definitions": {
"Axis2dOrEdgeReference": {
"description": "A 2D axis or tagged edge.",
@ -257166,84 +257198,116 @@
],
"returnValue": {
"name": "",
"type": "Solid",
"type": "SolidSet",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
"title": "Solid",
"type": "object",
"required": [
"__meta",
"artifactId",
"height",
"id",
"sketch",
"units",
"value"
],
"properties": {
"id": {
"description": "The id of the solid.",
"type": "string",
"format": "uuid"
},
"artifactId": {
"description": "The artifact ID of the solid. Unlike `id`, this doesn't change.",
"allOf": [
{
"$ref": "#/components/schemas/ArtifactId"
"title": "SolidSet",
"description": "A solid or a group of solids.",
"oneOf": [
{
"type": "object",
"required": [
"__meta",
"artifactId",
"height",
"id",
"sketch",
"type",
"units",
"value"
],
"properties": {
"type": {
"type": "string",
"enum": [
"solid"
]
},
"id": {
"description": "The id of the solid.",
"type": "string",
"format": "uuid"
},
"artifactId": {
"description": "The artifact ID of the solid. Unlike `id`, this doesn't change.",
"allOf": [
{
"$ref": "#/components/schemas/ArtifactId"
}
]
},
"value": {
"description": "The extrude surfaces.",
"type": "array",
"items": {
"$ref": "#/components/schemas/ExtrudeSurface"
}
},
"sketch": {
"description": "The sketch.",
"allOf": [
{
"$ref": "#/components/schemas/Sketch"
}
]
},
"height": {
"description": "The height of the solid.",
"type": "number",
"format": "double"
},
"startCapId": {
"description": "The id of the extrusion start cap",
"type": "string",
"format": "uuid",
"nullable": true
},
"endCapId": {
"description": "The id of the extrusion end cap",
"type": "string",
"format": "uuid",
"nullable": true
},
"edgeCuts": {
"description": "Chamfers or fillets on this solid.",
"type": "array",
"items": {
"$ref": "#/components/schemas/EdgeCut"
}
},
"units": {
"$ref": "#/components/schemas/UnitLen"
},
"__meta": {
"description": "Metadata.",
"type": "array",
"items": {
"$ref": "#/components/schemas/Metadata"
}
}
]
},
"value": {
"description": "The extrude surfaces.",
"type": "array",
"items": {
"$ref": "#/components/schemas/ExtrudeSurface"
}
},
"sketch": {
"description": "The sketch.",
"allOf": [
{
"$ref": "#/components/schemas/Sketch"
{
"type": [
"object",
"array"
],
"items": {
"$ref": "#/components/schemas/Solid"
},
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"enum": [
"solids"
]
}
]
},
"height": {
"description": "The height of the solid.",
"type": "number",
"format": "double"
},
"startCapId": {
"description": "The id of the extrusion start cap",
"type": "string",
"format": "uuid",
"nullable": true
},
"endCapId": {
"description": "The id of the extrusion end cap",
"type": "string",
"format": "uuid",
"nullable": true
},
"edgeCuts": {
"description": "Chamfers or fillets on this solid.",
"type": "array",
"items": {
"$ref": "#/components/schemas/EdgeCut"
}
},
"units": {
"$ref": "#/components/schemas/UnitLen"
},
"__meta": {
"description": "Metadata.",
"type": "array",
"items": {
"$ref": "#/components/schemas/Metadata"
}
}
},
],
"definitions": {
"ArtifactId": {
"type": "string",
@ -258850,7 +258914,8 @@
"box = startSketchOn('XY')\n |> startProfileAt([0, 0], %)\n |> line(end = [0, 20])\n |> line(end = [20, 0])\n |> line(end = [0, -20])\n |> close()\n |> extrude(length = 20)\n\nsketch001 = startSketchOn(box, \"END\")\n |> circle(center = [10, 10], radius = 4)\n |> revolve({ angle = -90, axis = 'y' }, %)",
"box = startSketchOn('XY')\n |> startProfileAt([0, 0], %)\n |> line(end = [0, 20])\n |> line(end = [20, 0])\n |> line(end = [0, -20], tag = $revolveAxis)\n |> close()\n |> extrude(length = 20)\n\nsketch001 = startSketchOn(box, \"END\")\n |> circle(center = [10, 10], radius = 4)\n |> revolve({\n angle = 90,\n axis = getOppositeEdge(revolveAxis)\n }, %)",
"box = startSketchOn('XY')\n |> startProfileAt([0, 0], %)\n |> line(end = [0, 20])\n |> line(end = [20, 0])\n |> line(end = [0, -20], tag = $revolveAxis)\n |> close()\n |> extrude(length = 20)\n\nsketch001 = startSketchOn(box, \"END\")\n |> circle(center = [10, 10], radius = 4)\n |> revolve({\n angle = 90,\n axis = getOppositeEdge(revolveAxis),\n tolerance = 0.0001\n }, %)",
"sketch001 = startSketchOn('XY')\n |> startProfileAt([10, 0], %)\n |> line(end = [5, -5])\n |> line(end = [5, 5])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\npart001 = revolve({\n axis = {\n custom = {\n axis = [0.0, 1.0],\n origin = [0.0, 0.0]\n }\n }\n}, sketch001)"
"sketch001 = startSketchOn('XY')\n |> startProfileAt([10, 0], %)\n |> line(end = [5, -5])\n |> line(end = [5, 5])\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\npart001 = revolve({\n axis = {\n custom = {\n axis = [0.0, 1.0],\n origin = [0.0, 0.0]\n }\n }\n}, sketch001)",
"// Revolve two sketches around the same axis.\n\n\nsketch001 = startSketchOn('XY')\nprofile001 = startProfileAt([4, 8], sketch001)\n |> xLine(length = 3)\n |> yLine(length = -3)\n |> xLine(length = -3)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\nprofile002 = startProfileAt([-5, 8], sketch001)\n |> xLine(length = 3)\n |> yLine(length = -3)\n |> xLine(length = -3)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\nrevolve({ axis = \"X\" }, [profile001, profile002])"
]
},
{
@ -304862,86 +304927,118 @@
{
"name": "sweep",
"summary": "Extrude a sketch along a path.",
"description": "This, like extrude, is able to create a 3-dimensional solid from a 2-dimensional sketch. However, unlike extrude, this creates a solid by using the extent of the sketch as its path. This is useful for creating more complex shapes that can't be created with a simple extrusion.",
"description": "This, like extrude, is able to create a 3-dimensional solid from a 2-dimensional sketch. However, unlike extrude, this creates a solid by using the extent of the sketch as its path. This is useful for creating more complex shapes that can't be created with a simple extrusion.\n\nYou can provide more than one sketch to sweep, and they will all be swept along the same path.",
"tags": [],
"keywordArguments": true,
"args": [
{
"name": "sketch",
"type": "Sketch",
"name": "sketchSet",
"type": "SketchSet",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
"title": "Sketch",
"type": "object",
"required": [
"__meta",
"artifactId",
"id",
"on",
"originalId",
"paths",
"start",
"units"
],
"properties": {
"id": {
"description": "The id of the sketch (this will change when the engine's reference to it changes).",
"type": "string",
"format": "uuid"
},
"paths": {
"description": "The paths in the sketch.",
"type": "array",
"items": {
"$ref": "#/components/schemas/Path"
}
},
"on": {
"description": "What the sketch is on (can be a plane or a face).",
"allOf": [
{
"$ref": "#/components/schemas/SketchSurface"
}
]
},
"start": {
"description": "The starting path.",
"allOf": [
{
"$ref": "#/components/schemas/BasePath"
}
]
},
"tags": {
"description": "Tag identifiers that have been declared in this sketch.",
"title": "SketchSet",
"description": "A sketch or a group of sketches.",
"oneOf": [
{
"type": "object",
"additionalProperties": {
"$ref": "#/components/schemas/TagIdentifier"
"required": [
"__meta",
"artifactId",
"id",
"on",
"originalId",
"paths",
"start",
"type",
"units"
],
"properties": {
"type": {
"type": "string",
"enum": [
"sketch"
]
},
"id": {
"description": "The id of the sketch (this will change when the engine's reference to it changes).",
"type": "string",
"format": "uuid"
},
"paths": {
"description": "The paths in the sketch.",
"type": "array",
"items": {
"$ref": "#/components/schemas/Path"
}
},
"on": {
"description": "What the sketch is on (can be a plane or a face).",
"allOf": [
{
"$ref": "#/components/schemas/SketchSurface"
}
]
},
"start": {
"description": "The starting path.",
"allOf": [
{
"$ref": "#/components/schemas/BasePath"
}
]
},
"tags": {
"description": "Tag identifiers that have been declared in this sketch.",
"type": "object",
"additionalProperties": {
"$ref": "#/components/schemas/TagIdentifier"
}
},
"artifactId": {
"description": "The original id of the sketch. This stays the same even if the sketch is is sketched on face etc.",
"allOf": [
{
"$ref": "#/components/schemas/ArtifactId"
}
]
},
"originalId": {
"type": "string",
"format": "uuid"
},
"units": {
"$ref": "#/components/schemas/UnitLen"
},
"__meta": {
"description": "Metadata.",
"type": "array",
"items": {
"$ref": "#/components/schemas/Metadata"
}
}
}
},
"artifactId": {
"description": "The original id of the sketch. This stays the same even if the sketch is is sketched on face etc.",
"allOf": [
{
"$ref": "#/components/schemas/ArtifactId"
}
]
},
"originalId": {
"type": "string",
"format": "uuid"
},
"units": {
"$ref": "#/components/schemas/UnitLen"
},
"__meta": {
"description": "Metadata.",
"type": "array",
{
"type": [
"object",
"array"
],
"items": {
"$ref": "#/components/schemas/Metadata"
"$ref": "#/components/schemas/Sketch"
},
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"enum": [
"sketches"
]
}
}
}
},
],
"definitions": {
"Path": {
"description": "A path.",
@ -306536,7 +306633,7 @@
},
"required": true,
"includeInSnippet": true,
"description": "The sketch that should be swept in space",
"description": "The sketch or set of sketches that should be swept in space",
"labelRequired": false
},
{
@ -311516,84 +311613,116 @@
],
"returnValue": {
"name": "",
"type": "Solid",
"type": "SolidSet",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
"title": "Solid",
"type": "object",
"required": [
"__meta",
"artifactId",
"height",
"id",
"sketch",
"units",
"value"
],
"properties": {
"id": {
"description": "The id of the solid.",
"type": "string",
"format": "uuid"
},
"artifactId": {
"description": "The artifact ID of the solid. Unlike `id`, this doesn't change.",
"allOf": [
{
"$ref": "#/components/schemas/ArtifactId"
"title": "SolidSet",
"description": "A solid or a group of solids.",
"oneOf": [
{
"type": "object",
"required": [
"__meta",
"artifactId",
"height",
"id",
"sketch",
"type",
"units",
"value"
],
"properties": {
"type": {
"type": "string",
"enum": [
"solid"
]
},
"id": {
"description": "The id of the solid.",
"type": "string",
"format": "uuid"
},
"artifactId": {
"description": "The artifact ID of the solid. Unlike `id`, this doesn't change.",
"allOf": [
{
"$ref": "#/components/schemas/ArtifactId"
}
]
},
"value": {
"description": "The extrude surfaces.",
"type": "array",
"items": {
"$ref": "#/components/schemas/ExtrudeSurface"
}
},
"sketch": {
"description": "The sketch.",
"allOf": [
{
"$ref": "#/components/schemas/Sketch"
}
]
},
"height": {
"description": "The height of the solid.",
"type": "number",
"format": "double"
},
"startCapId": {
"description": "The id of the extrusion start cap",
"type": "string",
"format": "uuid",
"nullable": true
},
"endCapId": {
"description": "The id of the extrusion end cap",
"type": "string",
"format": "uuid",
"nullable": true
},
"edgeCuts": {
"description": "Chamfers or fillets on this solid.",
"type": "array",
"items": {
"$ref": "#/components/schemas/EdgeCut"
}
},
"units": {
"$ref": "#/components/schemas/UnitLen"
},
"__meta": {
"description": "Metadata.",
"type": "array",
"items": {
"$ref": "#/components/schemas/Metadata"
}
}
]
},
"value": {
"description": "The extrude surfaces.",
"type": "array",
"items": {
"$ref": "#/components/schemas/ExtrudeSurface"
}
},
"sketch": {
"description": "The sketch.",
"allOf": [
{
"$ref": "#/components/schemas/Sketch"
{
"type": [
"object",
"array"
],
"items": {
"$ref": "#/components/schemas/Solid"
},
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"enum": [
"solids"
]
}
]
},
"height": {
"description": "The height of the solid.",
"type": "number",
"format": "double"
},
"startCapId": {
"description": "The id of the extrusion start cap",
"type": "string",
"format": "uuid",
"nullable": true
},
"endCapId": {
"description": "The id of the extrusion end cap",
"type": "string",
"format": "uuid",
"nullable": true
},
"edgeCuts": {
"description": "Chamfers or fillets on this solid.",
"type": "array",
"items": {
"$ref": "#/components/schemas/EdgeCut"
}
},
"units": {
"$ref": "#/components/schemas/UnitLen"
},
"__meta": {
"description": "Metadata.",
"type": "array",
"items": {
"$ref": "#/components/schemas/Metadata"
}
}
},
],
"definitions": {
"ArtifactId": {
"type": "string",
@ -313194,7 +313323,8 @@
"deprecated": false,
"examples": [
"// Create a pipe using a sweep.\n\n\n// Create a path for the sweep.\nsweepPath = startSketchOn('XZ')\n |> startProfileAt([0.05, 0.05], %)\n |> line(end = [0, 7])\n |> tangentialArc({ offset = 90, radius = 5 }, %)\n |> line(end = [-3, 0])\n |> tangentialArc({ offset = -90, radius = 5 }, %)\n |> line(end = [0, 7])\n\n// Create a hole for the pipe.\npipeHole = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 1.5)\n\nsweepSketch = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 2)\n |> hole(pipeHole, %)\n |> sweep(path = sweepPath)",
"// Create a spring by sweeping around a helix path.\n\n\n// Create a helix around the Z axis.\nhelixPath = helix(\n angleStart = 0,\n ccw = true,\n revolutions = 4,\n length = 10,\n radius = 5,\n axis = 'Z',\n)\n\n// Create a spring by sweeping around the helix path.\nspringSketch = startSketchOn('YZ')\n |> circle(center = [0, 0], radius = 1)\n |> sweep(path = helixPath)"
"// Create a spring by sweeping around a helix path.\n\n\n// Create a helix around the Z axis.\nhelixPath = helix(\n angleStart = 0,\n ccw = true,\n revolutions = 4,\n length = 10,\n radius = 5,\n axis = 'Z',\n)\n\n// Create a spring by sweeping around the helix path.\nspringSketch = startSketchOn('YZ')\n |> circle(center = [0, 0], radius = 1)\n |> sweep(path = helixPath)",
"// Sweep two sketches along the same path.\n\n\nsketch001 = startSketchOn('XY')\nrectangleSketch = startProfileAt([-200, 23.86], sketch001)\n |> angledLine([0, 73.47], %, $rectangleSegmentA001)\n |> angledLine([\n segAng(rectangleSegmentA001) - 90,\n 50.61\n ], %)\n |> angledLine([\n segAng(rectangleSegmentA001),\n -segLen(rectangleSegmentA001)\n ], %)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)\n\nsketch002 = startSketchOn('YZ')\nsweepPath = startProfileAt([0, 0], sketch002)\n |> yLine(length = 231.81)\n |> tangentialArc({ radius = 80, offset = -90 }, %)\n |> xLine(length = 384.93)\n\nsweep([rectangleSketch, circleSketch], path = sweepPath)"
]
},
{

File diff suppressed because one or more lines are too long