* Parse an unparse type decls (and refactor impl attributes slightly) Signed-off-by: Nick Cameron <nrc@ncameron.org> * Remove special treatment of geometric types from parser and executor Signed-off-by: Nick Cameron <nrc@ncameron.org> * Generate docs for std types Signed-off-by: Nick Cameron <nrc@ncameron.org> * Hover tool-tips for types and fixup the frontend Signed-off-by: Nick Cameron <nrc@ncameron.org> * Fixes Signed-off-by: Nick Cameron <nrc@ncameron.org> --------- Signed-off-by: Nick Cameron <nrc@ncameron.org>
		
			
				
	
	
		
			63 lines
		
	
	
		
			80 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			63 lines
		
	
	
		
			80 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
---
 | 
						|
title: "line"
 | 
						|
excerpt: "Extend the current sketch with a new straight line."
 | 
						|
layout: manual
 | 
						|
---
 | 
						|
 | 
						|
Extend the current sketch with a new straight line.
 | 
						|
 | 
						|
 | 
						|
 | 
						|
```js
 | 
						|
line(
 | 
						|
  sketch: Sketch,
 | 
						|
  endAbsolute?: [number],
 | 
						|
  end?: [number],
 | 
						|
  tag?: TagDeclarator,
 | 
						|
): Sketch
 | 
						|
```
 | 
						|
 | 
						|
 | 
						|
### Arguments
 | 
						|
 | 
						|
| Name | Type | Description | Required |
 | 
						|
|----------|------|-------------|----------|
 | 
						|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | Which sketch should this path be added to? | Yes |
 | 
						|
| `endAbsolute` | [`[number]`](/docs/kcl/types/number) | Which absolute point should this line go to? Incompatible with `end`. | No |
 | 
						|
| `end` | [`[number]`](/docs/kcl/types/number) | How far away (along the X and Y axes) should this line go? Incompatible with `endAbsolute`. | No |
 | 
						|
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No |
 | 
						|
 | 
						|
### Returns
 | 
						|
 | 
						|
[`Sketch`](/docs/kcl/types/Sketch)
 | 
						|
 | 
						|
 | 
						|
### Examples
 | 
						|
 | 
						|
```js
 | 
						|
triangle = startSketchOn(XZ)
 | 
						|
  |> startProfileAt([0, 0], %)
 | 
						|
  // The 'end' argument means it ends at exactly [10, 0].
 | 
						|
  // This is an absolute measurement, it is NOT relative to
 | 
						|
  // the start of the sketch.
 | 
						|
  |> line(endAbsolute = [10, 0])
 | 
						|
  |> line(endAbsolute = [0, 10])
 | 
						|
  |> line(endAbsolute = [-10, 0], tag = $thirdLineOfTriangle)
 | 
						|
  |> close()
 | 
						|
  |> extrude(length = 5)
 | 
						|
 | 
						|
box = startSketchOn(XZ)
 | 
						|
  |> startProfileAt([10, 10], %)
 | 
						|
  // The 'to' argument means move the pen this much.
 | 
						|
  // So, [10, 0] is a relative distance away from the current point.
 | 
						|
  |> line(end = [10, 0])
 | 
						|
  |> line(end = [0, 10])
 | 
						|
  |> line(end = [-10, 0], tag = $thirdLineOfBox)
 | 
						|
  |> close()
 | 
						|
  |> extrude(length = 5)
 | 
						|
```
 | 
						|
 | 
						|

 | 
						|
 | 
						|
 |