# cee.usg

The usg sub-module provides functionality for working client side with unstructured surface grids

Assuming that the EnvisionWeb client component has been imported into the variable `cee`, members of the usg module may be referenced using the `cee.usg` prefix, e.g.:

    var model = new cee.usg.UnstructGridModel();

The `UnstructGridModel` implements a client side model for handling surface CAE models. It handles surface elements with any number of nodes. A model has one or more `State``s, which links a ``Geometry` to scalar, displacement and transformation results for that geometry in that state.

The example application DemoAppUsg shows an example on how to use the UnstructGridModel to simulate streaming of scalar and displacement results.

Here is a simple example of how to create an usg model containing a single quad element with a per node scalar result in one state:

    let model = new cee.usg.UnstructGridModel();
    this.m_view.addModel(model);

    let geometry = new cee.usg.Geometry();
    let part = geometry.addPart();

    // Create a single quad mesh
    const nodeArr = [0,0,0, 1,0,0, 1,1,0, 0,1,0];
    const elConnArr = [0,1,2,3];
    part.mesh = new cee.usg.Mesh(nodeArr, 4, elConnArr);

    // Configure the visual appearance of the part
    part.settings.color = new cee.Color3(1,0,0);
    part.settings.drawStyle = cee.usg.DrawStyle.SURFACE_MESH;

    // Create a state, set the geometry and add the scalar result
    let state = model.addState();
    state.geometry = geometry;

    let scalarArr = [1,2,3,4];
    state.setPartFringesAt(0, new cee.usg.PartScalars(cee.usg.ResultMapping.PER_NODE, scalarArr));

    // Configure the mapper to use, and
    const mapper = new cee.ScalarMapperFilledContoursUniform();
    mapper.colorArray = cee.ColorTableFactory.color4TableArray(cee.ColorTable.RAINBOW, 15);
    mapper.setRange(1,4);
    model.fringesSettings.scalarMapper = mapper;

    // Add a color legend based on the mapper
    this.m_view.overlay.addCustomColorLegendForScalarMapper(mapper, "Demo result", 1);

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

Enumerations

- DrawStyle
- ResultMapping
- ScaleMode
- VizStateStrategy

Classes

- `DisplacementSettings`
- `ElementHighlighter`
- `Geometry`
- `Mesh`
- `MeshQuery`
- `Part`
- `PartDisplacements`
- `PartScalars`
- `PartSettings`
- `PartVectors`
- `ScalarSettings`
- `State`
- `UnstructGridModel`
- `VectorSettings`

Interfaces

- `HitItem`
- `OptionalMeshData`
- `UnstructGridModelOptions`

Conversation saved
HOOPSY BETA

### Hello! I'm HOOPSY

Your Docs generative AI assistant. Ask me anything about HOOPS Envision for Web or choose a sample question below to start a conversation:

What is HOOPS Envision for Web?
What are the latest release notes for HOOPS Envision for Web?
How do I start evaluating HOOPS Envision for Web?
How do I write my first sample application?
How can I get assistance?

HOOPSY may store conversations according to OpenAI's policy. Responses may not always be accurate.

HOOPSY is thinking...