Paths (Lepton EDA Scheme Reference Manual 1.9.18)

Next: Pictures, Previous: Arcs, Up: Core object functions [Contents][Index]

#### 2.2.8 Paths

Paths are arbitrary shapes comprised of straight lines and Bézier curves. Each path contains a sequence of path elements, each of which requires zero or more absolute position parameters. The element types supported by Lepton are:

- ‘`moveto`’ elements represent a step (without drawing) to another point in the schematic, and begin a new subpath. ‘`moveto`’ elements need a single position parameter, which is the position of the endpoint of the move.
- ‘`lineto`’ elements draw a straight line from the current point to the point specified by a single position parameter.
- ‘`curveto`’ elements draw a Bézier curve from the current point. The curve requires three position parameters: the position of the first control point; the position of the second control point; and the endpoint of the curve.
- ‘`closepath`’ elements close the current subpath by drawing a straight line from the current point to the subpath’s initial point. They take no parameters.

Function: path? object ¶

  Returns ‘`#t`’ if and only if object is a path `object`.

Function: make-path [color] ¶

  Creates and returns a new path `object`. If color is specified, it should be the integer color map index of the color with which to draw the path. If color is not specified, the default path color is used.

Function: path-length path ¶

  Returns the number of path elements in path.

Function: path-ref path K ¶

  Returns the Kth element in path. The return value is a list. The first item in the list is a symbol indicating the type of element, and any additional items are the position parameters of the element. For example, a call to `path-ref` might return:

      (curveto (800 . 525) (700 . 700) (500 . 700))

  If K is not a valid offset into path, raises an ‘`out-of-range`’ error.

Function: path-remove! path K ¶

  Removes the Kth element in path, returning path. If K is not a valid offset, raises an ‘`out-of-range`’ error.

Function: path-insert! path K type [positions...] ¶

  Inserts a new element into path at index K. type is a symbol indicating the type of element to insert, using the parameters positions. If K is less than zero or greater than the number of elements path already contains, the new element is appended to the path. For example, to append a straight line section to the current path:

      (path-insert! path -1 'lineto '(500 . 100))

Next: Pictures, Previous: Arcs, Up: Core object functions [Contents][Index]