Previous topic

6.3. Document3D

Next topic

6.3.2. document3D.classes — models for openPLM

This Page

Languages

Previous versions

1.2
1.1

6.3.1. document3D.models — models for openPLM

class openPLM.apps.document3D.models.Document3D(*args, **kwargs)[source]

Bases: openPLM.plmapp.models.document.Document

Model which allows to treat File .stp attached to DocumentFile for his later visualization and decomposition. It extends Document with the attribute/tab 3D

PartDecompose

If the Document3D has been decomposed, Part from which we generate the decomposition

menu_items[source]

Add Tab 3D

get_content_and_size(doc_file)[source]
Parameters:doc_fileDocumentFile which contains the File

Returns the File related to the DocumentFile (doc_file) and his size

If the File contains in the DocumentFile (doc_file) is a .stp and was decomposed , this function calls a subprocess( composer() ) to rebuild the .stp File

If the Document3D has been decomposed, it returns a list with all the Document3D that form part of the decomposition, and for every Document3D for ONLY ONE level of depth

openPLM.apps.document3D.models.generate_relations_BD(doc_file, temp_file)[source]

Function used when we add a new File .stp in a Document3D This function associates a series of files with classes ArbreFile and GeometryFile and this classes to a DocumentFile. The files were generated before the call to this function, their paths are known thanks to the information supplied in the temporary file(Every line of this file represents a file, the beginning of every line indicates the type of file)

Parameters:
  • doc_file – object which will be updated
  • temp_filetempfile that contains the path of the generated .geo and .arb files
class openPLM.apps.document3D.models.Document3DController(*args, **kwargs)[source]

Bases: openPLM.plmapp.controllers.document.DocumentController

A DocumentController which manages Document3D

It provides methods to deprecate and to manage (visualization3D and decomposition)files STEP.

handle_added_file(doc_file)[source]

If a File .stp is set like the file of a DocumentFile (doc_file) added to a Document3D , a special treatment (handle_step_file()) is begun (Only one file STEP allowed for each Document3D )

delete_file(doc_file)[source]

We erase also the classes GeometryFile and ArbreFile associated with the DocumentFile (doc_file)

deprecate_file(doc_file, by_decomposition=False)[source]

A file can be depreciated for diverse motives, (when a file STEP is decomposed, when exists a native file associate to one file STEP and we realize a brute check-out of the STEP , the native will be deprecated , ...)

Parameters:doc_fileDocumentFile which will be deprecated
get_product(doc_file, recursive=False)[source]

Returns the Product associated to doc_file. If recursive is True, it returns a complet product, built by browsing the BOM of the attached part, if it has been decomposed.

class openPLM.apps.document3D.models.GeometryFile(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Link between DocumentFile that contains a File .stp present in a Document3D and a file .geo that represents his geometry A DocumentFile can have zero or many GeometryFile associated , to identify the different GeometryFile attached to one DocumentFile we use the attribute index. (index should be >=1)

The information contained in the file .geo will allow to generate the 3D view of the DocumentFile

stp

DocumentFile of relation

file

file .geo

index

to identify the different GeometryFile attached to one DocumentFile (>=1)

openPLM.apps.document3D.models.delete_GeometryFiles(doc_file)[source]

Physically deletes (.geo files) and logically deletes GeometryFiles associated to doc_file

Parameters:doc_fileDocumentFile
class openPLM.apps.document3D.models.ArbreFile(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Link between DocumentFile that contains a File .stp present in a Document3D and a file .arb that represents his arborescense A DocumentFile STEP have one ArbreFile associated

The information contained in the file .arb will allow to generate the 3D view and the decomposition of the DocumentFile

stp

DocumentFile of relation

file

File .arb

decomposable

this attribute indicates if the DocumentFile can be decompose

classmethod create_from_product(product, doc_file)[source]

Creates a new ArbreFile from product. Its content is seririalized to a new ..arb file.

Returns the created ArbreFile.

openPLM.apps.document3D.models.delete_ArbreFile(doc_file)[source]

Erase physical (file .arb) and logically the ArbreFile associated with a DocumentFile (doc_file)

Parameters:doc_fileDocumentFile

Bases: openPLM.plmapp.models.link.ParentChildLinkExtension

Extend ParentChildLinkExtension Represents the matrix of transformation (rotation and translation) and the name of one relation between assemblies. When a file STEP is decomposed in Parts a ParentChildLink is generated between the Parts and each of these ParentChildLink could have attached one or more Location_link

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

Creates all Location_link bound to link and *pcl.

Parameters:
openPLM.apps.document3D.models.update_root_BD(new_stp_file, stp_file, ctrl, product, file, name, part)[source]
Parameters:

Updates a DocumentFile (stp_file) that was used like root in a decomposition , deprecating it and replacing by a new DocumentFile (new_stp_file)

This update consists in:

Connect the DocumentFile (new_stp_file) to the Document3D (ctrl.object)

Generate a new ArbreFile for the new_stp_file (product.doc_id and product.doc_path related to the new_stp_file)

Fix the attribute PartDecompose of the Document3D (ctrl.object) to the Part (part)

Deprecate the DocumentFile (stp_file)

openPLM.apps.document3D.models.update_child_files_BD(product, user, old_product)[source]
Parameters:
  • productProduct that represents a sub-arborescense of the file .stp that was decomposed UPDATE whit the news doc_id and doc_path generating in the bomb-child
  • old_productProduct that represents a sub-arborescense ORIGINAL of the file .stp that was decomposed

Updates a DocumentFile STEP that WAS NOT root in a decomposition, to know which DocumentFile to update we use the attribute product.doc_id of the arborescense(product)

This update consists in:

Generate a new ArbreFile for each DocumentFile STEP present in the arborescense(product)

Generate news GeometryFile for the DocumentFile STEP (Copies of the GeometryFiles of the root DocumentFile (Identified for old_product.doc_id))

openPLM.apps.document3D.models.copy_geometry(product, doc_file)[source]
Parameters:
  • productProduct that represents a sub-arborescense original of the file step that was decompose
  • doc_fileDocumentFile for which the files .geo that generated

Copy the content of all GeometryFile (determined by his index(product.geometry)) present in the Product (product) and his childrens for a DocumentFile (doc_file) generating and connecting news entitys GeometryFile

To differentiate the content of a file .geo we use the combination index (determined by product.geometry) more id (product.doc_id)

class openPLM.apps.document3D.models.handle_step_file(doc_file_pk)[source]

This is a proxy to an object that has not yet been evaulated.

Proxy will evaluate the object each time, while the promise will only evaluate it once.

class openPLM.apps.document3D.models.decomposer_all(stp_file_pk, arbre, part_pk, native_related_pk, user_pk)[source]

This is a proxy to an object that has not yet been evaulated.

Proxy will evaluate the object each time, while the promise will only evaluate it once.