Product Lifecycle Management Batch conversion
by OmniaSolutions https://odooplm.omniasolutions.website| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Manufacturing (mrp)
• Discuss (mail) • Inventory (stock) |
| Community Apps Dependencies | Show |
| Lines of code | 27730 |
| Technical Name |
plm_automated_convertion |
| License | AGPL-3 |
| Website | https://odooplm.omniasolutions.website |
| Versions | 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 |
PLM Automated Conversion
Background conversion engine for CAD files inside Odoo PLM. Converts source documents to derivative formats (preview images, 3D web models) automatically via a job queue, and on-demand when opening the 3D viewer.
Supported Conversions
| Source | Target | Method |
|---|---|---|
.stp / .step | .3mf | CadQuery + OpenCASCADE — preserves original component names from STEP instance labels |
.stp / .step | .gltf / .glb | CadQuery + OpenCASCADE — preserves original component names |
.stp / .step | .stl | CadQuery exporters |
.stp / .step | .png | numpy-stl + matplotlib |
.stl | .3mf | to-3mf library |
.stl | .png | numpy-stl + matplotlib |
.dxf | .png / .pdf / .svg | ezdxf + matplotlib |
.obj | .png | Internal OBJ renderer |
STEP Name Preservation
Standard CadQuery STEP import uses the definition label (shared part name) for all
instances, causing duplicate-name errors in assemblies where the same part appears more
than once. This module includes a custom importer that reads the instance label
(comp_label) from the XCAF document for each placement, falling back to the
definition name only when the instance has none.
# Simplified logic inside _import_step_preserve_names()
inst_name = _get_name(comp_label) or _get_name(ref_label) or f"part_{i}"
# Guarantee uniqueness within this parent level
if inst_name in name_counter:
name_counter[inst_name] += 1
inst_name = f"{inst_name}_{name_counter[inst_name]}"
This ensures the component tree in glTF/3MF output matches the original CAD assembly structure.
3MF Export
The built-in CadQuery 3MF exporter does not preserve assembly hierarchy or component names.
This module provides a custom exporter (_export_assembly_to_3mf) that:
- Traverses the full assembly tree recursively
- Tessellates each leaf shape with its accumulated world transform applied
- Writes a valid 3MF ZIP with one named
<object>per component - Registers the 3MF namespace as the default XML namespace so
querySelectorAll('object')in Three.js finds elements correctly (avoidsns0:prefix issue from Python's ElementTree)
Preview Image Copying
When a conversion job completes, the preview image (ir.attachment.preview)
from the source document is copied to the converted document. This allows the converted
3MF or glTF to display the same thumbnail as the original STEP file.
Job Queue (plm.convert.stack)
Conversions are queued as plm.convert.stack records and processed by a
scheduled action. This prevents long-running CAD conversions from blocking the Odoo
web request.
| Field | Description |
|---|---|
start_document_id | Source ir.attachment |
end_document_id | Resulting ir.attachment after conversion |
start_format | Source extension (e.g. .stp) |
end_format | Target extension (e.g. .3mf) |
conversion_done | Set to True once the job completes |
operation_type | CONVERT or UPDATE (preview update) |
On-Demand Conversion (3D Web Integration)
When a user clicks 3D Web on a STEP attachment, the
plm_web_3d module calls _get_or_create_3mf_from_step():
- Search for an existing
ir.attachmentwheresource_convert_document = this_stepand name ends in.3mf. - If found — open it immediately (no re-conversion).
- If not found — call
convert_from_step_to('.3mf'), create a newir.attachment, copy the preview, and open the result.
Python Dependencies
pip install ezdxf pip install matplotlib pip install cadquery # includes OpenCASCADE (OCP) pip install numpy-stl pip install to-3mf
only_on_non_sh_requirements.txt for environment-specific overrides.
Conversion Format Records
plm.convert.format records in data/data.xml define which source
extensions are automatically queued for conversion. Pre-configured records include:
| XML ID | Source | Target |
|---|---|---|
update_stp_preview_png | .stp | .png (preview) |
update_step_preview_png | .step | .png (preview) |
update_stp_preview_3mf | .stp | .3mf |
update_stp_preview_gltf | .stp | .gltf |
update_stp_preview_glb | .stp | .glb |
update_step_preview_3mf | .step | .3mf |
update_step_preview_gltf | .step | .gltf |
update_step_preview_glb | .step | .glb |
Please log in to comment on this module