# group

# Objects

JsCadUtilsGroup : object

# Functions

combine([pieces], options, map)CSG
map(cb)Object

Apply a function to each element in the group.

clone([name], [map])JsCadUtilsGroup

Clone a group into a new group.

rotate(solid, axis, angle)JsCadUtilsGroup

Rotate the group around a solids centroid. This mutates the group.

combineAll(options, map)CSG

Combines all parts, named and unnamed.

snap(part, to, axis, orientation, [delta])JsCadUtilsGroup

Snaps a named part of a group to another CSG objects bounding box.

align(part, to, axis, delta)JsCadUtilsGroup

Aligns all parts in a group to another CSG object.

midlineTo(part, to, axis)JsCadUtilsGroup
translate(x, [y], [z])JsCadUtilsGroup

Translates a group by a given ammount

pick(parts, map)JsCadUtilsGroup

Returns a new group from the list of parts.

array(parts, map)Array

Converts a group into an array of CSG objects.

toArray(pieces)Array

Converts all pieces or the picked pieces of a group into an array of CSG objects.

Group([objectNames], [addObjects])JsCadUtilsGroup

Creates a group object given a comma separated list of names, and an array or object. If an object is given, then the names list is used as the default parts used when the combine() function is called.

You can call the combine() function with a list of parts you want combined into one.

The map() funciton allows you to modify each part contained in the group object.

# JsCadUtilsGroup : object

Kind: global namespace

Param Type Description
names Array.<string> An array of object names in the group.
parts object An object with all parts in name value pairs.
holes Array.<CSG> An array of CSG objects that will be subtracted after combination.

# JsCadUtilsGroup..add(object, name, [hidden], [subparts], [parts])

Add a CSG object to the current group.

Kind: static method of JsCadUtilsGroup

Param Type Description
object CSG | JsCadUtilsGroup Object to add the parts dictionary.
name string Name of the part
[hidden] boolean If true, then the part will not be added during a default combine()
[subparts] string Prefix for subparts if adding a group
[parts] string When adding a group, you can pick the parts you want to include as the named part.

# combine([pieces], options, map) ⇒ CSG

Kind: global function
Returns: CSG - A single CSG object of the unioned parts.

Param Type Description
[pieces] String The parts to combine, if empty, then all named parts.
options Object Combine options
map function A function that is run before unioning the parts together.

# map(cb) ⇒ Object

Apply a function to each element in the group.

Kind: global function
Returns: Object - Returns this object so it can be chained

Param Type Description
cb function Callback founction applied to each part. It is called with the parameters (value, key)

# clone([name], [map]) ⇒ JsCadUtilsGroup

Clone a group into a new group.

Kind: global function
Returns: JsCadUtilsGroup - The new group.

Param Type Description
[name] String A new name for the cloned group.
[map] function A function called on each part.

# rotate(solid, axis, angle) ⇒ JsCadUtilsGroup

Rotate the group around a solids centroid. This mutates the group.

Kind: global function
Returns: JsCadUtilsGroup - The rotoated group.

Param Type Description
solid CSG | String The solid to rotate the group around
axis String Axis to rotate
angle Number Angle in degrees

# combineAll(options, map) ⇒ CSG

Combines all parts, named and unnamed.

Kind: global function
Returns: CSG - A CSG object of all combined parts.

Param Type Description
options Object Combine options.
map function A function run on each part before unioning.

# snap(part, to, axis, orientation, [delta]) ⇒ JsCadUtilsGroup

Snaps a named part of a group to another CSG objects bounding box.

Kind: global function
Returns: JsCadUtilsGroup - The group after snapping all parts to the to object.

Param Type Default Description
part String Comma separated list of parts in the group to snap.
to CSG A CSG object to snap the parts to.
axis String An axis string to snap on can be any combination of x, y, or z.
orientation String This orientation to snap to on the axis. A combination of inside or outside with a + or - sign.
[delta] Number 0 An offset to apply with the snap, in millimeters.

# align(part, to, axis, delta) ⇒ JsCadUtilsGroup

Aligns all parts in a group to another CSG object.

Kind: global function
Returns: JsCadUtilsGroup - The group after aligning all parts to the to object.

Param Type Description
part String Comma separated list of parts in the group to align.
to CSG A CSG object to align the parts to.
axis String An axis string to align on can be any combination of x, y, or z.
delta Number An offset to apply with the align, in millimeters.

# midlineTo(part, to, axis) ⇒ JsCadUtilsGroup

Kind: global function
Returns: JsCadUtilsGroup - The group after aligning all parts to the to object.

Param Type Description
part String Comma separated list of parts in the group to align.
to Number Where to align the midline to.
axis String An axis string to align on can be any combination of x, y, or z.

# translate(x, [y], [z]) ⇒ JsCadUtilsGroup

Translates a group by a given ammount

Kind: global function
Returns: JsCadUtilsGroup - The translated group.

Param Type Description
x Number | Array The x value or an array of x, y and z.
[y] Number The y value.
[z] Number The z value.

# pick(parts, map) ⇒ JsCadUtilsGroup

Returns a new group from the list of parts.

Kind: global function
Returns: JsCadUtilsGroup - The new group with the picked parts.

Param Type Description
parts String A comma separted string of parts to include in the new group.
map function A function run on each part as its added to the new group.

# array(parts, map) ⇒ Array

Converts a group into an array of CSG objects.

Kind: global function
Returns: Array - An array of CSG objects

Param Type Description
parts String A comma separated list of parts it include in the new array.
map function A function run on each part as its added to the new array.

# toArray(pieces) ⇒ Array

Deprecated

Converts all pieces or the picked pieces of a group into an array of CSG objects.

Kind: global function
Returns: Array - An array of CSG objects.

Param Type Description
pieces String Comma separated string of parts to convert. All named parts if empty.

# Group([objectNames], [addObjects]) ⇒ JsCadUtilsGroup

Creates a group object given a comma separated list of names, and an array or object. If an object is given, then the names list is used as the default parts used when the combine() function is called.

You can call the combine() function with a list of parts you want combined into one.

The map() funciton allows you to modify each part contained in the group object.

Kind: global function
Returns: JsCadUtilsGroup - An object that has a parts dictionary, a combine() and map() function.

Param Type Description
[objectNames] string | object Comma separated list of part names.
[addObjects] array | object Array or object of parts. If Array, the names list is used as names for each part.