Class Mesh
A collection of MeshParts representing different detail levels of a Part.
Namespace: ABB.Robotics.RobotStudio.Stations
Assembly: ABB.Robotics.RobotStudio.Stations.dll
Syntax
public sealed class Mesh : IEnumerable<MeshPart>, IEnumerable, IDisposable
Constructors
Mesh()
Creates an empty Mesh.
Declaration
public Mesh()
Remarks
The mesh must be disposed after use.
Properties
Item[DetailLevels]
Returns the MeshPart for the specified detail level, if it exists.
Declaration
public MeshPart this[DetailLevels detailLevel] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
DetailLevels | detailLevel |
Property Value
Type | Description |
---|---|
MeshPart |
Shape
ABB internal use
Declaration
public IGfxGeoShape Shape { get; }
Property Value
Type | Description |
---|---|
RobotStudio.API.Internal.IGfxGeoShape |
Methods
Clear()
Clears managed vertex data cached by this Mesh.
Declaration
public void Clear()
Remarks
Does not delete the internal data structures used by the graphics subsystem.
Clear(Boolean)
Clears managed vertex data cached by this Mesh, and optionally discards all MeshPart, MeshBody and MeshFace objects.
Declaration
public void Clear(bool keepEntities)
Parameters
Type | Name | Description |
---|---|---|
Boolean | keepEntities |
Closest(DetailLevels)
Returns the available detail level, which is as close as possible to the one specified.
Declaration
public MeshPart Closest(DetailLevels detailLevel)
Parameters
Type | Name | Description |
---|---|---|
DetailLevels | detailLevel |
Returns
Type | Description |
---|---|
MeshPart |
Dispose()
Call this to free unmanaged resources of a mesh created with Mesh() or Load(String). Do not call this for Mesh.
Declaration
public void Dispose()
Finalize()
Declaration
protected void Finalize()
GetCollisionGeometryAsync(Boolean, Int32)
Declaration
public Task<MeshPart> GetCollisionGeometryAsync(bool create, int quality = -1)
Parameters
Type | Name | Description |
---|---|---|
Boolean | create | Create the collision geometry if it does not already exist. |
Int32 | quality | Quality of the collision geometry from 0 (lowest) to 3 (highest), or -1 to use the default. |
Returns
Type | Description |
---|---|
Task<MeshPart> |
Remarks
Can be quite time consuming for a large mesh and/or high quality. If the collision geometry does not already exist and create is false, null will be returned. If the collision geometry already exists, the quality flag is ignored. Call RemoveCollisionGeometry() first to recreate the collision geometry with the desired quality.
GetCollisionGeometryAsync(Boolean, Int32, CancellationToken)
Declaration
public Task<MeshPart> GetCollisionGeometryAsync(bool create, int quality, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
Boolean | create | Create the collision geometry if it does not already exist. |
Int32 | quality | Quality of the collision geometry from 0 (lowest) to 3 (highest), or -1 to use the default. |
CancellationToken | cancellationToken | CancellationToken to cancel the collision geometry generation |
Returns
Type | Description |
---|---|
Task<MeshPart> |
Remarks
Can be quite time consuming for a large mesh and/or high quality. If the collision geometry does not already exist and create is false, null will be returned. If the collision geometry already exists, the quality flag is ignored. Call RemoveCollisionGeometry() first to recreate the collision geometry with the desired quality.
Exceptions
Type | Condition |
---|---|
OperationCanceledException | The operation was canceled by the CancellationToken. |
GetConvexDecomposition(Boolean, IProgressCallback)
Declaration
olete("Use GetCollisionGeometry() instead")]
public MeshPart GetConvexDecomposition(bool create, IProgressCallback progress)
Parameters
Type | Name | Description |
---|---|---|
Boolean | create | |
IProgressCallback | progress |
Returns
Type | Description |
---|---|
MeshPart |
GetEnumerator()
Declaration
public IEnumerator GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator |
GetInfo()
Returns the size and memory usage of this Mesh.
Declaration
public MeshInfo GetInfo()
Returns
Type | Description |
---|---|
MeshInfo |
Remarks
If the mesh has been modified, Rebuild() should be called before GetInfo().
Load(String)
Loads a Mesh from an .rsgfx file
Declaration
public static Mesh Load(string fileName)
Parameters
Type | Name | Description |
---|---|---|
String | fileName |
Returns
Type | Description |
---|---|
Mesh |
Optimize(OptimizeMeshParameters, ProgressNotification)
Merges faces and vertices to improve memory usage and rendering performance.
Declaration
public void Optimize(OptimizeMeshParameters parameters, ProgressNotification progress)
Parameters
Type | Name | Description |
---|---|---|
OptimizeMeshParameters | parameters | |
ProgressNotification | progress |
Remarks
All MeshBody/MeshFace objects will be reconstructed. Call Rebuild() to update the internal data used by the graphics subsystem.
Rebuild()
Rebuilds the mesh.
Declaration
public void Rebuild()
Remarks
Call Rebuild() after modifying or building a mesh to update the internal data structures used by the graphics subsystem. Rebuild() automatically calls Clear() to unreference cached vertex data.
Exceptions
Type | Condition |
---|---|
ApplicationException | Thrown if the structure of the mesh is not valid. |
Rebuild(ProgressNotification)
Rebuilds the mesh.
Declaration
public void Rebuild(ProgressNotification progress)
Parameters
Type | Name | Description |
---|---|---|
ProgressNotification | progress |
Remarks
Call Rebuild() after modifying or building a mesh to update the internal data structures used by the graphics subsystem. Rebuild() automatically calls Clear() to unreference cached vertex data. Note that the order of faces within each body may be different after a call to this method.
Exceptions
Type | Condition |
---|---|
ApplicationException | Thrown if the structure of the mesh is not valid. |
RemoveCollisionGeometry()
Removes the collision geometry from the persisted data.
Declaration
public void RemoveCollisionGeometry()
Save(String)
Saves this Mesh to an .rsgfx file
Declaration
public void Save(string fileName)
Parameters
Type | Name | Description |
---|---|---|
String | fileName |
SetMaterial(Material)
Sets the Material of all faces in this mesh.
Declaration
public void SetMaterial(Material material)
Parameters
Type | Name | Description |
---|---|---|
Material | material |
Transform(Matrix4)
Transforms all vertices and normals in the Mesh.
Declaration
public void Transform(Matrix4 matrix)
Parameters
Type | Name | Description |
---|---|---|
Matrix4 | matrix |
Transform(Matrix4, ProgressNotification)
Transforms all vertices and normals in the Mesh.
Declaration
public void Transform(Matrix4 matrix, ProgressNotification progress)
Parameters
Type | Name | Description |
---|---|---|
Matrix4 | matrix | |
ProgressNotification | progress |
TraverseFaces(Action<MeshFace>)
Performs an action on all MeshFaces in this Mesh
Declaration
public void TraverseFaces(Action<MeshFace> action)
Parameters
Type | Name | Description |
---|---|---|
Action<MeshFace> | action |