Previous topic

6.3.4. document3D.arborescense — models for openPLM

Next topic

6.3.6. document3D.generate3D — models for openPLM

This Page

Languages

Previous versions

1.2
1.1

6.3.5. document3D.STP_converter_WebGL — models for openPLM

Habla sobre los modelos

class openPLM.apps.document3D.STP_converter_WebGL.StepImporter(file_path, id=None)[source]

Bases: object

Parameters:
  • file_path – Path of the file .stp to analyzing
  • id – For the generation of the Product, id is assigned like product.doc_id for every node of Product. For the generation of the files of geometry .geo, id , together with an index generated by the class, are used to identify the content of every file

Generates from a path of File .stp:

-A set of files .geo that represents the geometry of the different simple products that are useful to realize the visualization 3D across the web browser.

-A structure of information that represents the arborescencse of the different assemblies,represented in a Product . (Including his spatial location and orientation and his label of reference (OCC.TDF.TDF_Label))

This class is invoked from three different subprocesses related to the functionality of pythonOCC(generate3D.py , generateComposition.py , generateDecomposition.py).

compute_geometries(root_path, pov_dir)[source]
Parameters:root_path – Path where to store the files .geo generated

When we generate a new StepImporter we will refill a list(shapes_simples) whit the SimpleShape contained in the file .stp

For each SimpleShape in the list shapes_simples:

We call the method write_geometries() to generate a file .geo representative of its geometry,the content of the file is identified by the index+1 (>0) of the position of the SimpleShape in the list of SimpleShapes and by the attribue id of StepImporter

Returns the list of the path of the generated .geo files

generate_product_arbre()[source]

Generates a Product relative to the assemblies of the file .stp, for every node of the Product it includes a label (OCC.TDF.TDF_Label) that represents and identifies the node , openPLM can only work whit a single root .stp files

class openPLM.apps.document3D.STP_converter_WebGL.SimpleShape(name, TopoDS_Shape, color)[source]

Class used to represent a simple shape geometry (not assembly)

Model attributes:
 
name

Name of geometry

TopoDS_Shape

OCC.TopoDS.TopoDS_Shape that contains the geometry

color

OCC.Quantity.Quantity_Color that contains information about color of geometry

openPLM.apps.document3D.STP_converter_WebGL.expand_product(shape_tool, product, shapes_simples, deep, doc_id, product_root, product_id, file_path)[source]
Parameters:
  • shape_toolOCC.XCAFDoc.XCAFDoc_ShapeTool
  • productProduct that will be expanded
  • shapes_simples – list of SimpleShape
  • deep – Depth of the node that we explore
  • doc_id – id that references a DocumentFile of which we are generating the Product
  • product_rootProduct root of the arborescense

We are going to expand a Product (product) from the OCC.TDF.TDF_Label who identifies it (product.label_reference)

If the product is an assembly:

  • We generate the list of the OCC.TDF.TDF_Label that define it

  • for each OCC.TDF.TDF_Label in list:

Else the product is a simple shape:

  • We look in the list of shapes_simples for his partner
  • We set the attribute product.geometry like the index+1 (>0) of the position of his partner in the list of SimpleShape
openPLM.apps.document3D.STP_converter_WebGL.get_matrix(location)[source]

Converts location in an array ([x1, x2, x3, x4, y1, y2, y3, y4, z1, z2, z3, z4])

x1 x2 x3 x4 x = x’
y1 y2 y3 y4 y = y’
z1 z2 z3 z4 z = z’
0 0 0 1 1 = 1
Parameters:location (OCC.TopLoc.TopLoc_Location) – location
openPLM.apps.document3D.STP_converter_WebGL.get_label_name(lab)[source]

Returns the name of a OCC.TDF.TDF_Label (lab)

Parameters:labOCC.TDF.TDF_Label
openPLM.apps.document3D.STP_converter_WebGL.set_label_name(label, name)[source]

Sets the name of a OCC.TDF.TDF_Label (label)

Parameters:
  • labelOCC.TDF.TDF_Label
  • name – new name for a OCC.TDF.TDF_Label
openPLM.apps.document3D.STP_converter_WebGL.find_color(label, color_tool, shape_tool)[source]

Gets the color of a OCC.TDF.TDF_Label (label)

Parameters:
  • labelOCC.TDF.TDF_Label
  • shape_toolOCC.XCAFDoc.XCAFDoc_ShapeTool
  • color_toolOCC.XCAFDoc.XCAFDoc_ColorTool