Class Article
About :
A class modelling any item in an assembly tree from root assembly to part sheet. The article is the main node of a bill of material, ie: a hierachy of assembly, subassembly, …, part.
Functions
Function | summury |
---|---|
__init__(self) | Generator of an article (more…) |
duplicate(self, DICT={}) | Duplicate an article. copy every data and return a new identical article (more…) |
set_name(self, name) | set the article name (more…) |
set_father(self, father=None) | set the article father (more…) |
get_father(self) | Get the article father (more…) |
get_fathers(self, L=[]) | Get the article fathers (more…) |
get_root(self) | Get Root Node (more…) |
get_path(self) | The path is a list of integer from the Mechanism (more…) |
get_global_position(self) | Get the position in the global frame of the scene (more…) |
set_global_position(self, position=((1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1))) | Set the position in the global frame (more…) |
get_position(self) | Get the local position respect to its father (more…) |
set_position(self, position=((1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1))) | Set the local position (more…) |
save_frame(self, frame=’’, previous=None, sequence=None) | Save the current frame (more…) |
goto_frame(self, frame=’’) | Set position for expected frame (more…) |
center(self) | get the center of an article (more…) |
get_pixmap(self) | Get reference pixmap for GUI (more…) |
lock(self) | Set lock status to True (more…) |
lock_all(self) | Recursive lock status to True for all children (more…) |
unlock(self) | Set lock status to False (more…) |
is_locked(self) | Returns either article is locked or not (more…) |
is_hidden(self) | if the article is hidden or visible (more…) |
update_bounding_box(self) | |
get_bounding_box(self, frame=0) | Returns the bounding box in various frame (more…) |
urdf_string(self, where=’’, urdf=’’) | Complete urdf string with the content of the current article description (more…) |
urdf_joint_string(self, urdf=’’) | Complete urdf string for the current joint (more…) |
get_euler_position(self, local=True) | Convert the position to Translation, Euler angles, and Scale (more…) |
get_quaternion_position(self, local=True) | Convert the position to Translation, Quaternion , and Scale (more…) |
set_position_from_quaternion(self, T, Q) | Set local position from a translation and quaternion (more…) |
Methods desciption :
init
def __init__(self)
Generator of an article
Atributes
- _name : article name
- _color : a 4-tuple providing the color of the article
(Red, Green, Blue, alpha)
. Values in [0,1] - _hidden : boolean : the article should be hidden
- _father : the parent article
- _locked : boolean : if
True
the article cannot be manipulated (moved) - _bounding_box : a 6-tuple of float (xmin,ymin,zmin,Xmax,Ymax,Zmax)
- _position : 4x4 transformation matrix _ _frame : the position stored at a frame index : dictionnary
duplicate
def duplicate(self, DICT={})
Duplicate an article. copy every data and return a new identical article
- → DICT: complete a dictionary linking the current article to its copy
- ← new,DICT
set_name
def set_name(self, name)
set the article name
- → name: new name
set_father
def set_father(self, father=None)
set the article father
- → father: another article
get_father
def get_father(self)
Get the article father
- ← the direct father
get_fathers
def get_fathers(self, L=[])
Get the article fathers It is a recursive function : L is completed and returned
- ← the list of fathers. The completed L list
if len(L) :
L[0] the direct father
L[-1] is the root father
get_root
def get_root(self)
Get Root Node
- ← the root article of the BOM hierarchy
get_path
def get_path(self)
The path is a list of integer from the Mechanism
- ← the path as a list of indexes,the root node
get_global_position
def get_global_position(self)
Get the position in the global frame of the scene
- ← the expected transformation matrix
set_global_position
def set_global_position(self, position=((1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1)))
Set the position in the global frame
Based on the global positionn the function recompute the local position respect to the father, and set this position to the current node.
- → position:
get_position
def get_position(self)
Get the local position respect to its father
- ← local position
set_position
def set_position(self, position=((1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1)))
Set the local position
- → position: local position : default = identity matrix
save_frame
def save_frame(self, frame='', previous=None, sequence=None)
Save the current frame
- → frame: frame name
- → previous: previous frame
- → sequence: list of sequence frame
- ← None
goto_frame
def goto_frame(self, frame='')
Set position for expected frame
- → frame: expected framee
center
def center(self)
get the center of an article center of article bounding box
- ← 3-tuple
get_pixmap
def get_pixmap(self)
Get reference pixmap for GUI
- ← a pixmap name
lock
def lock(self)
Set lock status to True When an article is locked sub-articles are considered as fixed. They cannot be selected or dragged individually
lock_all
def lock_all(self)
Recursive lock status to True for all children
unlock
def unlock(self)
Set lock status to False When an article is locked sub-articles are considered as fixed. They cannot be selected or dragged individually
is_locked
def is_locked(self)
Returns either article is locked or not When an article is locked sub-articles are considered as fixed. They cannot be selected or dragged individually
- ← locked status
is_hidden
def is_hidden(self)
if the article is hidden or visible
- ← hidden state
update_bounding_box
def update_bounding_box(self)
get_bounding_box
def get_bounding_box(self, frame=0)
Returns the bounding box in various frame
- → frame :
- 0 in its own local frame
- 1 in the local frame of its fathe
- 2 in the global local frame
- ←s: bounding box as a 6-tuple : (x,y,z,X,Y,Z)
urdf_string
def urdf_string(self, where='', urdf='')
Complete urdf string with the content of the current article description
- → where: the location where wavefront files should be saved
- → urdf: the text to be completed
- ← the completed urdf string
urdf_joint_string
def urdf_joint_string(self, urdf='')
Complete urdf string for the current joint
- → urdf: the string to be completed
- ← the completed string
get_euler_position
def get_euler_position(self, local=True)
Convert the position to Translation, Euler angles, and Scale
- → local: either local or global position must be returned
- ← T,E,S : translation, euler angle, scale factor
get_quaternion_position
def get_quaternion_position(self, local=True)
Convert the position to Translation, Quaternion , and Scale
- → local: either local or global position must be returned
- ← position,S,T,R,Q : position, scale, translation, rotation matrix, quaternion
set_position_from_quaternion
def set_position_from_quaternion(self, T, Q)
Set local position from a translation and quaternion
- → T: translation
- → Q: quaternion