Make the function signature less prominent, add an early example to docs

Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
Nick Cameron
2025-06-19 17:08:46 +12:00
parent 6358eed7e4
commit ff1be99351
99 changed files with 2137 additions and 686 deletions

View File

@ -8,18 +8,21 @@ layout: manual
Clone a sketch or solid.
```kcl
clone(@geometry: Sketch | Solid | ImportedGeometry): Sketch | Solid | ImportedGeometry
// Clone a basic sketch and move it and extrude it.
exampleSketch = startSketchOn(XY)
|> startProfile(at = [0, 0])
|> line(end = [10, 0])
|> line(end = [0, 10])
|> line(end = [-10, 0])
|> close()
clonedSketch = clone(exampleSketch)
|> scale(x = 1.0, y = 1.0, z = 2.5)
|> translate(x = 15.0, y = 0, z = 0)
|> extrude(length = 5)
```
This works essentially like a copy-paste operation. It creates a perfect replica
at that point in time that you can manipulate individually afterwards.
This doesn't really have much utility unless you need the equivalent of a double
instance pattern with zero transformations.
Really only use this function if YOU ARE SURE you need it. In most cases you
do not need clone and using a pattern with `instance = 2` is more appropriate.
### Arguments
| Name | Type | Description | Required |
@ -30,6 +33,22 @@ do not need clone and using a pattern with `instance = 2` is more appropriate.
[`Sketch`](/docs/kcl-std/types/std-types-Sketch) or [`Solid`](/docs/kcl-std/types/std-types-Solid) or [`ImportedGeometry`](/docs/kcl-std/types/std-types-ImportedGeometry)
### Description
This works essentially like a copy-paste operation. It creates a perfect replica
at that point in time that you can manipulate individually afterwards.
This doesn't really have much utility unless you need the equivalent of a double
instance pattern with zero transformations.
Really only use this function if YOU ARE SURE you need it. In most cases you
do not need clone and using a pattern with `instance = 2` is more appropriate.
### Function signature
```kcl
clone(@geometry: Sketch | Solid | ImportedGeometry): Sketch | Solid | ImportedGeometry
```
### Examples