Functions List


Transformations


copy-shape

The function copy-shape creates a duplicate of a given shape. If no translation distance is given the copied geometry will be placed overlapping the original.

Parameters:

shape – Shape to copy
d – Translation distance

Syntax:

(copy-shape shape [d 0])

Example:

> (copy-shape (sphere (xyz 0 0 0) 10))
#<sphere 1>



copy-shapes

The function copy-shapes creates duplicates of list of shapes. If no translation distance is given the copied geometry will be placed overlapping the original.

Parameters:

(list s1, s2, s3, s4, …, sn) – List of shapes to copy
d – Translation distance

Syntax:

(copy-shape (list s1 s2 s3 s4 … sn) [d 0])

Example:

> (copy-shapes (list (surface-circle (xy 0 0) 10)
                   (surface-rectangle (xy 0 0) 10 5))
             (xy 20 0))
'(#<surface-circle 2> #<surface-rectangle 3>)



move

The function move applies a translation to a given shape, specified by a translation vector.

Parameters:

shape – Shape to move
v – Translation vector

Syntax:

(move shape v)

Example:

> (move (sphere) (xyz 1 2 3))
#<sphere 0>



rotate

The function rotate applies a rotation to a given shape around a specified point (2D) or axis (3D). The rotation is specified by the rotation angle and two points that define the rotation axis. If omitted, the first point will be considered the UCS origin and the second point will be considered immediately above the first.

Parameters:

shape – Shape to rotate
a – Rotation angle
p1 – First point in rotation axis
p2 – Second point in rotation axis

Syntax:

(rotate shape a [p1 (u0)] [p2 (+z p1 1)])

Example:

> (rotate (cylinder (xyz 0 0 0) 3 10)
          pi/3
          (xyz 0 0 0) (xyz 1 2 3))
#<cylinder 0>



mirror

The function mirror creates a reflection of a given shape in relation to a mirror plane, specified by a point, a normal vector to the mirror plane and a Boolean value to determine if the original shape is to be deleted after the reflection. If omitted, the point will be considered the UCS origin, the normal vector parallel to the Z axis and the original shape will not be discarded.

Parameters:

shape – Shape to reflect
p – Point on mirror plane
n – Normal vector to the mirror plane
#t/#f – Copy shape (#t) or delete original shape (#f)

Syntax:

(mirror shape [p (u0)] [n (uz)] [copy? #t])

Example:

> (rotate (cylinder (xyz 0 0 0) 3 10)
          pi/3
          (xyz 0 0 0) (xyz 1 2 3))
#<cylinder 0>



scale

The function scale uniformly increases or decreases the dimension of an entity when provided with a scaling factor – higher than 1 for increasing and lower to decrease the size and a reference point for the operation. If omitted this point will be considered the UCS origin.

Parameters:

shape – Shape to scale
s - Scale factor (between 0 and 1)
p – Reference point for scale operation

Syntax:

(scale shape s [p (u0)])

Example:

> (circle (xyz 0 0 0) 10)
#<circle 0>
> (scale (circle (xyz 0 0 0) 10) 0.8 (xyz 0 0 0))
#<circle 1>
> (scale (circle (xyz 0 0 0) 10) 1.2)
#<circle 2>
Top