Functions List
Selectors and Recognizers
• all-shapes
The function all-shapes
returns a list of all the
shapes present in the CAD environment. If there are no shapes the function returns
an empty list.
Parameters:
n/a
Syntax:
(all-shapes)
Example:
> (all-shapes)
'()
> (mirror (cone-frustum (xyz 0 0 0) 5 5 3) (+z (xyz 0 0 0) 5))
> (all-shapes)
#<cone-frustum 1>
'(#<solid 2> #<solid 3>)
• delete-all-shapes
The function delete-all-shapes
eliminates all the
shapes present in the CAD environment, returning the number of shapes that were
deleted.
Parameters:
n/a
Syntax:
(delete-all-shapes)
Example:
> (circle (xyz 0 0 0) 5)
#<circle 0>
> (delete-all-shapes)
1
• circle-center
The function circle-center
returns the coordinates
of the given circle.
Parameters:
circle – Circle from which to extract the centre coordinates
Syntax:
(circle-center circle)
Example:
> (circle-center (circle (xy 2 5) 3))
#<xyz:2.0 5.0 0.0>
• circle-radius
The function circle-radius
returns the radius value
of the given circle.
Parameters:
circle – Circle from which to extract the radius value
Syntax:
(circle-radius circle)
Example:
> (circle-radius (circle (xy 2 5) 3))
3.0
• sphere-center
The function sphere-center
returns the coordinates
of the given sphere. This function is only available in Rhino.
Parameters:
sphere – Sphere from which to extract the centre coordinates
Syntax:
(sphere-center sphere)
Example:
> (sphere-center (sphere (xyz 2 5 10) 3))
#<xyz:2.0 5.0 10.0>
• sphere-radius
The function sphere-radius
returns the radius value
of the given sphere. This function is only available in Rhino.
Parameters:
sphere – Sphere from which to extract the radius value
Syntax:
(sphere-radius sphere)
Example:
> (sphere-center (sphere (xyz 2 5 10) 3))
3.0
• point-position
The function point-position
coordinates of a given
point.
Parameters:
point – Point from which to extract the coordinates
Syntax:
(point-position point)
Example:
> (point-position (point (xyz 1 3 5)))
#<xyz:1.0 3.0 5.0>
• line-vertices
The function line-vertices
returns a list of vertex
coordinates of a given line segment.
Parameters:
line – Line from which to extract the vertex coordinates
Syntax:
(line-vertices line)
Example:
> (line-vertices (line (xy 0 0) (xy 3 3)))
'(#<xyz:0.0 0.0 0.0> #<xyz:3.0 3.0 0.0>)
• bounding-box
The function bounding-box
returns the coordinates
of the two opposite corners of the box within which the given shape is contained.
Parameters:
shape – Shape to determine the bounding box
Syntax:
(bounding-box shape)
Example:
> (bounding-box (sphere (xy 0 0) 10))
<bbox: #<xyz:-10.0 -10.0 -10.0> #<xyz:10.0 10.0 10.0>>
• point?
The function point?
tests if the given shape is a
point, returning #t if it is and #f if not.
Parameters:
shape – Shape to test
Syntax:
(point? shape)
Example:
> (point? (point (xyz 1 1 5)))
#t
> (point? (circle (xyz 0 0 0) 3))
#f
• circle?
The function circle?
tests if the given shape is
a circle, returning #t if it is and #f if not.
Parameters:
shape – Shape to test
Syntax:
(circle? shape)
Example:
> (circle? (point (xyz 1 1 5)))
#f
> (circle? (circle (xyz 0 0 0) 3))
#t
• line?
The function line?
tests if the given shape is a
line, returning #t if it is and #f if not.
Parameters:
shape – Shape to test
Syntax:
(line? shape)
Example:
> (line? (point (xyz 1 1 5)))
#f
> (line? (line (list (xy 0 0) (xy 3 5) (xy -1 8))))
#t
• closed-line?
The function closed-line?
tests if the given shape
is a closed line, returning #t if it is and #f if not. Note that polygons, circles,
or other closed shapes created by other means than the
closed-line
function will not be identified as a closed line.
Parameters:
shape – Shape to test
Syntax:
(closed-line? shape)
Example:
> (closed-line? (line (list (xy 0 0) (xy 3 5) (xy -1 8))))
#f
> (closed-line? (line (list (xy 0 0) (xy 10 0) (xy 10 10) (xy 0 10) (xy 0 0))))
#f
> (closed-line? (circle (xyz 0 0 0) 10))
#f
> (closed-line? (closed-line (list (xy 0 0) (xy 10 0) (xy 10 10) (xy 0 10))))
#t
• spline?
The function spline?
tests if the given shape is a
spline, returning #t if it is and #f if not.
Parameters:
shape – Shape to test
Syntax:
(spline? shape)
Example:
> (spline? (closed-line (xy 1 3) (xy 0 4) (xy -5 3)))
#f
> (spline? (spline (xy 0 0) (xy 0 5) (xy 4 -9) (xy 1 3)))
#t
• closed-spline?
The function closed-spline?
tests if the given
shape is a closed spline, returning #t if it is and #f if not. Note that polygons,
circles, or other closed shapes created by other means than the
closed-spline
function will not be identified as a closed line.
Parameters:
shape – Shape to test
Syntax:
(closed-spline? shape)
Example:
> (closed-spline? (spline (list (xy 0 0) (xy 3 5) (xy -1 8))))
#f
> (closed-spline? (closed-spline (list (xy 0 0) (xy 10 0) (xy 10 10) (xy 0 10))))
#t
• surface?
The function surface?
tests if the given shape is
a surface, returning #t if it is and #f if not. Note that what is being tested is
if the CAD software identifies the given shape as a surface, i.e., if the returned
result of a given surface is identified as such.
Parameters:
shape – Shape to test
Syntax:
(surface? shape)
Example:
> (circle (xy 0 0) 10)
> (surface? (circle (xy 0 0) 10))
#<circle 0>
#f
> (surface-rectangle (xy 0 0) (xy 3 5))
> (surface? (surface-rectangle (xy 0 0) (xy 3 5)))
#<surface-rectangle 0>
#f
> (surface (rectangle (xy 0 0) (xy 5 5)))
> (surface? (surface (rectangle (xy 0 0) (xy 5 5))))
#<surface-rectangle 0>
#<surface 1>
#t
• solid?
The function solid?
tests if the given shape is a
solid, returning #t if it is and #f if not. Note that what is being tested is if
the CAD software identifies the given shape as a solid, i.e., if the returned result
of a given solid is identified as such.
Parameters:
shape – Shape to test
Syntax:
(solid? shape)
Example:
> (surface-circle (xy 0 0) 8)
> (solid? (surface-circle (xy 0 0) 8))
#<surface-circle 0>
#f
> (box (xyz 0 0 0) (xyz 2 2 8))
> (solid? (box (xyz 0 0 0) (xyz 2 2 8)))
#<box 0>
#f