Previous topic

6.3.2. document3D.classes — models for openPLM

Next topic

6.3.4. document3D.arborescense — models for openPLM

This Page

Languages

Previous versions

1.2
1.1

6.3.3. document3D.views — models for openPLM

Habla sobre los modelos

openPLM.apps.document3D.views.display_3d(request, *args, **kwargs)[source]

3D view.

This view is able to show a 3D file (STEP or STL) using WebGL.

Template:

Display3D.html

class openPLM.apps.document3D.views.StepDecomposer(part)[source]

Bases: openPLM.plmapp.decomposers.base.Decomposer

Decomposer of Document3D.

class openPLM.apps.document3D.views.PartDoc

Bases: tuple

PartDoc(part_type, qty_form, cforms, name, is_assembly, prefix, ref)

cforms

itemgetter(item, ...) –> itemgetter object

Return a callable object that fetches the given item(s) from its operand. After, f=itemgetter(2), the call f(r) returns r[2]. After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])

is_assembly

itemgetter(item, ...) –> itemgetter object

Return a callable object that fetches the given item(s) from its operand. After, f=itemgetter(2), the call f(r) returns r[2]. After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])

name

itemgetter(item, ...) –> itemgetter object

Return a callable object that fetches the given item(s) from its operand. After, f=itemgetter(2), the call f(r) returns r[2]. After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])

part_type

itemgetter(item, ...) –> itemgetter object

Return a callable object that fetches the given item(s) from its operand. After, f=itemgetter(2), the call f(r) returns r[2]. After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])

prefix

itemgetter(item, ...) –> itemgetter object

Return a callable object that fetches the given item(s) from its operand. After, f=itemgetter(2), the call f(r) returns r[2]. After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])

qty_form

itemgetter(item, ...) –> itemgetter object

Return a callable object that fetches the given item(s) from its operand. After, f=itemgetter(2), the call f(r) returns r[2]. After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])

ref

itemgetter(item, ...) –> itemgetter object

Return a callable object that fetches the given item(s) from its operand. After, f=itemgetter(2), the call f(r) returns r[2]. After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])

class openPLM.apps.document3D.views.Assembly

Bases: tuple

Assembly(part_docs, name, visited, depth, type)

depth

itemgetter(item, ...) –> itemgetter object

Return a callable object that fetches the given item(s) from its operand. After, f=itemgetter(2), the call f(r) returns r[2]. After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])

name

itemgetter(item, ...) –> itemgetter object

Return a callable object that fetches the given item(s) from its operand. After, f=itemgetter(2), the call f(r) returns r[2]. After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])

part_docs

itemgetter(item, ...) –> itemgetter object

Return a callable object that fetches the given item(s) from its operand. After, f=itemgetter(2), the call f(r) returns r[2]. After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])

type

itemgetter(item, ...) –> itemgetter object

Return a callable object that fetches the given item(s) from its operand. After, f=itemgetter(2), the call f(r) returns r[2]. After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])

visited

itemgetter(item, ...) –> itemgetter object

Return a callable object that fetches the given item(s) from its operand. After, f=itemgetter(2), the call f(r) returns r[2]. After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])

openPLM.apps.document3D.views.display_decompose(request, *args, **kwargs)[source]
Parameters:
  • obj_type – Type of the Part from which we want to realize the decomposition
  • obj_ref – Reference of the Part from which we want to realize the decomposition
  • obj_revi – Revision of the Part from which we want to realize the decomposition
  • stp_id – Id that identify the DocumentFile contained in a Document3D attached to the Part (identified by obj_type, obj_ref, obj_revi) that we will decompose

When we demand the decomposition across the web form, the following tasks are realized

  • We check that the Document3D that contains the DocumentFile (stp_id) that will be decomposed has not been modified since the generation of the form

  • We check the validity of the information got in the form

  • If exists a native DocumentFile file related to DocumentFile (stp_id) that will be decomposed

    then this one was depreciated (afterwards will be promoted)

  • The DocumentFile (stp_id) was locked (afterwards will be promoted)

  • We call the function generate_part_doc_links_AUX() (with the property transaction.commit_on_success)

    • We generate the arborescense (product) of the DocumentFile (stp_id)
    • The bom-child of Parts (in relation to the arborescense of the DocumentFile (stp_id)) has been generated
    • For every ParentChildLink generated in the previous condition we attach all the Location_link relatives
    • To every generated Part a Document3D has been attached and this document has been set like the attribute PartDecompose of the Part
    • The attribute doc_id of every node of the arborescense (Product) is now the relative id of Document3D generated in the previous condition
    • To every generated Document3D has been added a new empty(locked) DocumentFile STP
    • The attribute doc_path of every node of the arborescense(Product) is now the path of DocumentFile STP generated in the previous condition
  • We update the indexes for the objects generated

  • We call the processus decomposer_all(with celeryd)

openPLM.apps.document3D.views.clean_form(request, assemblies, product, index, obj_type, inbulk_cache)[source]
Parameters:
  • assemblies – will be refill whit the information necessary the generate the forms
  • productProduct that represents the arborescense of the File .stp contained in a DocumentFile
  • index – Use to mark and to identify the product s that already have been visited
  • obj_type – Type of the Part from which we want to realize the decomposition

It checks the validity of the forms contained in request

If the forms are not valid, it returns the information to refill the new forms contained in assemblies.

Refill assemblies with the different assemblies of the file step , we use index to mark and to identify the products that already have been visited

For every Assembly we have the next information:

  • Name of assembly

  • Visited , If assembly is sub-assembly of more than one assembly, this attribute will be False for all less one of the occurrences

    If visited is False, we will be able to modify only the attributes Order , Quantity and Unit refered to the ParentChildLink in the form

    If visited is not False , it will be a new id acording to index (>=1) generated to identify the assembly

  • Depth of assembly

  • obj_type , type of Part of Assembly

  • A list with the products that compose the assembly

    for each element in the list:

    • part_type contains the form to select the type of Part
    • ord_quantity contains the forms to select Order , Quantity and Unit refered to the ParentChildLink
    • creation_formset contains the form for the creation of the part selected in part_type and of one Document3D
    • name_child_assemblies contains the name of the element
    • is_assembly determine if the element is a single product or another assembly
    • prefix contains the index of the assembly if he is visited for first time , else is False
    • ref contains the index of the assembly if he was visited previously, else False
openPLM.apps.document3D.views.initialize_assemblies(assemblies, product, group, user, index, obj_type, inbulk_cache)[source]
Parameters:
  • assemblies – will be refill whit the information necessary the generate the forms
  • productProduct that represents the arborescense of the File .stp contained in a DocumentFile
  • index – Use to mark and to identify the product s that already have been visited
  • obj_type – Type of the Part from which we want to realize the decomposition
  • group – group by default from which we want to realize the decomposition

Returns in assemblies a list initialized with the different assemblies of the file step

For every Assembly we have the next information:

  • Name of assembly

  • Visited , If assembly is sub-assembly of more than an assembly, this attribute will be False for all less one of the occurrences

    If visited is False, we will be able to modify only the attributes Order , Quantity and Unit refered to the ParentChildLinkin in the form

    If visited is not False , it will be a new id acording to index (>=1) generated to identify the assembly

  • Depth of assembly

  • obj_type , type of Part of Assembly

  • A list with the products that compose the assembly

    for each element in the list:

    • part_type contains the form to select the type of Part
    • ord_quantity contains the forms to select Order , Quantity and Unit refered to the ParentChildLink
    • creation_formset contains the form for the creation of the part selected in part_type and of one Document3D
    • name_child_assemblies contains the name of the element
    • is_assembly determine if the element is a single product or another assembly
    • prefix contains the index of the assembly if he is visited for first time , else is False
    • ref contains the index of the assembly if he was visited previously, else False
Parameters:
  • productProduct that represents the arborescense
  • parent_ctrlPart from which we want to realize the decomposition
  • instances – Use to trace the items to update

Parses forms and generates:

  • The bom-child of Parts (in relation to the product)
  • For every ParentChildLink generated in the previous condition we attach all the Location_link relatives
  • To every generated Part a Document3D has been attached and Document3D has been set like the attribute PartDecompose of the Part
  • The attribute doc_id of every node of the arborescense(product) is now the relative id of DocumentFile generated in the previous condition
  • To every generated Document3D has been added a new empty(locked) DocumentFile STP ( generateGhostDocumentFile() )
  • The attribute doc_path of every node of the arborescense(product) is now the path of DocumentFile STP generated in the previous condition
openPLM.apps.document3D.views.generateGhostDocumentFile(product, document, locker)[source]
Parameters:

For one Product (product) and one Document3DController (Doc_controller), generates a DocumentFile with a file .stp emptily without indexation

It updates the attributes doc_id and doc_path of the Product (product) in relation of the generated DocumentFile

openPLM.apps.document3D.views.ajax_part_creation_form(request, *args, **kwargs)[source]

It updates the form of an assembly determined by prefix without recharging the whole page and respecting the information introduced up to the moment

The attributes can change depending on the type of part selected