Files
modeling-app/docs/kcl/segStart.md
Nick Cameron 3139e18dc7 Make = and => optional in function declarations (#4577)
* Make `=` and `=>` optional in function declarations

And requires `:` for return types

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Tests

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Format types in function decls

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Require  in anon function decls

Signed-off-by: Nick Cameron <nrc@ncameron.org>

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
2024-11-27 15:46:58 +13:00

82 KiB

title, excerpt, layout
title excerpt layout
segStart Compute the starting point of the provided line segment. manual

Compute the starting point of the provided line segment.

segStart(tag: TagIdentifier) -> [number]

Arguments

Name Type Description Required
tag TagIdentifier Yes

Returns

[number]

Examples

w = 15
cube = startSketchAt([0, 0])
  |> line([w, 0], %, $line1)
  |> line([0, w], %, $line2)
  |> line([-w, 0], %, $line3)
  |> line([0, -w], %, $line4)
  |> close(%)
  |> extrude(5, %)

fn cylinder(radius, tag) {
  return startSketchAt([0, 0])
    |> circle({
         radius = radius,
         center = segStart(tag)
       }, %)
    |> extrude(radius, %)
}

cylinder(1, line1)
cylinder(2, line2)
cylinder(3, line3)
cylinder(4, line4)

Rendered example of segStart 0