
###################
A3DUnitGetFromValue
###################

.. c:function:: A3DEUnits A3DUnitGetFromValue(A3DDouble dUnit)

   .. rst-class:: sig-pretty-signature
   
      | :c:enum:`~A3DEUnits` A3DUnitGetFromValue(:c:type:`~A3DDouble` **dUnit**\ )
   
   Converts a units representation from ``A3DDouble`` to :c:enum:`~A3DEUnits`\ .
   
   
      14.1
   
   
   HOOPS Exchange stores most of its unit information as factors of millimeters, as described in :c:enum:`~A3DEUnits`\ . This function allows you to retrieve the correct unit enumeration given an input value. For example, a value of *10.* returns :c:enumerator:`~kA3DUnitCentimeter`\ .
   
   .. rubric:: Behavior
   
   
   To properly retrieve the correct :c:enum:`~A3DEUnits` for a given ``A3DDouble`` input, HOOPS Exchange compares it with the expected float value of each unit (as returned by :c:func:`~A3DUnitGetFromEnum`\ ) given a unit-specific threshold as presented by this table:
   
   **Enumerator**  \| **Value (millimeters)**  \| **Threshold** 
   
   
   - :c:enumerator:`~kA3DUnitAngstrom`  \| 1.e-7  \| 1.e-9
   - :c:enumerator:`~kA3DUnitAstronomical`  \| 1.495978707e14  \| 1.e2
   - :c:enumerator:`~kA3DUnitCentimeter`  \| 10.0  \| 0.01
   - :c:enumerator:`~kA3DUnitDecimeter`  \| 1.e2  \| 0.01
   - :c:enumerator:`~kA3DUnitDekameter`  \| 1.e4  \| 0.01
   - :c:enumerator:`~kA3DUnitFoot`  \| 12.0 \* 25.4  \| 0.01
   - :c:enumerator:`~kA3DUnitGigameter`  \| 1.e12  \| 1.
   - :c:enumerator:`~kA3DUnitHectometer`  \| 1.e5  \| 0.01
   - :c:enumerator:`~kA3DUnitInch`  \| 25.4  \| 0.01
   - :c:enumerator:`~kA3DUnitKilometer`  \| 1000000.0  \| 0.01
   - :c:enumerator:`~kA3DUnitLightYear`  \| 9.4607304725808e18  \| 1.e6
   - :c:enumerator:`~kA3DUnitMeter`  \| 1000.0  \| 0.01
   - :c:enumerator:`~kA3DUnitMicroInch`  \| 2.54e-5  \| 1.e-7
   - :c:enumerator:`~kA3DUnitMicron`  \| 1.e-3  \| 1.e-4
   - :c:enumerator:`~kA3DUnitMil`  \| 0.0254  \| 1.e-4
   - :c:enumerator:`~kA3DUnitMile`  \| 1760.0 \* 3.0 \* 12.0 \* 25.4  \| 0.01
   - :c:enumerator:`~kA3DUnitMillimeter`  \| 1.0  \| 0.01
   - :c:enumerator:`~kA3DUnitNanometer`  \| 1.e-6  \| 1.e-8
   - :c:enumerator:`~kA3DUnitParsec`  \| 64800.0 / PI \* 1.495978707e14  \| 1.e7
   - :c:enumerator:`~kA3DUnitPicas`  \| 25.4 / 6.0  \| 0.01
   - :c:enumerator:`~kA3DUnitPoint`  \| 25.4 / 72.0  \| 0.01
   - :c:enumerator:`~kA3DUnitUSSurveyFoot`  \| 1200000.0 / 3937.0  \| 1.e-4
   - :c:enumerator:`~kA3DUnitUSSurveyInch`  \| 100000.0 / 3937.0  \| 1.e-5
   - :c:enumerator:`~kA3DUnitUSSurveyMile`  \| 1760.0 \* 3600000.0 / 3937.0  \| 3937.,0.01
   - :c:enumerator:`~kA3DUnitUSSurveyYard`  \| 3.0 \* 1200000.0 / 3937.0  \| 1.e-4
   - :c:enumerator:`~kA3DUnitYard`  \| 3.0 \* 12.0 \* 25.4  \| 0.01
   
   If the provided value does not fall under any of these value ranges, the function returns :c:enumerator:`~kA3DUnitUnknown`\ .
   
   
   
      ::
   
         embed:rst:inline :doc:`/guide/units`
   
      , A3DEUnit, :c:func:`~A3DUnitGetFromEnum`\ , :c:func:`~A3DAsmModelFileGetUnit`
   
   
   **Parameters**
   
   
      **dUnit**\ : A unit value (in millimeter)
   
   
   **Returns**
   
   
      An :c:enum:`~A3DEUnits` value
   
   




