Files
modeling-app/docs/kcl-std/patternLinear2d.md
Jess Frazelle 658497da1d Allow same syntax for patterns as mirror revolve (#7054)
* allow named axis for patterns

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* docs

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* images

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* Fix typo

Co-authored-by: Jonathan Tran <jonnytran@gmail.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: Adam Chalmers <adam.chalmers@zoo.dev>
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2025-05-19 02:25:35 +00:00

126 KiB

title, subtitle, excerpt, layout
title subtitle excerpt layout
patternLinear2d Function in std Repeat a 2-dimensional sketch along some dimension, with a dynamic amount of distance between each repetition, some specified number of times. manual

Repeat a 2-dimensional sketch along some dimension, with a dynamic amount of distance between each repetition, some specified number of times.

patternLinear2d(
  @sketches: [Sketch],
  instances: number,
  distance: number,
  axis: Point2d,
  useOriginal?: bool,
): [Sketch]

Arguments

Name Type Description Required
sketches [Sketch] The sketch(es) to duplicate Yes
instances number 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 Point2d 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

[Sketch]

Examples

// / Pattern using a named axis.


exampleSketch = startSketchOn(XZ)
  |> circle(center = [0, 0], radius = 1)
  |> patternLinear2d(axis = X, instances = 7, distance = 4)

example = extrude(exampleSketch, length = 1)

Rendered example of patternLinear2d 0

// / Pattern using a raw axis.


exampleSketch = startSketchOn(XZ)
  |> circle(center = [0, 0], radius = 1)
  |> patternLinear2d(axis = [1, 0], instances = 7, distance = 4)

example = extrude(exampleSketch, length = 1)

Rendered example of patternLinear2d 1