:orphan:

###########
STEP Writer
###########

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

+------------------------------------------------------------------------------------------+
|              **Standard for the Exchange of Product Data (STEP)**                        |
+-----------------------------------------+------------------------------------------------+
| **File Extension**:                     | STEP STP STPZ                                  |
+-----------------------------------------+------------------------------------------------+
| **Supported Versions**                  | AP 203 Ed2 - AP 214 Ed1 - AP 242 Ed1, Ed2, Ed3 |
+-----------------------------------------+------------------------------------------------+
| **Platforms**                           | |wy| |ly| |my| |ay| |iy|                       |
+-----------------------------------------+------------------------------------------------+
| :ref:`stp_wt_tessellation`              | |c_green| Supported                            |
+-----------------------------------------+------------------------------------------------+
| :ref:`stp_wt_brep`                      | |c_green| Supported                            |
+-----------------------------------------+------------------------------------------------+
| :ref:`stp_wt_pmi`                       | |c_green| Supported                            |
+-----------------------------------------+------------------------------------------------+
| **Assembly**                            | |c_green| Supported                            |
+-----------------------------------------+------------------------------------------------+
| **Views**                               | |c_grey_g|                                     |
+-----------------------------------------+------------------------------------------------+

The STEP file format was created by the International Organization for Standardization (ISO). It was developed to facilitate the exchange of 3D data between different CAD systems and was first published in 1994. The format is defined in the ISO 10303-21 standard, which ensures compatibility across various CAD applications.

STEP (Standard for the Exchange of Product Data) is a widely-used ISO standard file format for representing 3D product data.
It is commonly employed in industries such as manufacturing, engineering, and aerospace for exchanging 3D models between different CAD systems.
The STEP format supports detailed and accurate representations of 3D objects, including geometry, topology, and product manufacturing information (PMI).
This makes it ideal for applications requiring interoperability, data exchange, and long-term archiving of product information.

Our STEP reader provides full access in :doc:`reading <step_reader>` and writing to the assembly, B-rep and PMI.

STEP uses Application Protocols (AP) as versions, which can be seen as specific subsets of the STEP standard.

How to Export to STEP
=====================

To export a model file to STEP format, call :cpp:func:`A3DAsmModelFileExportToStepFile`.
The format-specific :cpp:struct:`A3DRWParamsExportStepData` is used to describe how to export it.

.. code-block:: c

   A3DRWParamsExportStepData sParamsExportData = A3D_MAKE_DATA(A3DRWParamsExportStepData);
   // ... set export parameter options

   A3DAsmModelFileExportToStepFile(pModelFile, &sParamsExportData, "path/to/file.step");

.. rubric:: Compression

The full assembly tree is exported with all the instancing information maintained.
Views, camera definitions, sections, and PMI visibility are supported by our STEP file writer.

To export to a compressed STEP file, change the output file extension to *"stpz"*.
Please note that this feature is only available with STEP AP 242 standard.



.. _stp_wt_tessellation:

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

Our STEP writer supports the export of tessellated geometry to the AP242 format.
This includes tessellated solids, shells, wires, and point sets.


HOOPS Exchange only export tessellated data from import files originally containing only tessellation data.
As such, to write to tessellated STEP, your originating file needs to have been imported with :c:member:`A3DRWParamsGeneralData.m_eReadGeomTessMode` set to `kA3DReadTessOnly`.
Writing B-rep and tessellation together is not yet supported.

If a part contains solids with no B-rep, all of the geometry for this part will be exported as tessellated geometry for the AP242 format.
This includes ``TESSELLATED_SOLID``, ``TESSELLATED_SHELL``, ``TESSELLATED_WIRE``, and ``TESSELLATED_POINT_SET``.

.. _stp_wt_brep:

B-rep
=====

When we export to STEP we look at the source data and map each surface to one of the following:

* ``B_SPLINE_SURFACE``
* ``B_SPLINE_SURFACE_WITH_KNOTS``
* ``CONICAL_SURFACE``
* ``CYLINDRICAL_SURFACE``
* ``DEGENERATE_TOROIDAL_SURFACE``
* ``OFFSET_SURFACE``
* ``RATIONAL_B_SPLINE_SURFACE``
* ``RECTANGULAR_TRIMMED_SURFACE``
* ``SPHERICAL_SURFACE``
* ``SURFACE_OF_REVOLUTION``
* ``TOROIDAL_SURFACE``

Curves are mapped to:

* ``B_SPLINE_CURVE``
* ``B_SPLINE_CURVE_WITH_KNOTS``
* ``CIRCLE``
* ``COMPOSITE_CURVE``
* ``POLYLINE``
* ``RATIONAL_B_SPLINE_CURVE``

.. _stp_wt_pmi:

PMI
===

PMI is supported by our STEP file writer.
HOOPS Exchange supports export of semantic PMI to the STEP AP242 format.

This includes:

* ``ANGULARITY_TOLERANCE``
* ``CIRCULAR_RUNOUT_TOLERANCE``
* ``COAXIALITY_TOLERANCE``
* ``CONCENTRICITY_TOLERANCE``
* ``CYLINDRICITY_TOLERANCE``
* ``DATUM_FEATURE``
* ``DATUM_TARGET``
* ``DIMENSIONAL_LOCATION``
* ``DIMENSIONAL_SIZE``
* ``FLATNESS_TOLERANCE``
* ``GEOMETRIC_TOLERANCE_WITH_DATUM_REFERENCE``
* ``GEOMETRIC_TOLERANCE_WITH_DEFINED_AREA_UNIT``
* ``GEOMETRIC_TOLERANCE_WITH_DEFINED_UNIT``
* ``GEOMETRIC_TOLERANCE_WITH_MAXIMUM_TOLERANCE``
* ``GEOMETRIC_TOLERANCE_WITH_MODIFIERS``
* ``LINE_PROFILE_TOLERANCE``
* ``MODIFIED_GEOMETRIC_TOLERANCE``
* ``PARALLELISM_TOLERANCE``
* ``PERPENDICULARITY_TOLERANCE``
* ``POSITION_TOLERANCE``
* ``ROUNDNESS_TOLERANCE``
* ``STRAIGHTNESS_TOLERANCE``
* ``SURFACE_PROFILE_TOLERANCE``
* ``SYMMETRY_TOLERANCE``
* ``TOTAL_RUNOUT_TOLERANCE``
* ``UNEQUALLY_DISPOSED_GEOMETRIC_TOLERANCE``

It is possible to export PMI representation as polylines (text will be outlined) or tessellated (text will be filled).

Miscellaneous
=============

The following information is also supported for export by our STEP writer:

* File attributes
  * *Authorization Name*.
  * *Organization Name*
  * *User Name*
* User-defined attributes on geometry and part (AP242 only)
* validation properties on geometry, part and PMI (AP242 only)

Limitations
===========

Currently the HOOPS Exchange API does not support export of STEP drawings.
