The assembly module

class tracer.assembly.Assembly(objects=None, subassemblies=None, location=None, rotation=None)

Defines an assembly of objects or sub-assemblies.

Attributes

  • _objects: a list of the objects the assembly contains
  • _assemblies: a list of the sub assemblies the assembly contains

Arguments

objects (optional) - a list of AssembledObject instances that are part of this assembly. subassemblies (optional) - a list of Assembly instances to be transformed together with this assembly. location, rotation - passed on to HasFrame.

add_assembly(assembly, transform=None)

Adds an assembly to the current assembly.

Arguments

  • assembly: the assembly object to add
  • transform: the transformation matrix (as an array object) that describes the new assembly in the coordinate system of the current assembly
add_object(object, transform=None)

Adds an object to the assembly.

Arguments

  • objects: the AssembledObject to add
  • transform: the transformation matrix (as an array object) that describes the object in the coordinate system of the Assembly
get_local_objects()

Get the list of objects belonging directly to this assembly, without querying the child assemblies.

get_objects()

Generates a list of AssembledObject instances belonging to this assembly or its subassemblies.

get_surfaces()

Generates a list of surface objects out of all the surfaces in the objects and subassemblies belonging to this assembly.

The surfaces are guarantied to be in the order that each object returns them, and the objects are guarantied to be ordered the same as in self.get_objects()

set_location(location)

A recursive version of the parent’s set_rotation. Changes the location part of the assembly’s transform, and updates the assembly’s children’s transform accordingly.

Arguments

  • location: a 3-component location vector.
set_rotation(rotation)

A recursive version of the parent’s set_rotation. Changes the rotation part of the assembly’s transform, and updates the assembly’s children’s transform accordingly.

Arguments

  • rotation: a 3x3 rotation matrix.
Assembly.transform_children(assembly_transform=array([[ 1., 0., 0., 0.],
[ 0., 1., 0., 0.],
[ 0., 0., 1., 0.],
[ 0., 0., 0., 1.]]))

Transforms the entire assembly

Arguments

  • assembly_transform: the transformation into the parent assembly containing the current assembly

Previous topic

The has_frame module

Next topic

The object module

This Page