Previous topic

6.3.1. document3D.models — models for openPLM

Next topic

6.3.3. document3D.views — models for openPLM

This Page

Languages

Previous versions

1.2
1.1

6.3.2. document3D.classes — models for openPLM

Habla sobre los modelos

class openPLM.apps.document3D.classes.Product(name, deep, label_reference, doc_id, id, doc_path=None, geometry=False)[source]

Bases: object

Class used to represent the arborescense contained in a File .stp.A Product can be simple or an assembly, if it is an assembly in links we will guard the information about other Product that compose it.

There are two ways of generating a Product, reading the file .stp across the class StepImporter ( will refill the attribute label_reference for every Product), or reading a file .arb related to a ArbreFile . Therefore there exist two ways of distinguishing the different Product, by means of the attribute label_reference if this one is not False , or by means of the combination of attributes id and doc_id.

Model attributes:
 

If the product is an assembly, links stores one or more openPLM.apps.document3D.classes.Link references to the products that compose it

label_reference

When we generate an arborescense using StepImporter , here we will store the label that represents the Product , if we generate the arborescense reading a file .geo, this attribute will be False

name

Name of Product ,if the name is empty and there exists a Link at the Product , we will assign the name of the Link to the Product

doc_id

Id of the DocumentFile that contains the Product , in the case of File .stp decomposed them doc_id may be different for every Product of the arborescense

doc_path

Path of the File represented by the DocumentFile that contains the product

part_to_decompose

Used in the decomposition, it indicates the Part where the Product was decomposed

geometry

If geometry is True (>=1) then the Product is single (without links ) , and his value refers to the index that we will use to recover a GeometryFile

deep

Depth in the arborescense

visited

Used in the decomposition , indicates if a Product has been visited in the tour of the arborescense

id

identified the Product

is_decomposed[source]

If it is an assembly and any Product contents in its links are defined (doc_id) in another DocumentFile (doc_id)

is_decomposable[source]

If it is an assembly and any Product contents in its links are defined (doc_id) in the same DocumentFile (doc_id)

classmethod from_list(arbre, product=False, product_root=False, deep=0, to_update_product_root=False)[source]

Returns a new Product built from arbre. arbre is a serialized version as returned by to_list().

Example:

  • To generate a product of a single file .arb

    tree=Product.from_list(json.loads(new_ArbreFile.file.read()))
    
  • To generate a product of a single file .arb and link this one like a branch of a certain product_root_node of an already existing product_root

    product=Product.from_list(json.loads(new_ArbreFile.file.read()),product=False, product_root=product_root, deep=xxx, to_update_product_root=product_root_node)
    

    This method generates the Link between product_root_node and product , BUT it does not add the occurrences, generally this occurrences are stored in the existing Location_link

    After generating the product and the Link, we will have to refill the Link calling the function add_occurrence() for the Link:

    for location in locations:
        product_root_node.links[-1].add_occurrence(location.name,location)
    
Parameters:
  • arbre
  • product – Product that represents an arborescense , ONLY used in successive recursive calls of the function
  • product_root – Product that represents a root arborescense , used to determine if the product to generate is already present in the tree
  • deep – depth of product in the arborescense
  • to_update_product_root – Product that represents a node of an arborescense (sub-branch of arborescense referenced by product_root)

Bases: object

Class used to represent a parent child link between two .Product. A Link can have several references, each one with its name and transformation matrix.

Model attributes:
 
names

Name of each instances of the Link , if the instance does not have name, it gets the name of its Product child

locations

TransformationMatrix of each instances of the Link

product

Product child of the Link

quantity

Number of instances of the Link (each instance has a name and location)

visited

Used in the decomposition , indicates if a Link has been visited in the tour of the arborescense

class openPLM.apps.document3D.classes.TransformationMatrix(coords)[source]

Bases: object

Defines a non-persistent transformation in 3D space

x1 x2 x3 x4 x = x’
y1 y2 y3 y4 y = y’
z1 z2 z3 z4 z = z’
0 0 0 1 1 = 1
openPLM.apps.document3D.classes.search_assembly(product, product_root)[source]

Checks if a Product is already present in an arborescense Product (product_root) There are two manners of comparison, across label_reference ( generated for StepImporter for every Product), or across id and doc_id (extracted of a file .geo for every Product)

Parameters:
  • product_rootProduct root of the arborescense
  • productProduct for that we look in the product_root