:orphan:

#################
SolidWorks Reader
#################

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

+----------------------------------------------------------------------+
|                        **SolidWorks**                                |
+-----------------------------------------+----------------------------+
| **File Extension**                      | SLDASM, SLDPRT             |
+-----------------------------------------+----------------------------+
| **Supported Versions**                  | From 97 up to 2026         |
+-----------------------------------------+----------------------------+
| **Platforms**                           | |wy| |ly| |my| |ay| |iy|   | 
+-----------------------------------------+----------------------------+
| :ref:`solidworks_rd_tess`               | |t_green|                  | 
+-----------------------------------------+----------------------------+
| :ref:`solidworks_brep`                  | |c_green|                  | 
+-----------------------------------------+----------------------------+
| :ref:`solidworks_rd_pmi`                | |c_green|                  | 
+-----------------------------------------+----------------------------+
| :ref:`solidworks_rd_views`              | |c_grey_g|                 | 
+-----------------------------------------+----------------------------+

SolidWorks is a software suite used for solid modeling computer-aided design and computer-aided engineering. This system and its native file format is currently supported by Dassault Systems.

Our SolidWorks Reader provides full access to the assembly, B-rep, visualization, view, and PMI data stored within a SolidWorks file. Although a file does not need to have a particular extension to be read correctly by HOOPS Exchange, the file extensions of SolidWorks files that you can expect to be loaded by HOOPS Exchange are:

* .SLDASM
* .SLDPRT


How to Import From SolidWorks 
=============================

To load a SolidWorks file, use :cpp:func:`A3DAsmModelFileLoadFromFile`.
The :cpp:struct:`A3DParamsLoadData` structure is used to customize the loading behavior. ``A3DRWParamsLoadData.m_sSpecifics.m_sSolidworks`` is used to load fields specific to this file type:

.. code-block:: c

   A3DAsmModelFile* pModelFile = 0;

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

   // ... set other A3DRWParamsLoadData specific fields as necessary
   sReadParam.m_sSpecifics.m_sSolidworks.m_bLoadAllConfigsData = A3D_TRUE;

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

See :doc:`/api/c/structures/A3DRWParamsSolidworksData`, which is a structure that specifies parameters used to read the model file from Solidworks format.

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

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


.. _solidworks_rd_tess:

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

The SolidWorks reader can directly access the visualization data stored within a SolidWorks file. This occurs if the reading mode in HOOPS Exchange is set to tessellation only.


.. _solidworks_brep:

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

SolidWorks uses Parasolid as its geometry engine.
As a result the reading of the B-rep in our SolidWorks reader is based on our Parasolid reader, which allows you to query the full topological and geometric model defined in a Parasolid file.
HOOPS Exchange provides evaluators which allow you to directly query all the geometry types available in Parasolid.
You can additionally ask HOOPS Exchange to approximate any specific geometry and provide it in a standard NURBS form.


The list of surface types available in SolidWorks is:

* Blend surface
* B-spline surface
* Cone
* Cylinder
* Offset surface
* Plane
* Sphere
* Revolution surface
* Swept surface
* Torus

The list of curve types available in SolidWorks is:

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


.. _solidworks_rd_views:

Views
=====

Our reader supports SolidWorks named views. Section views are not supported by HOOPS Exchange. 


.. _solidworks_rd_pmi:

PMI
===

HOOPS Exchange provides access to all PMI data available in a SolidWorks model file (Reference and DimXpert annotations).
The only exception is Stacked Balloon which is currently not available.


SolidWorks Features Support
===========================

Feature tree reading is supported with SolidWorks, with access to detailed information for holes, patterns and threads.
Pitch, handedness and tip angle data are not retrieved for threads contained in holes.

When available the feature geometry association (faces) is supported.

For features that reference sketches (extrusions, revolutions, sweeps, blends and lofts), a construction connection is created
linking the feature to its input sketch(es) via their persistent IDs. This allows consumers to navigate from a feature back to
its associated sketch(es) using :c:func:`A3DFRMLinkedItemGet` with link type ``kA3DFRMLink_Construction``.


Textures
========

The SolidWorks reader supports diffuse textures.


.. _slw_support_decals:

Support for Decals
------------------

Decals are special textures generally used for displaying product markings on a model.
As of 2023 U1, HOOPS Exchange supports the reading of Decals in SolidWorks through our :ref:`materials and textures API <pg_get_materials_and_textures>`.

.. rubric:: UV-Mapping

Decals textures are projected using *planar*, *spherical*, *cylinder* or *label* projections.
Label projections are a special type of *uv* texture-mapping that avoid stretching, which makes it suitable for text decals.

.. rubric:: Decals mask

SolidWorks allows to provide a masking texture or a color to define the partial transparency of decals.
This feature is supported within our reader by transforming masking information into alpha component for the in-memory textures.

.. rubric:: Limitations

Currently, our SolidWorks reader does not support multiple textures on a same face.
This limitation makes Decal and texture supports mutually exclusive.
The behavior in such case is that if a read face contains both a texture and a decal, the texture has precedence.

Multi-face decals are not supported.


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

Units for files up to SLW 2007 are by default expressed in `g/mm^3`.
