Search Results for

    Show / Hide Table of Contents

    Meshes

    Meshes are the collection of points that, when interconnected, form an approximated representation of the body in a 3D space. A Part in RobotStudio has a Mesh associated to it. This mesh is commonly provided by the Body associated to the part; Nonetheless, a mesh can also be associated to a part during run-time and said mesh can be subjected to several operations.

    The steps to perform in this topic are:

    1. Create a cube.

    2. Create an empty mesh.

    3. Apply render operations to the mesh.

    4. Reload the mesh.

    Note

    You can easily try out this example using the RobotStudio Empty Add-in template from Visual Studio.

    Solution

    1. Create a Part from a cube Body object. The part will be located in the origin of the station (x = 0, y = 0, z = 0) and each side will measure 0.5m.

      Part part = new Part();
      Body box = Body.CreateSolidBox(new Matrix4(new Vector3(0, 0, 0)), new Vector3(0.5, 0.5, 0.5));
      part.Bodies.Add(box);
      
      Station station = Project.ActiveProject as Station;
      station.GraphicComponents.Add(part);
      
    2. Create an empty Mesh object and assign the part's mesh to it.

      Mesh mesh = new Mesh();
      mesh = part.Mesh;
      
    3. Some operations can be applied to the mesh, for example, changing the material with which it is rendered:

      Material greenMaterial = new Material(Color.Green);
      mesh.SetMaterial(greenMaterial);
      
    4. Once the mesh is modified, it needs to be reloaded so that the changes can take effect in the part. If desired, meshes that have been modified more extensively can be saved as .rsgfx files to use them later.

      mesh.Rebuild(); // rebuild the mesh
      mesh.Save("C:/Users/SEERVIE/Documents/visual studio 2015/Projects/VisualSampleAddin/VisualSampleAddin/hey.rsgfx");// save the mesh
      

    Example

    The complete code for this example can be found in the following snippet:

    private static void MeshDemo() 
    {
        Part part = new Part();
        Body box = Body.CreateSolidBox(new Matrix4(new Vector3(0, 0, 0)), new Vector3(0.5, 0.5, 0.5));
        part.Bodies.Add(box);
    
        Station station = Project.ActiveProject as Station;
        station.GraphicComponents.Add(part);
    
        Mesh mesh = new Mesh();
    
        mesh = part.Mesh;
    
        Material greenMaterial = new Material(Color.Green);
        mesh.SetMaterial(greenMaterial);
    
        mesh.Rebuild();
        mesh.Save("C:/Users/SEERVIE/Documents/visual studio 2015/Projects/VisualSampleAddin/VisualSampleAddin/hey.rsgfx");
    }
    

    Required Namespaces

    ABB.Robotics.Math

    ABB.Robotics.RobotStudio.Stations

    See Also

    • RobotStudio Add-Ins
    • RobotStudio SmartComponents
    • Part Information
    • Body Operations
    • Getting Geometry Details
    In this article
    Back to top Copyright © 2026 ABB Robotics