Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RemoteModel

A remote server CAE model that can be displayed in the client viewer.

The RemoteModel is the controller of the visualization of the CAE model. Using this class you can specify which results to show on the model, set part settings as well as create cutting planes, isosurfaces, isovolumes and particle traces.

Use openModel to open a CAE model residing on the server. Once the optional callback passed to openModel is called, the ModelDirectory will have been populated and you can configure the initial view of the model. If a callback is not provided to openModel then the first state is shown.

Example: Minimal app, open default model on server:

   var mySocket = io.connect('http://localhost:8998', {reconnection:false});
   var canvas = document.getElementById("myGlCanvas");

   mySession = new cee.CloudSession();

   myViewer = mySession.addViewer(canvas);
   if (!myViewer) {
       return alert("No WebGL support");
   }

   myModel = new cee.ug.RemoteModel(mySocket);
   var myView = myViewer.addView();
   myView.addModel(myModel);

   myModel.openModel("");

   function myAnimationFrameCallback(highResTimestamp) {
       mySession.handleAnimationFrameCallback(highResTimestamp);
       requestAnimationFrame(myAnimationFrameCallback);
   }

   requestAnimationFrame(myAnimationFrameCallback);

The ModelSpec is the object you use to specify what to show in the remote model. Here you set which state(s) and results (scalar, vector, displacements) to display. You can setup a state animation by setting ModelSpec.stateIdArray, or setup a mode shape animation with ModelSpec.modeShapeFrameCount and ModelSpec.modeShapeAnimationType. Animation is controlled by the Animation class which can be accessed with animation.

You can access PartSettings objects with getPartSettingsById and use them to set various part attributes such visibility, color, opacity and draw style.

You can control how results are rendered with ScalarSettings, VectorSettings and DisplacementSettings objects, which can be accessed with getScalarSettingsById, getVectorSettingsById and getDisplacementSettingsById respectively.

For volumetric models, you can add any number of cutting plane, isosurface, isovolume and particle trace group objects to gain insight into the result distribution (e.g. flow field) within the model. The settings of these items can be controlled with the CuttingPlane, Isosurface, Isovolume, and ParticleTraceGroup objects. Use getCuttingPlaneById, getIsosurfaceById, getIsovolumeById and getParticleTraceGroupById to access such objects.

Picking is also done in the RemoteModel. Use rayIntersect to perform picking on the remote server model. This method takes a callback which is called when the picking result is available.

Example: Show the last state with the first scalar result and modify part settings

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

   // Show the last state in the analysis
   var modelSpec = myModel.modelSpec;
   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;
   }

   // Modify the part settings: First part transparent, the rest with element mesh
   for (var i = 0; i < myModel.partCount; ++i) {
       var partSettings = myModel.getPartSettingsAt(i);

       if (i == 0) {
           partSettings.drawStyle = cee.ug.DrawStyle.SURFACE;
           partSettings.opacity = 0.5;
       } else {
           partSettings.drawStyle = cee.ug.DrawStyle.SURFACE_MESH;
       }
   }

This code sample produces the following image in the 3D Viewer:

alt text

Hierarchy

Index

Constructors

Accessors

Methods

Constructors

constructor

  • Creates a RemoteModel.

    A socket connection to a live CeeCloudServer must be provided.

    Example:

       var mySocket = io.connect('http://localhost:8998', {reconnection:false});
       var myModel = new cee.ug.RemoteModel(mySocket, "");

    Parameters

    • socket: Socket

    Returns RemoteModel

Accessors

Readonly animation

animation: Animation

The animation control for this RemoteModel.

currentFrameIndex

currentFrameIndex: number

The step to show in the view.

Use this property to specify a single step of the currently specified animation to show in the viewer. The given zero-based index must be between 0 and frameCount - 1.

Setting the current frame index will stop the animation if it is running.

Readonly currentStepText

currentStepText: string

A description of the current step (e.g. time stamp, load case number, etc)

Readonly cuttingPlaneCount

cuttingPlaneCount: number

The number of cutting planes in the model.

Readonly displacementSettingsCount

displacementSettingsCount: number

The number of displacement settings in the model.

Readonly frameCount

frameCount: number

The number of steps/frames in the viewer.

The value of this property will be 1 if a model is loaded but contains no animation. If an animation has been setup then the value will be the number of animation steps.

Readonly isosurfaceCount

isosurfaceCount: number

The number of isosurfaces in the model.

Readonly isovolumeCount

isovolumeCount: number

The number of isovolumes in the model.

Readonly mirrorSettings

mirrorSettings: MirrorSettings

The mirror/symmetry settings for this RemoteModel

See MirrorSettings for more info.

Readonly modelDirectory

modelDirectory: ModelDirectory

The current ModelDirectory. This contains a table of contents of what is available to display in the analysis on the server (time steps, results, etc).

The ModelDirectory is available once the callback passed to openModel is called.

Readonly modelInfoString

modelInfoString: string

Information about this model.

Readonly modelSpec

modelSpec: ModelSpec

The specification of what to show in the remote model.

The ModelSpec controls what is shown in the RemoteModel (states, results, mode-shape animation).

name

name: string

Name of the geometry model.

Mainly used for debugging.

Readonly partCount

partCount: number

The number of parts in the model.

Readonly particleTraceGroupCount

particleTraceGroupCount: number

The number of particle trace groups in the model.

Readonly scalarSettingsCount

scalarSettingsCount: number

The number of scalar settings in the model.

Readonly vectorSettingsCount

vectorSettingsCount: number

The number of vector settings in the model.

Methods

addCuttingPlane

  • Adds a CuttingPlane to the remote model.

    This will add a new cutting plane to the model. The cutting plane will be assigned an id by the model.

    Note: Maximum number of clipping planes is 12

    Returns CuttingPlane

    Returns the new CuttingPlane.

addIsosurface

addIsovolume

addParticleTraceGroup

appendModel

  • Reload model, pick up any changes on the server since the open of the analysis.

    Parameters

    Returns void

applyVTFxCase

  • applyVTFxCase(caseId: number, applyCameraSettings?: boolean, openCompletedCallback?: OpenModelCallback): void
  • Apply the VTFx case with the given id to the model.

    The list of available VTFx cases with name and id can be found in ModelDirectory.vtfxCaseInfoArray

    Use applyCameraSettings to control if the camera settings from the case should be applied (true) or if you want to keep the current camera settings unchanged (false)

    Parameters

    • caseId: number
    • Default value applyCameraSettings: boolean = true
    • Optional openCompletedCallback: OpenModelCallback

    Returns void

clientSideRayIntersect

  • clientSideRayIntersect(ray: Ray): Vec3
  • Performs a client-side (not on server) ray pick.

    This might be faster or slower than a server pick request, depending on model size, latency, server capabilities and client capabilities.

    Returns the intersection point if something was hit, else returns null.

    Parameters

    Returns Vec3

closeModel

  • closeModel(): void
  • Closes the model, cleaning up on both the server and the client.

    Returns void

deleteAllCuttingPlanes

  • deleteAllCuttingPlanes(): void

deleteAllIsosurfaces

  • deleteAllIsosurfaces(): void
  • Deletes all Isosurfaces from the model.

    Returns void

deleteAllIsovolumes

  • deleteAllIsovolumes(): void
  • Delete all Isovolumes from the model.

    Returns void

deleteAllParticleTraceGroups

  • deleteAllParticleTraceGroups(): void

deleteCuttingPlaneById

  • deleteCuttingPlaneById(id: number): void
  • Deletes the CuttingPlane with the given id from the model.

    Parameters

    • id: number

    Returns void

deleteIsosurfaceById

  • deleteIsosurfaceById(id: number): void
  • Deletes the Isosurface with the given id from the model.

    Parameters

    • id: number

    Returns void

deleteIsovolumeById

  • deleteIsovolumeById(id: number): void
  • Deletes the Isovolume with the given id from the model.

    Parameters

    • id: number

    Returns void

deleteParticleTraceGroupById

  • deleteParticleTraceGroupById(id: number): void
  • Deletes the ParticleTraceGroup with the given id from the model.

    Parameters

    • id: number

    Returns void

enablePreloading

  • enablePreloading(enable: boolean): void
  • Enables pre-loading of data.

    If enabled, the server will stream all data specified in ModelSpec.stateIdArray to prepare the client for an animation or for stepping through the states.

    If not enabled (default), data will only be streamed when needed (i.e. when a step is going to be displayed).

    Parameters

    • enable: boolean

    Returns void

getBoundingBox

  • Returns the BoundingBox (in world coordinates) of the current contents of the RemoteModel

    Returns BoundingBox

getCuttingPlaneArray

getCuttingPlaneAt

  • Returns the CuttingPlane at the given index.

    The index must be between 0 and cuttingPlaneCount - 1.

    Use the returned object to modify the settings of the cutting plane.

    Parameters

    • index: number

    Returns CuttingPlane

getCuttingPlaneById

  • Returns the CuttingPlane with the given id, or null if no match is found.

    Use the returned object to modify the settings of the cutting plane.

    Parameters

    • id: number

    Returns CuttingPlane

getDisplacementSettingsArray

getDisplacementSettingsAt

  • Returns the DisplacementSettings for the result at the given index.

    The index must be between 0 and displacementSettingsCount - 1.

    Use the returned object to modify the settings of the displacement result.

    Parameters

    • resultIndex: number

    Returns DisplacementSettings

getDisplacementSettingsById

getIsosurfaceArray

getIsosurfaceAt

  • Returns the Isosurface at the given index.

    The index must be between 0 and isosurfaceCount - 1.

    Parameters

    • index: number

    Returns Isosurface

getIsosurfaceById

  • Returns the Isosurface with the given id, or null if no match is found.

    Parameters

    • id: number

    Returns Isosurface

getIsovolumeArray

  • getIsovolumeArray(): ReadonlyArray<Isovolume>

getIsovolumeAt

  • Returns the Isovolume at the given index.

    The index must be between 0 and isovolumeCount - 1.

    Parameters

    • index: number

    Returns Isovolume

getIsovolumeById

  • Returns the Isovolume with the given id, or null if no match is found.

    Parameters

    • id: number

    Returns Isovolume

getPartSettingsArray

getPartSettingsAt

  • Returns part settings for the part at the given index.

    The index must be between 0 and partCount - 1.

    Parameters

    • partIndex: number

    Returns PartSettings

getPartSettingsById

  • getPartSettingsById(geometryIndex: number, partId: number): PartSettings
  • Returns the part settings for the part with the given geometry index and part id.

    Parameters

    • geometryIndex: number

      The index of the geometry the part belongs to. In most cases there is only one geometry and this parameter should be 0.

    • partId: number

      The id of the part to find.

    Returns PartSettings

getParticleTraceGroupArray

getParticleTraceGroupAt

getParticleTraceGroupById

getScalarResultMaximumValue

  • getScalarResultMaximumValue(resultId: number): number
  • Returns the maximum value for all items currently loaded in the RemoteModel for the given scalar result.

    The resultId must refer to one of the scalar results in ModelDirectory.scalarResultArray.

    Parameters

    • resultId: number

    Returns number

    Returns undefined if the result has not been loaded or if the resultId is invalid.

getScalarResultMinimumValue

  • getScalarResultMinimumValue(resultId: number): number
  • Returns the minimum value for all items currently loaded in the RemoteModel for the given scalar result.

    The resultId must refer to one of the scalar results in ModelDirectory.scalarResultArray.

    Parameters

    • resultId: number

    Returns number

    Returns undefined if the result has not been loaded or if the resultId is invalid.

getScalarSettingsArray

getScalarSettingsAt

  • Returns the ScalarSettings for the result at the given index.

    The index must be between 0 and scalarSettingsCount - 1.

    Use the returned object to modify the settings of the scalar result

    Parameters

    • resultIndex: number

    Returns ScalarSettings

getScalarSettingsById

  • Returns the ScalarSettings for the result with the given result id, or null if no match is found.

    The resultId must refer to one of the scalar results in ModelDirectory.scalarResultArray.

    Use the returned object to modify the settings of the scalar result

    Parameters

    • resultId: number

    Returns ScalarSettings

getVectorSettingsArray

getVectorSettingsAt

  • Returns the VectorSettings for the result at the given index.

    The index must be between 0 and vectorSettingsCount - 1.

    Use the returned object to modify the settings of the vector result

    Parameters

    • resultIndex: number

    Returns VectorSettings

getVectorSettingsById

  • Returns the VectorSettings for the result with the given result id, or null if no match is found.

    The resultId must refer to one of the vector results in ModelDirectory.vectorResultArray.

    Use the returned object to modify the settings of the vector result

    Parameters

    • resultId: number

    Returns VectorSettings

isPollForDataSourceChangesInProgress

  • isPollForDataSourceChangesInProgress(): boolean
  • Returns true if a pollForDataSourceChanges call is in progress.

    Use this to check before calling pollForDataSourceChanges, as this will throw if a request is in flight

    Returns boolean

isPreloadingEnabled

  • isPreloadingEnabled(): boolean
  • Returns true if pre-loading is enabled.

    Returns boolean

openModel

  • openModel(modelKey: string, openCompletedCallback?: OpenModelCallback, configFlags?: string): void
  • Opens the model with the given modelKey in this RemoteModel.

    Opens a model on the server and prepares to stream it to the client. If the model is opened successfully (as indicated when the optional callback is invoked) the initial step of the CAE model will be streamed to the client.

    Parameters

    • modelKey: string

      The identifier of the model to open. This will be translated on the server into a filename before the model is opened. This translation is done by the modelFileFromKey() function that is provided to createServerInstance() on the visualization server.

    • Optional openCompletedCallback: OpenModelCallback

      Callback function that will be called when the model is ready to be used in the client. This will also be called if any errors occur (file not found etc.). When this is called the ModelDirectory will have been populated with the contents of the server CAE analysis.

    • Optional configFlags: string

      Internal flags to control the server. For testing purposes only.

      Example: Customize the initial appearance of the model in the callback:

         // Remove any old models
         var view = myViewer.getViewAt(0);
         view.removeAllModels();
      
         // Open a new RemoteModel from the CAE server
         var mySocket = io.connect('http://localhost:8998', {reconnection:false});
         myModel = new cee.ug.RemoteModel(mySocket, "");
         view.addModel(myModel);
      
         // Open the file on the server, setup the viz when it is done
         myModel.openModel("", function(err, model) {
             // Note: The model is now ready to use and the ModelDirectory is populated
             // with the model context received from the server
      
             // Show the first scalar as filled contours (if any)
             if (model.modelDirectory.scalarResultArray.length > 0) {
                 model.modelSpec.fringesResultId =
                      model.modelDirectory.scalarResultArray[0].id;
             }
      
             // Modify the part settings: First part transparent, the rest with surf mesh
             for (var ps of model.getPartSettingsArray()) {
                 ps.drawStyle = cee.ug.DrawStyle.SURFACE_OUTLINE_MESH;
                 ps.opacity = 0.5;
             }
         });

      This code sample produces the following image in the 3D Viewer:

      alt text

    Returns void

pollForDataSourceChanges

  • Poll the current data source for changes.

    Note: Only one poll can be in flight at any given time, so calling this method while a poll is being processed will throw. To make sure you do not do that, use the isPollForDataSourceChangesInProgress method to check for any ongoing polls.

    Parameters

    Returns void

rayIntersect

  • Performs picking on the remote server model.

    This will perform a picking action on the remote server with the given ray. The provided callback will be called when the result is available. The hitItem provided to this callback will contain detailed information about the element that was hit in the CAE model.

    To do the picking at the current state/time step, use the model.currentFrameIndex property.

    Parameters

    Returns void

reloadModel

  • Reload model, pick up any changes on the server since the open of the analysis.

    Parameters

    Returns void

sendToCloud

  • Share the model on the web using the Ceetron One-Click-Sharing service.

    With this method you can share the remote model (with the current settings) to the Ceetron Cloud cloud service.

    You can either use the default https://cloud.ceetron.com service, or use your own hosted sharing portal. The Ceetron Cloud Portal can be customized and installed on most cloud and on-premises servers.

    Parameters

    Returns void

setColorLegendTitle

  • setColorLegendTitle(resultId: number, title: string): void
  • Set the title of the color legend with the given result Id

    This will update any current legends, and also be used as the title whenever the legend is later created.

    Parameters

    • resultId: number
    • title: string

    Returns void

setCommunicationPerformanceHandler

  • Sets a handler function that will be called with information about the current communication.

    See CommunicationPerformanceData for more information.

    Parameters

    Returns void

setDrawStyleAllParts

  • setDrawStyleAllParts(drawStyle: DrawStyle, opacity?: number): void
  • Sets the draw style for all parts in the model

    This is just a helper for setting PartSettings.drawStyle for all parts in the model, and optionally set opacity if provided.

    Parameters

    • drawStyle: DrawStyle
    • Optional opacity: number

    Returns void

setOneShotDataStreamingCompleteCallback

  • Sets a one- shot callback that will be called the next time we observe that data streaming is complete

    Parameters

    Returns void

setProgressHandler

  • Sets a handler function that will be called whenever a progress indication packet is received from the visualization server.

    Parameters

    Returns void

setResultCalculatorParams

setResultRangeChangedHandler

  • Specifies the handler function that will be called whenever any result changes in the model. This will be called when a result is loaded the first time or when changing time step.

    This might be useful for updating the UI, e.g. the minimum and maximum values on a slider for an isosurface.

    Parameters

    Returns void

setServerErrorHandler

  • Sets a handler function that will be called whenever an error packet is received from the visualization server.

    Parameters

    Returns void

Static getCustomServerInfo

  • getCustomServerInfo(socket: Socket, callback: function): void
  • Static method to get custom server info from the CeeCloudServer.

    This info is specified on the server in the createServerInstance() method or the constructor to ServerInstance.

    Default response is null.

    Parameters

    • socket: Socket
    • callback: function
        • (customData: any): void
        • Parameters

          • customData: any

          Returns void

    Returns void

Generated using TypeDoc