* Show more info on hover for variables Signed-off-by: Nick Cameron <nrc@ncameron.org> * Move hover impls to lsp module Signed-off-by: Nick Cameron <nrc@ncameron.org> * Make hover work on names inside calls, fix doc line breaking, trim docs in tool tips Signed-off-by: Nick Cameron <nrc@ncameron.org> * Test the new hovers; fix signature syntax Signed-off-by: Nick Cameron <nrc@ncameron.org> * Hover tips for kwargs Signed-off-by: Nick Cameron <nrc@ncameron.org> --------- Signed-off-by: Nick Cameron <nrc@ncameron.org>
		
			
				
	
	
		
			112 lines
		
	
	
		
			214 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			112 lines
		
	
	
		
			214 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
---
 | 
						|
title: "patternLinear3d"
 | 
						|
excerpt: "Repeat a 3-dimensional solid along a linear path, with a dynamic amount of distance between each repetition, some specified number of times."
 | 
						|
layout: manual
 | 
						|
---
 | 
						|
 | 
						|
Repeat a 3-dimensional solid along a linear path, with a dynamic amount of distance between each repetition, some specified number of times.
 | 
						|
 | 
						|
///
 | 
						|
 | 
						|
```js
 | 
						|
patternLinear3d(
 | 
						|
  solidSet: SolidSet,
 | 
						|
  instances: integer,
 | 
						|
  distance: number,
 | 
						|
  axis: [number],
 | 
						|
  useOriginal?: bool,
 | 
						|
): [Solid]
 | 
						|
```
 | 
						|
 | 
						|
 | 
						|
### Arguments
 | 
						|
 | 
						|
| Name | Type | Description | Required |
 | 
						|
|----------|------|-------------|----------|
 | 
						|
| `solidSet` | [`SolidSet`](/docs/kcl/types/SolidSet) | The solid(s) to duplicate | Yes |
 | 
						|
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
 | 
						|
| `distance` | `number` | Distance between each repetition. Also known as 'spacing'. | Yes |
 | 
						|
| `axis` | `[number]` | The axis of the pattern. A 2D vector. | Yes |
 | 
						|
| `useOriginal` | `bool` | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
 | 
						|
 | 
						|
### Returns
 | 
						|
 | 
						|
[`[Solid]`](/docs/kcl/types/Solid)
 | 
						|
 | 
						|
 | 
						|
### Examples
 | 
						|
 | 
						|
```js
 | 
						|
exampleSketch = startSketchOn('XZ')
 | 
						|
  |> startProfileAt([0, 0], %)
 | 
						|
  |> line(end = [0, 2])
 | 
						|
  |> line(end = [3, 1])
 | 
						|
  |> line(end = [0, -4])
 | 
						|
  |> close()
 | 
						|
 | 
						|
example = extrude(exampleSketch, length = 1)
 | 
						|
  |> patternLinear3d(axis = [1, 0, 1], instances = 7, distance = 6)
 | 
						|
```
 | 
						|
 | 
						|

 | 
						|
 | 
						|
```js
 | 
						|
// Pattern a whole sketch on face.
 | 
						|
size = 100
 | 
						|
case = startSketchOn('XY')
 | 
						|
  |> startProfileAt([-size, -size], %)
 | 
						|
  |> line(end = [2 * size, 0])
 | 
						|
  |> line(end = [0, 2 * size])
 | 
						|
  |> tangentialArcTo([-size, size], %)
 | 
						|
  |> close(%)
 | 
						|
  |> extrude(length = 65)
 | 
						|
 | 
						|
thing1 = startSketchOn(case, 'end')
 | 
						|
  |> circle(center = [-size / 2, -size / 2], radius = 25)
 | 
						|
  |> extrude(length = 50)
 | 
						|
 | 
						|
thing2 = startSketchOn(case, 'end')
 | 
						|
  |> circle(center = [size / 2, -size / 2], radius = 25)
 | 
						|
  |> extrude(length = 50)
 | 
						|
 | 
						|
  // We pass in the "case" here since we want to pattern the whole sketch.
 | 
						|
// And the case was the base of the sketch.
 | 
						|
patternLinear3d(
 | 
						|
  case,
 | 
						|
  axis = [1, 0, 0],
 | 
						|
  distance = 250,
 | 
						|
  instances = 2,
 | 
						|
)
 | 
						|
```
 | 
						|
 | 
						|

 | 
						|
 | 
						|
```js
 | 
						|
// Pattern an object on a face.
 | 
						|
size = 100
 | 
						|
case = startSketchOn('XY')
 | 
						|
  |> startProfileAt([-size, -size], %)
 | 
						|
  |> line(end = [2 * size, 0])
 | 
						|
  |> line(end = [0, 2 * size])
 | 
						|
  |> tangentialArcTo([-size, size], %)
 | 
						|
  |> close(%)
 | 
						|
  |> extrude(length = 65)
 | 
						|
 | 
						|
thing1 = startSketchOn(case, 'end')
 | 
						|
  |> circle(center = [-size / 2, -size / 2], radius = 25)
 | 
						|
  |> extrude(length = 50)
 | 
						|
 | 
						|
// We pass in `thing1` here with `useOriginal` since we want to pattern just this object on the face.
 | 
						|
patternLinear3d(
 | 
						|
  thing1,
 | 
						|
  axis = [1, 0, 0],
 | 
						|
  distance = size,
 | 
						|
  instances = 2,
 | 
						|
  useOriginal = true,
 | 
						|
)
 | 
						|
```
 | 
						|
 | 
						|

 | 
						|
 | 
						|
 |