Show / Hide Table of Contents

Creating Solids

This example provides information on creating different solid bodies. Go to the Modeling browser to see all bodies joined together as one part. If you select all the bodies (not the part) in the Modeling browser and make them invisible, you can then select them one at a time to see the different bodies better.

Solution

  1. Create a Part object to contain the bodies and add it to the station.

    Part p = new Part();
    p.Name = "My_Solid_Bodies";
    station.GraphicComponents.Add(p);
    
  2. Create a solid box

    Matrix4 matrix_origo = new Matrix4(new Vector3(Axis.X), 0.0);
    Vector3 size = new Vector3(0.5, 0.5, 0.5);
    Body b1 = Body.CreateSolidBox(matrix_origo, size);
    b1.Name = "Box";
    p.Bodies.Add(b1);
    
  3. Create a cone

    Body b2 = Body.CreateSolidCone(matrix_origo, 1.0, 1.0);
    b2.Name = "Cone";
    p.Bodies.Add(b2);
    
  4. Create a cylinder

    Body b3 = Body.CreateSolidCylinder(matrix_origo, 0.5, 0.5);
    b3.Name = "Cylinder";
    p.Bodies.Add(b3);
    
  5. Create a pyramid

    Body b4 = Body.CreateSolidPyramid(matrix_origo, 1.0, 1.0, 6);
    b4.Name = "Pyramid";
    p.Bodies.Add(b4);
    
  6. Create a sphere

    Vector3 vector_origo = new Vector3(0.0, 0.0, 0.0);
    Body b5 = Body.CreateSolidSphere(vector_origo, 0.75);
    b5.Name = "Sphere";
    p.Bodies.Add(b5);
    
  7. Create a torus

    Body b6 = Body.CreateSolidTorus(matrix_origo, 1.0, 0.5);
    b6.Name = "Torus";
    p.Bodies.Add(b6);
    

Example

This example provides information on creating different solid bodies.

Project.UndoContext.BeginUndoStep("BodyCreateSolids");
try
{
    Station station = Station.ActiveStation;

    // Create a part to contain the bodies.
    Part p = new Part();
    p.Name = "My_Solid_Bodies";
    station.GraphicComponents.Add(p);

    // Create a solid box.
    Matrix4 matrix_origo = new Matrix4(new Vector3(Axis.X), 0.0);
    Vector3 size = new Vector3(0.5, 0.5, 0.5);
    Body b1 = Body.CreateSolidBox(matrix_origo, size);
    b1.Name = "Box";
    p.Bodies.Add(b1);

    // Create a cone.
    Body b2 = Body.CreateSolidCone(matrix_origo, 1.0, 1.0);
    b2.Name = "Cone";
    p.Bodies.Add(b2);

    // Create a cylinder.
    Body b3 = Body.CreateSolidCylinder(matrix_origo, 0.5, 0.5);
    b3.Name = "Cylinder";
    p.Bodies.Add(b3);

    // Create a pyramid.
    Body b4 = Body.CreateSolidPyramid(matrix_origo, 1.0, 1.0, 6);
    b4.Name = "Pyramid";
    p.Bodies.Add(b4);

    // Create a sphere.
    Vector3 vector_origo = new Vector3(0.0, 0.0, 0.0);
    Body b5 = Body.CreateSolidSphere(vector_origo, 0.75);
    b5.Name = "Sphere";
    p.Bodies.Add(b5);

    // Create a torus.
    Body b6 = Body.CreateSolidTorus(matrix_origo, 1.0, 0.5);
    b6.Name = "Torus";
    p.Bodies.Add(b6);
}
catch
{
    Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
    throw;
}
finally
{
    Project.UndoContext.EndUndoStep();
}

Required Namespaces

ABB.Robotics.RobotStudio

ABB.Robotics.RobotStudio.Stations

ABB.Robotics.Math

See Also

  • Creating Surfaces
  • Join Seperate
In this article
Back to top Copyright © 2025 ABB