Show / Hide Table of Contents

Creating Surfaces

This example provides information on creating surfaces. Different surfaces are seen in the part if you go to the Modeling browser.

Solution

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

    Part p = new Part();
    p.Name = "My_Surfaces";
    station.GraphicComponents.Add(p);
    
  2. Create a surface circle

    Matrix4 matrix_origo = new Matrix4(new Vector3(Axis.X), 0.0);
    Body b1 = Body.CreateSurfaceCircle(matrix_origo, 0.5);
    b1.Name = "Surface circle";
    p.Bodies.Add(b1);
    
  3. Create surface from curve

    • Create a closed curve

      Vector3 v1 = new Vector3(0.0, 0.0, 0.0);
      Vector3 v2 = new Vector3(0.5, 0.5, 0.0);
      Vector3 v3 = new Vector3(0.2, -0.2, 0.0);
      Vector3 v4 = new Vector3(-0.2, -0.3, 0.0);
      Vector3 v5 = new Vector3(-0.3, 0.2, 0.0);
      Vector3[] vertices = new Vector3[6] { v1, v2, v3, v4, v5, v1 };
      Body spline = Body.CreateSpline(vertices, 0.0);
      spline.Name = "Spline";
      p.Bodies.Add(spline);
      
    • Create surface

      Body b2 = Body.CreateSurfaceFromCurve(spline.Shells[0].Wires[0]);
      b2.Name = "Curve surface";
      p.Bodies.Add(b2);
      
  4. Create a surface polygon

    Vector3 vector_origo = new Vector3(0.0, 0.0, 0.0);
    Body b3 = Body.CreateSurfacePolygon(vector_origo, new Vector3(0.5, 0.5, 0.5), 8);
    b3.Name = "Surface Polygon";
    p.Bodies.Add(b3);
    
  5. Create a surface rectangle

    Body b4 = Body.CreateSurfaceRectangle(matrix_origo, 0.2, 0.5);
    b4.Name = "Surface Rectangle";
    p.Bodies.Add(b4);
    

Example

This example provides information on creating surfaces.

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

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

    // Create a surface circle.
    Matrix4 matrix_origo = new Matrix4(new Vector3(Axis.X), 0.0);
    Body b1 = Body.CreateSurfaceCircle(matrix_origo, 0.5);
    b1.Name = "Surface circle";
    p.Bodies.Add(b1);

    // Create surface from curve.
    // Create a curve, that must be closed.
    Vector3 v1 = new Vector3(0.0, 0.0, 0.0);
    Vector3 v2 = new Vector3(0.5, 0.5, 0.0);
    Vector3 v3 = new Vector3(0.2, -0.2, 0.0);
    Vector3 v4 = new Vector3(-0.2, -0.3, 0.0);
    Vector3 v5 = new Vector3(-0.3, 0.2, 0.0);
    Vector3[] vertices = new Vector3[6] { v1, v2, v3, v4, v5, v1 };
    Body spline = Body.CreateSpline(vertices, 0.0);
    spline.Name = "Spline";
    p.Bodies.Add(spline);
    Body b2 = Body.CreateSurfaceFromCurve(spline.Shells[0].Wires[0]);
    b2.Name = "Curve surface";
    p.Bodies.Add(b2);

    // Create a surface polygon.
    Vector3 vector_origo = new Vector3(0.0, 0.0, 0.0);
    Body b3 = Body.CreateSurfacePolygon(vector_origo, new Vector3(0.5, 0.5, 0.5), 8);
    b3.Name = "Surface Polygon";
    p.Bodies.Add(b3);

    // Create a surface rectangle.
    Body b4 = Body.CreateSurfaceRectangle(matrix_origo, 0.2, 0.5);
    b4.Name = "Surface Rectangle";
    p.Bodies.Add(b4);
}
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 Solids
  • Join Seperate
In this article
Back to top Copyright © 2025 ABB