Next: , Previous: Arcs, Up: Core object functions


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 gEDA are:

— Function: path? object

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

— 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))