* fix docs paths for website Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix docs paths for website Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com>
103 lines
440 KiB
Markdown
103 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
|
|
```
|
|
|
|
|
|
### Arguments
|
|
|
|
| Name | Type | Description | Required |
|
|
|----------|------|-------------|----------|
|
|
| `std_plane` | [`StandardPlane`](/docs/kcl/types/StandardPlane) | One of the standard planes. | Yes |
|
|
| `offset` | `number` | | Yes |
|
|
|
|
### Returns
|
|
|
|
[`PlaneData`](/docs/kcl/types/PlaneData) - Data for a plane.
|
|
|
|
|
|
### 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])
|
|
```
|
|
|
|

|
|
|
|
|