:orphan:

##########
3MF Reader
##########

.. rst-class:: format-title-block

+--------------------------------------------------------------------------+
|                   **3D Manufacturing Format**                            |
+-----------------------------------------+--------------------------------+
| **File Extension**                      | 3MF                            |
+-----------------------------------------+--------------------------------+
| **Supported Versions**                  | 1.2.3                          |
+-----------------------------------------+--------------------------------+
| **Platforms**                           | |wy| |ly| |my| |an| |iy|       |
+-----------------------------------------+--------------------------------+
| :ref:`3mf_tessellation`                 | |t_green| Read from file       |
+-----------------------------------------+--------------------------------+
| **B-rep**                               | |c_grey| Unsupported by format |
+-----------------------------------------+--------------------------------+
| **PMI**                                 | |c_grey| Unsupported by format |
+-----------------------------------------+--------------------------------+

`3MF (3D Manufacturing Format) <https://en.wikipedia.org/wiki/3D_Manufacturing_Format>`__ is an open-source file 
format designed for additive manufacturing.
Developed by the 3MF Consortium, which includes major industry players, the format aims to provide a comprehensive 
and interoperable model.
3MF supports detailed specifications of object geometries, colors, materials, and other properties essential for 
3D printing, ensuring that designs and their intentions are transmitted accurately and effectively between different 
software applications and printers.

How to Import From 3MF
======================

To load a 3MF file with HOOPS Exchange, use the function :cpp:func:`A3DAsmModelFileLoadFromFile`.

The structure :cpp:struct:`A3DParamsLoadData` is used to customize the loading behavior:

.. code-block:: c

   A3DAsmModelFile* pModelFile = 0;

   A3DRWParamsLoadData sReadParam;
   A3D_INITIALIZE_DATA(A3DRWParamsLoadData, sReadParam);
   sReadParam.m_sGeneral.m_bReadSolids = true;

   // ... set other A3DRWParamsLoadData fields as necessary

   A3DAsmModelFileLoadFromFile("path/to/file.3mf", &sReadParam, &pModelFile);

See :doc:`/guide/basic_operations/load_model` for more information about loading model files.

If you need more detail about the load parameters, see :ref:`import_params_reference`. 
For guidance on working with tessellation, consult :ref:`extracting_tessellation`.

.. _3mf_tessellation: 

Tessellation
============

Note that 3MF is a tessellation-only format. 
This means that when a 3MF file is read by HOOPS Exchange, only tessellation data is imported.

Due to the nature of the 3MF file format, tessellation information is directly read from the source without additional treatment.

Upon reading, use :cpp:member:`A3DRWParamsGeneralData::m_eReadGeomTessMode` to decide whether tessellation is read.
The :cpp:member:`A3DRWParamsLoadData::m_sTessellation` member is used to decide how this is performed.

For more information about tessellation in HOOPS Exchange, see :doc:`/guide/geometry/getting_tessellation`.


Assembly Structure
==================

Many 3MF files may contain multiple components or objects. 
HOOPS Exchange represents these as a model tree that you can traverse using the standard structure APIs.

To learn more about exploring assemblies, see :ref:`assembly_traversal`.

Format-Specific Notes
=====================

As noted above, 3MF is a tessellation-only format. 
Consequently, other data such as Product Manufacturing Information (PMI) and Boundary Representation (B-rep) are not supported by the format, 
including when using 3MF with HOOPS Exchange.