Files
modeling-app/docs/kcl/scale.md
Nick Cameron 5d25f4a0e5 Support types in the standard library (#5651)
* 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>
2025-03-07 09:53:34 -05:00

80 KiB

title, excerpt, layout
title excerpt layout
scale Scale a solid. manual

Scale a solid.

By default the transform is applied in local sketch axis, therefore the origin will not move.

If you want to apply the transform in global space, set global to true. The origin of the model will move. If the model is not centered on origin and you scale globally it will look like the model moves and gets bigger at the same time. Say you have a square (1,1) - (1,2) - (2,2) - (2,1) and you scale by 2 globally it will become (2,2) - (2,4)...etc so the origin has moved from (1.5, 1.5) to (2,2).

scale(
  solid: Solid,
  scale: [number],
  global?: bool,
): Solid

Arguments

Name Type Description Required
solid Solid The solid to scale. Yes
scale [number] The scale factor for the x, y, and z axes. Yes
global bool If true, the transform is applied in global space. The origin of the model will move. By default, the transform is applied in local sketch axis, therefore the origin will not move. No

Returns

Solid

Examples

// Scale a pipe.


// Create a path for the sweep.
sweepPath = startSketchOn('XZ')
  |> startProfileAt([0.05, 0.05], %)
  |> line(end = [0, 7])
  |> tangentialArc({ offset = 90, radius = 5 }, %)
  |> line(end = [-3, 0])
  |> tangentialArc({ offset = -90, radius = 5 }, %)
  |> line(end = [0, 7])

// Create a hole for the pipe.
pipeHole = startSketchOn('XY')
  |> circle(center = [0, 0], radius = 1.5)

sweepSketch = startSketchOn('XY')
  |> circle(center = [0, 0], radius = 2)
  |> hole(pipeHole, %)
  |> sweep(path = sweepPath)
  |> scale(scale = [1.0, 1.0, 2.5])

Rendered example of scale 0