UnstructGridModel
-
class
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
States, which links aGeometryto scalar, displacement and transformation results for that geometry in that state.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:
Constructors
-
cee.usg.UnstructGridModel.constructor() - UnstructGridModel(options:
UnstructGridModelOptions):UnstructGridModelCreate the UnstructGridModel
Use the options to set the resource usage strategy for the model in a multi-state scenario. See
UnstructGridModelOptionsfor more info.Parameters
options:UnstructGridModelOptionsReturns:
UnstructGridModel
Accessors
-
cee.usg.UnstructGridModel.currentState() - get currentState():
StateThe zero based index of the state currently shown in the view. Returns null for an invalid
currentStateIndex.Returns:
State
-
cee.usg.UnstructGridModel.currentStateIndex() - get currentStateIndex(): number
The state to show in the view.
The given zero-based index must be between 0 and
stateCount- 1.Returns: number
set currentStateIndex(stateIndex: number): voidParameters
stateIndex: numberReturns: void
-
cee.usg.UnstructGridModel.displacementSettings() - get displacementSettings():
DisplacementSettingsSettings for the displacement results
Returns:
DisplacementSettings
-
cee.usg.UnstructGridModel.fringesSettings() - get fringesSettings():
ScalarSettingsSettings for the scalars shown as fringes on the model
Returns:
ScalarSettings
-
cee.usg.UnstructGridModel.name() Name of the model.
Mainly used for debugging.
get name(): stringThe name of the geometry model. Mainly used for debugging.
Returns: string
set name(name: string): voidName of the model.
Mainly used for debugging.
Parameters
name: stringReturns: void
-
cee.usg.UnstructGridModel.stateCount() - get stateCount(): number
Returns the number of states in this model
Returns: number
-
cee.usg.UnstructGridModel.vectorSettings() - get vectorSettings():
VectorSettingsSettings for the scalars shown as fringes on the model
Returns:
VectorSettings
Methods
-
cee.usg.UnstructGridModel.addState() - addState():
StateAdd a state to the model.
The added state is returned.
Returns:
State
-
cee.usg.UnstructGridModel.deleteAllStates() - deleteAllStates(): void
Delete all states in the model.
Returns: void
-
cee.usg.UnstructGridModel.deleteStateAt() - deleteStateAt(stateIndex: number): void
Delete a state at the given zero based index.
Parameters
stateIndex: numberReturns: void
-
cee.usg.UnstructGridModel.deleteStateRange() - deleteStateRange(startIndex: number, deleteCount: number): void
Delete a range of states. First state that will be deleted is the state with the given index If deleteCount is omitted, all states starting with the given index will be deleted.
Works similar to the splice method on Javascript arrays
Parameters
startIndex: number
deleteCount: number
Returns: void
-
cee.usg.UnstructGridModel.getBoundingBox() - getBoundingBox(_options:
ModelBoundingBoxOptions):BoundingBoxReturns the
BoundingBox(in world coordinates) of the current state within the model.The returned bounding box will reflect the currently visible objects in the model.
Note that this method does not support any
ModelBoundingBoxOptionsParameters
_options:ModelBoundingBoxOptionsReturns:
BoundingBox
-
cee.usg.UnstructGridModel.getDefaultCameraConfig() - getDefaultCameraConfig(): None
Returns default camera configuration, which is always null for this model.
Returns: None
-
cee.usg.UnstructGridModel.getFringesResultRange() - getFringesResultRange():
RangeGet the range of the scalar result in this model
Returns:
Range
-
cee.usg.UnstructGridModel.getStateArray() - getStateArray(): readonly
State[]Returns a readonly array of all the states in the model
Returns: readonly
State[]