106 lines
296 KiB
Markdown
106 lines
296 KiB
Markdown
---
|
|
title: "tangentToEnd"
|
|
excerpt: "Returns the angle coming out of the end of the segment in degrees."
|
|
layout: manual
|
|
---
|
|
|
|
Returns the angle coming out of the end of the segment in degrees.
|
|
|
|
|
|
|
|
```js
|
|
tangentToEnd(tag: TagIdentifier) -> number
|
|
```
|
|
|
|
|
|
### Arguments
|
|
|
|
| Name | Type | Description | Required |
|
|
|----------|------|-------------|----------|
|
|
| `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
|
|
|
|
### Returns
|
|
|
|
`number`
|
|
|
|
|
|
### Examples
|
|
|
|
```js
|
|
// Horizontal pill.
|
|
pillSketch = startSketchOn('XZ')
|
|
|> startProfileAt([0, 0], %)
|
|
|> line([20, 0], %)
|
|
|> tangentialArcToRelative([0, 10], %, $arc1)
|
|
|> angledLine({
|
|
angle = tangentToEnd(arc1),
|
|
length = 20
|
|
}, %)
|
|
|> tangentialArcToRelative([0, -10], %)
|
|
|> close(%)
|
|
|
|
pillExtrude = extrude(10, pillSketch)
|
|
```
|
|
|
|

|
|
|
|
```js
|
|
// Vertical pill. Use absolute coordinate for arc.
|
|
pillSketch = startSketchOn('XZ')
|
|
|> startProfileAt([0, 0], %)
|
|
|> line([0, 20], %)
|
|
|> tangentialArcTo([10, 20], %, $arc1)
|
|
|> angledLine({
|
|
angle = tangentToEnd(arc1),
|
|
length = 20
|
|
}, %)
|
|
|> tangentialArcToRelative([-10, 0], %)
|
|
|> close(%)
|
|
|
|
pillExtrude = extrude(10, pillSketch)
|
|
```
|
|
|
|

|
|
|
|
```js
|
|
rectangleSketch = startSketchOn('XZ')
|
|
|> startProfileAt([0, 0], %)
|
|
|> line([10, 0], %, $seg1)
|
|
|> angledLine({
|
|
angle = tangentToEnd(seg1),
|
|
length = 10
|
|
}, %)
|
|
|> line([0, 10], %)
|
|
|> line([-20, 0], %)
|
|
|> close(%)
|
|
|
|
rectangleExtrude = extrude(10, rectangleSketch)
|
|
```
|
|
|
|

|
|
|
|
```js
|
|
bottom = startSketchOn("XY")
|
|
|> startProfileAt([0, 0], %)
|
|
|> arcTo({ end = [10, 10], interior = [5, 1] }, %, $arc1)
|
|
|> angledLine([tangentToEnd(arc1), 20], %)
|
|
|> close(%)
|
|
```
|
|
|
|

|
|
|
|
```js
|
|
circSketch = startSketchOn("XY")
|
|
|> circle({ center = [0, 0], radius = 3 }, %, $circ)
|
|
|
|
triangleSketch = startSketchOn("XY")
|
|
|> startProfileAt([-5, 0], %)
|
|
|> angledLine([tangentToEnd(circ), 10], %)
|
|
|> line([-15, 0], %)
|
|
|> close(%)
|
|
```
|
|
|
|

|
|
|
|
|