Mesh Class |
The Mesh class represents a mesh for drawing three-dimensional data.
Inheritance Hierarchy
Namespace: Tekla.Structures.Model.UI
Assembly: Tekla.Structures.Model (in Tekla.Structures.Model.dll) Version: 2023.0.3
Syntax
The Mesh type exposes the following members.
Constructors
Name | Description | |
---|---|---|
Mesh |
Creates a new empty mesh instance.
| |
Mesh(ArrayList, ArrayList, ArrayList) |
Creates a new mesh instance with the given points, triangles and lines. Does not check
the indices in the given triangles and lines array lists for correctness.
|
Properties
Name | Description | |
---|---|---|
Lines |
An array list of indices (as integers) pointing to the points array list. Two consecutive indices
always represent a single line.
| |
Points |
An array list of point objects representing the mesh points.
| |
Triangles |
An array list of indices (as integers) pointing to the points array list. Three consecutive indices
always represent a single triangle.
|
Methods
Name | Description | |
---|---|---|
AddLine |
Adds a new line in the mesh.
| |
AddPoint |
Adds a new point in the mesh.
| |
AddTriangle |
Adds a new triangle in the mesh.
|
Examples
using Tekla.Structures.Model.UI; using Tekla.Structures.Geometry3d; using System; public class ConeMesh { private Mesh _mesh; public Mesh Mesh { get { return _mesh; } } public ConeMesh(Point center, double height, double radius, int segmentCount) { _mesh = new Mesh(); Point centerTop = new Point(center); centerTop.Z = centerTop.Z + height; _mesh.Points.Add(centerTop); double x = center.X + radius * Math.Cos(0.0); double y = center.Y + radius * Math.Sin(0.0); double z = center.Z; Point p = new Point(x, y, z); _mesh.AddPoint(p); _mesh.AddLine(0, 1); for (int i = 1; i < segmentCount; i++) { x = center.X + radius * Math.Cos(i * (2 * Math.PI) / segmentCount); y = center.Y + radius * Math.Sin(i * (2 * Math.PI) / segmentCount); z = center.Z; p = new Point(x, y, z); _mesh.AddPoint(p); _mesh.AddTriangle(0, i, i + 1); _mesh.AddLine(0, i + 1); _mesh.AddLine(i, i + 1); } _mesh.AddTriangle(0, segmentCount, 1); _mesh.AddLine(segmentCount, 1); } } public class Example { public void Example1() { GraphicsDrawer drawer = new GraphicsDrawer(); ConeMesh cone = new ConeMesh(new Point(0.0, 0.0, 0.0), 5000.0, 5000.0, 100); drawer.DrawMeshSurface(cone.Mesh, new Color(1.0, 0.0, 0.0, 1.0)); drawer.DrawMeshLines(cone.Mesh, new Color(0.0, 0.0, 1.0)); } }
See Also