Link Search Menu Expand Document

Class Assembly

About :

An assembly is a node of a bill of material that contains sub-nodes

Class diagram of class of Assembly.

Functions

Function summury
__init__(self) Instantiotion method (more…)
add_component(self, component, update=False) Add a sub node (more…)
remove_component(self, component, update=True) Remove a sub node (more…)
get_component(self, num=-1) Get sub component from index (more…)
get_all_components(self, SET=None) Get all the sub components of the current assembly (more…)
lock_all(self) Recursive lock of every sub node of the bom (more…)
save_frame(self, frame=’’, previous=None, sequence=None) save current position as a frame (more…)
goto_frame(self, frame=’’) Set every subnode of the current assembly to the frame position (more…)
center(self) Recursive construction of the assembly center (more…)
update_bounding_box(self) Recursive computation of the assembly bounding box (more…)
urdf_string(self, where=’’, urdf=’’) Complete urdf string for the assembly (more…)

Methods desciption :

init

def __init__(self)

Instantiotion method

Attributes

  • _component : list of subnodes : either assembly or component

add_component

def add_component(self, component, update=False)

Add a sub node

  • → component: the sub node
  • → update: if the bounding box must be updated or not

if many sub-components are added, it is better to wait the last one before updating the bounding box.

remove_component

def remove_component(self, component, update=True)

Remove a sub node

  • → component: the subnode to be removed
  • → update: update the bounding box

get_component

def get_component(self, num=-1)

Get sub component from index

  • → num: the index in [-1,n-1] where n is the number of component
  • ← the indexed component or the list of sub node if n=-1
if num==-1 : return list_of_subnodes
elif num in range(0,n) : return sub_node[num]
else : return None

get_all_components

def get_all_components(self, SET=None)

Get all the sub components of the current assembly Recursive traversal of the hierarchy of assembly and add all components in a flat set

  • → SET: Add the components to the current SET for recursivity
  • ← return the set of expected components

lock_all

def lock_all(self)

Recursive lock of every sub node of the bom

save_frame

def save_frame(self, frame='', previous=None, sequence=None)

save current position as a frame if previous is not None then the frame is save if position is new respect to previous in the current sequence

goto_frame

def goto_frame(self, frame='')

Set every subnode of the current assembly to the frame position

  • → frame: expected frame

center

def center(self)

Recursive construction of the assembly center

update_bounding_box

def update_bounding_box(self)

Recursive computation of the assembly bounding box

  • ← the computer bounding box

urdf_string

def urdf_string(self, where='', urdf='')

Complete urdf string for the assembly

  • → where: location of wavefront shapes
  • → urdf: the urdf string to complete
  • ← the competed urdf string