Adds new stdlib functions segStart, segStartX, segStartY, segEnd Part of <https://github.com/KittyCAD/modeling-app/issues/4382>
		
			
				
	
	
		
			54 lines
		
	
	
		
			88 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			54 lines
		
	
	
		
			88 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
---
 | 
						|
title: "segEnd"
 | 
						|
excerpt: "Compute the ending point of the provided line segment."
 | 
						|
layout: manual
 | 
						|
---
 | 
						|
 | 
						|
Compute the ending point of the provided line segment.
 | 
						|
 | 
						|
 | 
						|
 | 
						|
```js
 | 
						|
segEnd(tag: TagIdentifier) -> [number]
 | 
						|
```
 | 
						|
 | 
						|
 | 
						|
### Arguments
 | 
						|
 | 
						|
| Name | Type | Description | Required |
 | 
						|
|----------|------|-------------|----------|
 | 
						|
| `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) |  | Yes |
 | 
						|
 | 
						|
### Returns
 | 
						|
 | 
						|
`[number]` 
 | 
						|
 | 
						|
 | 
						|
### Examples
 | 
						|
 | 
						|
```js
 | 
						|
w = 15
 | 
						|
cube = startSketchAt([0, 0])
 | 
						|
  |> line([w, 0], %, $line1)
 | 
						|
  |> line([0, w], %, $line2)
 | 
						|
  |> line([-w, 0], %, $line3)
 | 
						|
  |> line([0, -w], %, $line4)
 | 
						|
  |> close(%)
 | 
						|
  |> extrude(5, %)
 | 
						|
 | 
						|
fn cylinder = (radius, tag) => {
 | 
						|
  return startSketchAt([0, 0])
 | 
						|
  |> circle({ radius: radius, center: segEnd(tag) }, %)
 | 
						|
  |> extrude(radius, %)
 | 
						|
}
 | 
						|
 | 
						|
cylinder(1, line1)
 | 
						|
cylinder(2, line2)
 | 
						|
cylinder(3, line3)
 | 
						|
cylinder(4, line4)
 | 
						|
```
 | 
						|
 | 
						|

 | 
						|
 | 
						|
 |