Mesh Class

The Mesh class represents a mesh for drawing three-dimensional data.
Inheritance Hierarchy
SystemObject
  Tekla.Structures.Model.UIMesh

Namespace:  Tekla.Structures.Model.UI
Assembly:  Tekla.Structures.Model (in Tekla.Structures.Model.dll) Version: 2024.0.0+a110b435391768740483e3032720a566518c9a63
Syntax
[SerializableAttribute]
public sealed class Mesh

The Mesh type exposes the following members.

Constructors
  NameDescription
Public methodMesh
Creates a new empty mesh instance.
Public methodMesh(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.
Top
Properties
  NameDescription
Public propertyLines
An array list of indices (as integers) pointing to the points array list. Two consecutive indices always represent a single line.
Public propertyPoints
An array list of point objects representing the mesh points.
Public propertyTriangles
An array list of indices (as integers) pointing to the points array list. Three consecutive indices always represent a single triangle.
Top
Methods
  NameDescription
Public methodAddLine
Adds a new line in the mesh.
Public methodAddPoint
Adds a new point in the mesh.
Public methodAddTriangle
Adds a new triangle in the mesh.
Top
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
Was this helpful?
The feedback you give here is not visible to other users. We use your comments to improve the content.
Previous
Next