.. role:: ts-api-decorator

#########
ModelSpec
#########

.. js:module:: cee.ug
   :noindex:

.. container:: ts-api-section

   .. js:class:: ModelSpec

      Specification of what to show in the 3D viewer.

      The ModelSpec controls what to show in the 3D Viewer. You specify which state(s)/time step(s) to 
      show and which results to show. You can also specify a mode-shape animation.

      The ``ModelDirectory`` contains the list of available results and states that can be set in the ``ModelSpec``. 
      When calling changing state or result properties in this class it is checked against the 
      ``ModelDirectory`` and an exception is thrown if any of the ids are invalid.

      **Example:** Show the last state with a scalar result as filled contours.
 

      .. code-block:: javascript

         // Get the model and the model directory from the RemoteModel
         var modelDir = myModel.modelDirectory;
         var modelSpec = myModel.modelSpec;

         // Show the last state in the analysis
         modelSpec.stateIdArray = [modelDir.stateInfoArray[modelDir.stateInfoArray.length - 1].id];

         // Show the first scalar as filled contours (if any)
         if (modelDir.scalarResultArray.length > 0) {
             modelSpec.fringesResultId = modelDir.scalarResultArray[0].id;
         }




.. container:: api-index-section

   .. rubric:: Accessors

   .. rst-class:: api-index-list-item api-kind-accessor api-parent-kind-class

   * :js:attr:`~cee.ug.ModelSpec.displacementResultId`
   * :js:attr:`~cee.ug.ModelSpec.fringesResultId`
   * :js:attr:`~cee.ug.ModelSpec.modeShapeAnimationType`
   * :js:attr:`~cee.ug.ModelSpec.modeShapeFrameCount`
   * :js:attr:`~cee.ug.ModelSpec.modeShapeInterpolateScalars`
   * :js:attr:`~cee.ug.ModelSpec.showComplementOfVisibleSets`
   * :js:attr:`~cee.ug.ModelSpec.stateIdArray`
   * :js:attr:`~cee.ug.ModelSpec.useTransformationResult`
   * :js:attr:`~cee.ug.ModelSpec.vectorResultIdArray`
   * :js:attr:`~cee.ug.ModelSpec.visibleSetIdArray`



.. container:: api-index-section

   .. rubric:: Methods

   .. rst-class:: api-index-list-item api-kind-method api-parent-kind-class

   * :js:meth:`~cee.ug.ModelSpec.getAsProperties`
   * :js:meth:`~cee.ug.ModelSpec.getEffectiveFringesResultId`
   * :js:meth:`~cee.ug.ModelSpec.getOverridePartFringesResultId`
   * :js:meth:`~cee.ug.ModelSpec.removeAllOverridePartFringesResultIds`
   * :js:meth:`~cee.ug.ModelSpec.setFromProperties`
   * :js:meth:`~cee.ug.ModelSpec.setOverridePartFringesResultId`





------------

Accessors
=========

.. container:: ts-api-section

   .. js:function:: ModelSpec.displacementResultId()



      The id of the displacement result to use. A displacement result is a per node result that displaces the nodes in the model
      in every time step without redefining the elements.

      Use the ``DisplacementSettings`` object to control the scaling of the displacements.

      Set to -1 to show no displacements in the model.


      :rtype: number

   .. js:function:: ModelSpec.displacementResultId( resultId)

      :param resultId: None
      :type resultId: number


      :rtype: void



.. container:: ts-api-section

   .. js:function:: ModelSpec.fringesResultId()



      The id of the scalar result to show as textured fringes (filled contours) on the model.
      Use the ``ScalarSettings`` object to control how the scalar will be shown (range, color scheme, number of levels)

      Set to -1 (default) to show no scalars on the model.

      Note: The scalar fringes result Id can be overridden per part with the ``setOverridePartFringesResultId`` method.


      :rtype: number

   .. js:function:: ModelSpec.fringesResultId( resultId)

      :param resultId: None
      :type resultId: number


      :rtype: void



.. container:: ts-api-section

   .. js:function:: ModelSpec.modeShapeAnimationType()



      The type of mode shape animation to create: Quarter, Half or Full (default).


      :rtype: ModeShapeAnimationType

   .. js:function:: ModelSpec.modeShapeAnimationType( animType)

      :param animType: None
      :type animType: ModeShapeAnimationType


      :rtype: void



.. container:: ts-api-section

   .. js:function:: ModelSpec.modeShapeFrameCount()



      The number of frames to use for a mode shape animation. 

      A mode shape animation is an animation where the displacements of each node is interpolated between the undisplaced and the
      displaced positions. To setup a mode shape animation we recommend to have a displacement result specified in
      ``displacementResultId`` and exactly one state specified in ``stateIdArray``. 

      Set to 0 (default) to not use mode shape animation.

      Note: Although we support switching results in the middle of a mode shape animation, we recommend to setup 
      the desired (scalar, vector, displacement) results first and then setting the ``modeShapeFrameCount``.


      :rtype: number

   .. js:function:: ModelSpec.modeShapeFrameCount( frameCount)

      :param frameCount: None
      :type frameCount: number


      :rtype: void



.. container:: ts-api-section

   .. js:function:: ModelSpec.modeShapeInterpolateScalars()



      Specifies if the scalars should be interpolated during a mode-shape animation or not.


      :rtype: boolean

   .. js:function:: ModelSpec.modeShapeInterpolateScalars( interpolate)

      :param interpolate: None
      :type interpolate: boolean


      :rtype: void



.. container:: ts-api-section

   .. js:function:: ModelSpec.showComplementOfVisibleSets()



      Specifies that the complement of the current visible sets will be shown.

      If this option is enabled, only the elements that are NOT present in any of the visible sets
      will be shown.


      :rtype: boolean

   .. js:function:: ModelSpec.showComplementOfVisibleSets( showComplement)

      :param showComplement: None
      :type showComplement: boolean


      :rtype: void



.. container:: ts-api-section

   .. js:function:: ModelSpec.stateIdArray()



      The Ids of the states to show. An animation will be created if there is more than one item in the array.

      At least one state id must be specified in order to show the model.


      :rtype: unknown

   .. js:function:: ModelSpec.stateIdArray( stateIdsArr)

      :param stateIdsArr: None
      :type stateIdsArr: unknown


      :rtype: void



.. container:: ts-api-section

   .. js:function:: ModelSpec.useTransformationResult()



      Whether the rigid body transformation result should be used (if present).

      Default is true.


      :rtype: boolean

   .. js:function:: ModelSpec.useTransformationResult( useTransformationResult)

      :param useTransformationResult: None
      :type useTransformationResult: boolean


      :rtype: void



.. container:: ts-api-section

   .. js:function:: ModelSpec.vectorResultIdArray()



      The array of vector result ids to show as vector arrows on the model surface.
      Use the ``VectorSettings`` object to control how the vectors will be shown (color, scaling, filtering, clamping)

      Set to [] (default) to show no vectors on the model. [-1] is interpreted as [] for convenience.


      :rtype: unknown

   .. js:function:: ModelSpec.vectorResultIdArray( resultIdArray)

      :param resultIdArray: None
      :type resultIdArray: unknown


      :rtype: void



.. container:: ts-api-section

   .. js:function:: ModelSpec.visibleSetIdArray()



      If the array is not empty, the given set ids will be used to define which elements are visible.
      The union of the elements in the specified visible sets will be considered visible.

      You can show the complement of the visible set by setting the showComplementOfVisibleSets property to true.

      Set to [] (default) to disable set filtering on the model. [-1] is interpreted as [] for convenience.


      :rtype: unknown

   .. js:function:: ModelSpec.visibleSetIdArray( setIdArray)

      :param setIdArray: None
      :type setIdArray: unknown


      :rtype: void



Methods
=======

.. rst-class:: ts-api-section

getAsProperties
---------------

.. js:method:: ModelSpec.getAsProperties()



   Gets the settings for this model spec as a Plain Old JavaScript Object (POJO).


   :rtype: ModelSpecProperties

.. rst-class:: ts-api-section

getEffectiveFringesResultId
---------------------------

.. js:method:: ModelSpec.getEffectiveFringesResultId( geometryIndex, partId)

   :param geometryIndex: None
   :type geometryIndex: number
   :param partId: None
   :type partId: number


   Returns the id of the scalar result shown on the given part. Will return fringesResultId if no override result was
   specified for the given part.


   :rtype: number

.. rst-class:: ts-api-section

getOverridePartFringesResultId
------------------------------

.. js:method:: ModelSpec.getOverridePartFringesResultId( geometryIndex, partId)

   :param geometryIndex: None
   :type geometryIndex: number
   :param partId: None
   :type partId: number


   Returns the result id that is specified to override any global setting on the given part.
   If no override is provided, it will return -1.


   :rtype: number

.. rst-class:: ts-api-section

removeAllOverridePartFringesResultIds
-------------------------------------

.. js:method:: ModelSpec.removeAllOverridePartFringesResultIds()



   Remove any overridden scalar fringes result ids for any parts.

   All parts will after this follow the global setting (``ModelSpec.fringesResultId``)


   :rtype: void

.. rst-class:: ts-api-section

setFromProperties
-----------------

.. js:method:: ModelSpec.setFromProperties( props)

   :param props: None
   :type props: Partial <ModelSpecProperties>


   Applies the settings in the given properties object to this model spec.


   :rtype: void

.. rst-class:: ts-api-section

setOverridePartFringesResultId
------------------------------

.. js:method:: ModelSpec.setOverridePartFringesResultId( geometryIndex, partId, fringesId)

   :param geometryIndex: None
   :type geometryIndex: number
   :param partId: None
   :type partId: number
   :param fringesId: None
   :type fringesId: number


   Specify to show the given scalar result on the given part as scalar fringes.

   This overrides any global fringes setting for the given part.


   :rtype: void

