Search Results for

    Show / Hide Table of Contents

    Getting Geometry Details

    This example shows how the internal information(total number of indices and vertices) of CAD model varies with respect to different level of details.

    Solution

    1. Iterate through all the parts from the station.

      // Iterate through the collection of parts
      foreach (var part in GetStationParts())
      
    2. Assign meshPart to the available detail level, prioritizing medium detail, then coarse, and finally fine detail levels.

      // Determine the appropriate MeshPart instance based on level of detail
      MeshPart meshPart = part.Mesh[DetailLevels.Medium] ?? part.Mesh[DetailLevels.Coarse] ?? part.Mesh[DetailLevels.Fine];
      
    3. Determine the level of detail for meshPart, setting partLevelOfDetail to Medium, Coarse, or Fine based on which detail level meshPart matches.

      // Determine the selected level of detail  
      DetailLevels partLevelOfDetail = meshPart == part.Mesh[DetailLevels.Medium] ? DetailLevels.Medium :
                                       meshPart == part.Mesh[DetailLevels.Coarse] ? DetailLevels.Coarse :
                                       DetailLevels.Fine;
      
    4. Calculate total number of indices and vertices

      // Initialize total indices and vertices counters 
      int totalNoOfIndices = 0;
      int totalNoOfVertices = 0;
      
      // Calculate total number of indices and vertices
      foreach (MeshBody meshBody in meshPart.Bodies)
      {
          foreach (MeshFace meshFace in meshBody.Faces)
          {
              totalNoOfIndices += meshFace.TriangleIndices.Count;
              totalNoOfVertices += meshFace.Vertices.Count;
          }
      }
      
    5. Log the number of indices and vertices

      // Log the number of indices for the part
      Logger.AddMessage(new LogMessage(
           $"Total number of Indices for {part.Name} part with {partLevelOfDetail} Level of details  is {totalNoOfIndices}"));
      
      // Log the number of vertices for the part
      Logger.AddMessage(new LogMessage(
           $"Total number of Vertices for {part.Name} part with {partLevelOfDetail} Level of details  is {totalNoOfVertices}"));
      

    Example

    This function returns type-safe collection of all the Part objects in station.

    private static List<Part> GetStationParts()
    {
        var parts = new List<Part>();
        foreach (var component in Station.ActiveStation.GraphicComponents)
        {
            if (component is Part part)
            {
                parts.Add(part);
            }
        }
        return parts;
    }
    

    This function shows the number of indices and vertices for the imported CAD model with different level of details.

    private static void LogLevelOfDetail()
    {
        // Iterate through the collection of parts
        foreach (var part in GetStationParts())
        {
            // Determine the appropriate MeshPart instance based on level of detail
            MeshPart meshPart = part.Mesh[DetailLevels.Medium] ?? part.Mesh[DetailLevels.Coarse] ?? part.Mesh[DetailLevels.Fine];
    
            // Determine the selected level of detail  
            DetailLevels partLevelOfDetail = meshPart == part.Mesh[DetailLevels.Medium] ? DetailLevels.Medium :
                                             meshPart == part.Mesh[DetailLevels.Coarse] ? DetailLevels.Coarse :
                                             DetailLevels.Fine;
    
            // Initialize total indices and vertices counters 
            int totalNoOfIndices = 0;
            int totalNoOfVertices = 0;
    
            // Calculate total number of indices and vertices
            foreach (MeshBody meshBody in meshPart.Bodies)
            {
                foreach (MeshFace meshFace in meshBody.Faces)
                {
                    totalNoOfIndices += meshFace.TriangleIndices.Count;
                    totalNoOfVertices += meshFace.Vertices.Count;
                }
            }
    
            // Log the number of indices for the part
            Logger.AddMessage(new LogMessage(
                 $"Total number of Indices for {part.Name} part with {partLevelOfDetail} Level of details  is {totalNoOfIndices}"));
    
            // Log the number of vertices for the part
            Logger.AddMessage(new LogMessage(
                 $"Total number of Vertices for {part.Name} part with {partLevelOfDetail} Level of details  is {totalNoOfVertices}"));
        }
    }
    

    Required Namespaces

    ABB.Robotics.RobotStudio.Stations

    ABB.Robotics.RobotStudio

    See Also

    • Level Of Detail
    In this article
    Back to top Copyright © 2026 ABB Robotics