* circle * fix another example * fix bad comment * toPoint fix * cargo fmt * resolve most of the tests * fix last test * missed circle in bracket * remove console error * fmt * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest) * trigger ci * remove three dot menu for circle * make sure circle can be extruded * fix up after merge * add extrude test for circle * clean up * typo * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest) * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest)" This reverts commit03f8eeb542
. * update docs again * cmd bar test serialisation improvements * tiny clean up * fix after: Replace kittycad crate with kittycad-modeling-cmds * fmt * rename fix * Update src/lib/toolbar.ts Co-authored-by: Frank Noirot <frank@zoo.dev> * add another error to list * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * image updates * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest)" This reverts commit505bb20bea
. * update markdown * skip un reproducable windows test failure * rust review * leave issue todo comment --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Frank Noirot <frank@zoo.dev>
139 lines
440 KiB
Markdown
139 lines
440 KiB
Markdown
---
|
||
title: "offsetPlane"
|
||
excerpt: "Offset a plane by a distance along its normal."
|
||
layout: manual
|
||
---
|
||
|
||
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
|
||
```
|
||
|
||
### Examples
|
||
|
||
```js
|
||
// Loft a square and a circle on the `XY` plane using offset.
|
||
const squareSketch = startSketchOn('XY')
|
||
|> startProfileAt([-100, 200], %)
|
||
|> line([200, 0], %)
|
||
|> line([0, -200], %)
|
||
|> line([-200, 0], %)
|
||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||
|> close(%)
|
||
|
||
const circleSketch = startSketchOn(offsetPlane('XY', 150))
|
||
|> circle({ center: [0, 100], radius: 50 }, %)
|
||
|
||
loft([squareSketch, circleSketch])
|
||
```
|
||
|
||

|
||
|
||
```js
|
||
// Loft a square and a circle on the `XZ` plane using offset.
|
||
const squareSketch = startSketchOn('XZ')
|
||
|> startProfileAt([-100, 200], %)
|
||
|> line([200, 0], %)
|
||
|> line([0, -200], %)
|
||
|> line([-200, 0], %)
|
||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||
|> close(%)
|
||
|
||
const circleSketch = startSketchOn(offsetPlane('XZ', 150))
|
||
|> circle({ center: [0, 100], radius: 50 }, %)
|
||
|
||
loft([squareSketch, circleSketch])
|
||
```
|
||
|
||

|
||
|
||
```js
|
||
// Loft a square and a circle on the `YZ` plane using offset.
|
||
const squareSketch = startSketchOn('YZ')
|
||
|> startProfileAt([-100, 200], %)
|
||
|> line([200, 0], %)
|
||
|> line([0, -200], %)
|
||
|> line([-200, 0], %)
|
||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||
|> close(%)
|
||
|
||
const circleSketch = startSketchOn(offsetPlane('YZ', 150))
|
||
|> circle({ center: [0, 100], radius: 50 }, %)
|
||
|
||
loft([squareSketch, circleSketch])
|
||
```
|
||
|
||

|
||
|
||
```js
|
||
// Loft a square and a circle on the `-XZ` plane using offset.
|
||
const squareSketch = startSketchOn('-XZ')
|
||
|> startProfileAt([-100, 200], %)
|
||
|> line([200, 0], %)
|
||
|> line([0, -200], %)
|
||
|> line([-200, 0], %)
|
||
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||
|> close(%)
|
||
|
||
const circleSketch = startSketchOn(offsetPlane('-XZ', -150))
|
||
|> circle({ center: [0, 100], radius: 50 }, %)
|
||
|
||
loft([squareSketch, circleSketch])
|
||
```
|
||
|
||

|
||
|
||
### Arguments
|
||
|
||
* `std_plane`: `StandardPlane` - One of the standard planes. (REQUIRED)
|
||
```js
|
||
"XY" | "-XY" | "XZ" | "-XZ" | "YZ" | "-YZ"
|
||
```
|
||
* `offset`: `number` (REQUIRED)
|
||
|
||
### Returns
|
||
|
||
`PlaneData` - Data for a plane.
|
||
```js
|
||
"XY" |
|
||
"-XY" |
|
||
"XZ" |
|
||
"-XZ" |
|
||
"YZ" |
|
||
"-YZ" |
|
||
{
|
||
plane: {
|
||
// Origin of the plane.
|
||
origin: {
|
||
x: number,
|
||
y: number,
|
||
z: number,
|
||
},
|
||
// What should the plane’s X axis be?
|
||
xAxis: {
|
||
x: number,
|
||
y: number,
|
||
z: number,
|
||
},
|
||
// What should the plane’s Y axis be?
|
||
yAxis: {
|
||
x: number,
|
||
y: number,
|
||
z: number,
|
||
},
|
||
// The z-axis (normal).
|
||
zAxis: {
|
||
x: number,
|
||
y: number,
|
||
z: number,
|
||
},
|
||
},
|
||
}
|
||
```
|
||
|
||
|
||
|