:orphan:

###########
Creo Reader
###########

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

+------------------------------------------------------------------------------+
|                        **Creo - Pro/E**                                      |
+-----------------------------------------+------------------------------------+
| **File Extension**                      | ASM, NEU, PRT, XAS, XPR            |
+-----------------------------------------+------------------------------------+
| **Supported Versions**                  | Pro/Engineer 19.0 to Creo 12.4.0.0 |
+-----------------------------------------+------------------------------------+
| **Platforms**                           | |wy| |ly| |my| |an| |iy|           | 
+-----------------------------------------+------------------------------------+
| :ref:`creo_tessellation`                | |c_green| Supported                | 
+-----------------------------------------+------------------------------------+
| :ref:`creo_brep`                        | |c_green| Supported                | 
+-----------------------------------------+------------------------------------+
| :ref:`creo_pmi`                         | |c_green| Supported                | 
+-----------------------------------------+------------------------------------+

Creo file types are native CAD formats used by PTC Creo/Pro-E to store parts, 
assemblies, and product data for mechanical design.

The HOOPS Exchange Creo reader provides full access to the assembly tree, exact 
B-rep geometry, view definitions, and PMI data stored in Creo files, enabling 
complete extraction of native CAD model information.

A file does not need to have a particular extension to be read correctly by HOOPS Exchange.
However, the file extensions of Creo files that you can expect to be loaded by HOOPS 
Exchange include:

* ``.ASM``
* ``.NEU``
* ``.PRT``
* ``.XAS``
* ``.XPR``

How to Import From Creo
=======================

Reading ``Creo`` files follows the same pattern as other formats: configure load parameters, then call the standard load function.

To load a Creo file, use :cpp:func:`A3DAsmModelFileLoadFromFile`.
The :cpp:struct:`A3DParamsLoadData` structure is used to customize the loading behavior:

.. code-block:: c

   A3DAsmModelFile* pModelFile = 0;

   A3DRWParamsLoadData sReadParam = A3D_MAKE_DATA(A3DRWParamsLoadData);
   sReadParam.m_sGeneral.m_bReadSolids = true;

   // ... set other A3DRWParamsLoadData fields as necessary

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

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

.. _creo_tessellation: 

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

The visualization data for this format is generated by the HOOPS Exchange tessellation engine.

.. _creo_brep: 

Boundary Representation (B-rep)
===============================

HOOPS Exchange extracts the exact B-rep definition from the model. 
The list of surface types provided include:

* B-spline surface
* Cone
* Cylinder
* Cylindrical spline surface
* Fillet surface
* Plane
* Revolution surface
* Ruled surface
* Sphere
* Spline surface
* Swept surface
* Tabulated surface
* Torus

The list of available curve types include:

* B-spline
* Circle
* Ellipse
* Line
* Spline
* UV curve

.. _creo_pmi: 

Product Manufacturing Information (PMI)
=======================================

HOOPS Exchange provides access to all PMI data available within imported Creo files. 
This includes:

* Dimension (driven)
* Dimension (ordinate baseline)
* Dimension (ordinate driven)
* Dimension (ordinate reference)
* Dimension (reference)
* Geometric tolerance
* Note
* Set datum tag
* Surface finish
* Symbol

Assembly
========

HOOPS Exchange's Creo reader supports incremental load.

Additionally, both construction geometry and datum planes are supported and accessed through the assembly tree.

Boolean Operation Support
=========================

Boolean operations describe modeling operations that combine or modify solids, such as union, subtraction, 
and intersection, to produce derived geometry in a CAD model.

HOOPS Exchange provides the following options to control how the results of boolean operations are loaded when tessellation data is not available.

* ``BooleanOpUseGenericIfNoTess = A3D_FALSE``: Tessellation is loaded if available, otherwise nothing is loaded.
* ``BooleanOpUseGenericIfNoTess = A3D_TRUE`` : Tessellation is loaded if available, otherwise the generic is loaded.

Family Table Support
====================

Family tables define a set of related part or assembly variants that share a common base model, with variations controlled by parameters such as dimensions, features, or component inclusion.

The HOOPS Exchange Creo file reader has the following behaviors when loading a model with family tables:

* If the source file was saved _with_ the instance accelerator, HOOPS Exchange will be able to load the file and the associated XPR/XAS files. 
  The resulting model will look exactly the same as in Creo.
* When loading a part or assembly, the generic instance is not loaded by default. 
  Instead, only the tessellation is loaded, if it is found. 
  A warning message is written in the log file mentioning the fact that this file contains a family table and that XPR/XAS files must be 
  created from Creo to be displayed properly in HOOPS Exchange.

HOOPS Exchange provides the following file reader options regarding family tables: 

* ``FamilyTables = 0``: Use only XPR/XAS for family tables. Nothing displayed if XPR/XAS is missing. No family table data is loaded and a warning is written to the log file.
* ``FamilyTables = 1``: This is the default behavior value. Use tessellation if XPR/XAS is missing. The tessellation of the family table is loaded if found. Generics are not loaded by default anymore.
* ``FamilyTables = 2``: Use wire representation and generic if no tessellation and no XPR/XAS. This representation is the generic representation of the family table. It can be an incorrect representation compared to Creo.

HOOPS Exchange can represent the model more accurately with XPR/XAS files.
As such, generating them is recommended each time you handle family tables.

For more detailed information about importing Creo Family tables, please see this forum post: `How ProE/Creo family tables, flexible components and boolean operations are handled by HOOPS <https://forum.techsoft3d.com/t/faq-how-proe-creo-family-tables-flexible-components-and-boolean-operations-are-handled-by-hoops/1554>`_

Flexible Component Support
==========================

Flexible components are assembly components whose shape or position can change based on assembly context or constraints.

The generic representation of the flexible component is not loaded anymore by default.

* ``FlexibleCompUseGenericIfNoTess = A3D_FALSE``: Tessellation is loaded if available, otherwise nothing is loaded.
* ``FlexibleCompUseGenericIfNoTess = A3D_TRUE``: Tessellation is loaded if available, otherwise the generic is loaded.

Layers
======

Creo uses layers to control visibility, selection and appearance of various elements in a component, 
which can include parts, features, datums, annotations, and other entities.
These layers are defined by either including or excluding objects.

Unlike other formats, a Creo entity can belong to several layers.

:cpp:struct:`layer <A3DAsmLayer>` has been modified accordingly to store the Creo note, layer visibility status, and referenced entities.

In Creo, a dedicated layer is specifically used to keep track of items that have been hidden.
This layer is named *.BLACK_HOLE*.

Material colors
===============

Creo uses several internal parameters to define RGB colors set on a model.

Starting with HOOPS Exchange 2024.6.0, the following parameters are also read and set as generic attributes to :cpp:struct:`A3DGraphMaterialData` structure:

* CreoFlatColor: base color of a surface in Creo : 3 doubles (0. - 1.0) for RGB components
* CreoAmbient: double (0. - 1.0)
* CreoIntensity: double (0. - 1.0)
* CreoShine: double (0. - 1.0)
* CreoHighlight: double (0. - 1.0)
* CreoReflection: double (0. - 1.0)
* CreoTransmission: double (0. - 1.0)
* CreoHighlightColor : 3 doubles (0. - 1.0) for RGB components

The relations between these parameters and basic material properties are defined as:

* :cpp:member:`~A3DGraphMaterialData::m_uiAmbient`  = CreoFlatColor * CreoAmbient
* :cpp:member:`~A3DGraphMaterialData::m_uiDiffuse`  = CreoFlatColor * CreoIntensity
* :cpp:member:`~A3DGraphMaterialData::m_uiSpecular` = CreoHighlightColor * CreoShine
* :cpp:member:`~A3DGraphMaterialData::m_dShininess` = CreoHighlight

The global transparency parameter affected to a renderable object is defined by field :cpp:member:`A3DGraphStyleData::m_ucTransparency`:

* m_ucTransparency = (1. - CreoTransmission) * 255

Views
=====

There are two types of views supported in Creo:

* *Views:* 
  
  A view plane in addition to visibilities that are applied to the PMI entities. 
  **Home views** are also supported; This is a setting that allows you to create a view that is equivalent to the state in
  which the file has been saved.

* *Combined states:* 

  A complete camera configuration, including visibility settings for PMI, component visibility and transformations within the assembly, 
  and optional section plane definitions.
  Basic support is also provided for simplified representations, including master representations, exclusions, and user-defined representations.

All view types are fully supported by HOOPS Exchange.


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

HOOPS Exchange also supports:

* Persistent IDs
* User-defined coordinate systems
* Cosmetic geometry
* User attributes attached to geometrical elements or part / assembly nodes
* Entity names attached at all levels of the model (assemblies, parts, instances, faces, coordinate axes, etc.)
* Cables at assembly level

Additional Notes
================

* A density value of -1 means that no density was set in the CAD file.
* HOOPS Exchange cannot use family tables to modify the shape of a model.
* Creo does not account for the "Hidden" attribute in an .ASM file. This means that upon import, any parts marked as "Hidden" will not actually be so. To set a part as hidden, mark the representation of the instance as "exclude" in Creo.
