Show / Hide Table of Contents

Creating Curves

This example provides information on creating variety of curves in RobotStudio.Some of the curves that are created include arc, circle, etc. Run the Add-In and go to the Modeling browser to see all the different curves, joined together as one part.

Use this procedure to create different curves:

  1. Create Part object to contain the Bodies and add it to the Station .

  2. Create an arc

  3. Create a circle

  4. Create an ellipse

  5. Create an elliptic arc

  6. Create a line

  7. Create a polygon

  8. Create a polyline

  9. Create a reactangle

  10. Create a spline

Solution

  1. Create Part Object to contain the Bodies and Add it to the station

    Part p = new Part();
    p.Name = "My_Curves";
    station.GraphicComponents.Add(p);
    
  2. Create an arc

    Vector3 start = new Vector3(0.0, 0.0, 0.0);
    Vector3 end = new Vector3(0.5, 0.5, 0.5);
    Vector3 via = new Vector3(0.25, 0.25, 0.0);
    Body b1 = Body.CreateArc(start, end, via);
    b1.Name = "Arc";
    p.Bodies.Add(b1);
    
  3. Create a circle

    Matrix4 matrix_origo = new Matrix4(new Vector3(Axis.X), 0.0);
    Body b2 = Body.CreateCircle(matrix_origo, 0.5);
    b2.Name = "Circle";
    p.Bodies.Add(b2);
    
  4. Create an ellipse

    Vector3 vector_origo = new Vector3(0.0, 0.0, 0.0);
    Body b3 = Body.CreateEllipse(vector_origo, end, 0.25);
    b3.Name = "Ellipse";
    p.Bodies.Add(b3);
    
  5. Create an elliptic arc

    Body b4 = Body.CreateEllipticArc(vector_origo, end, via, 0.3, 1.1);
    b4.Name = "Elliptic arc";
    p.Bodies.Add(b4);
    
  6. Create a line

    Body b5 = Body.CreateLine(start, end);
    b5.Name = "Line";
    p.Bodies.Add(b5);
    
  7. Create a polygon

    Body b6 = Body.CreatePolygon(vector_origo, via, 8);
    b6.Name = "Polygon";
    p.Bodies.Add(b6);
    
  8. Create a polyline

    Vector3[] vertices = new Vector3[3] { start, via, end };
    Body b7 = Body.CreatePolyLine(vertices);
    b7.Name = "Polyline";
    p.Bodies.Add(b7);
    
  9. Create a reactangle

    Body b8 = Body.CreateRectangle(matrix_origo, 0.7, 0.3);
    b8.Name = "Reactangle";
    p.Bodies.Add(b8);
    
  10. Create a spline

    Body b9 = Body.CreateSpline(vertices, 0.2);
    b9.Name = "Spline";
    p.Bodies.Add(b9);
    

Example

This example shows a variety of curves.

public void BodyCreateCurves()
{
    NewStation();
    Project.UndoContext.BeginUndoStep("BodyCreateCurves");
    try
    {
        Station station = Station.ActiveStation;

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

        // Create an arc.
        Vector3 start = new Vector3(0.0, 0.0, 0.0);
        Vector3 end = new Vector3(0.5, 0.5, 0.5);
        Vector3 via = new Vector3(0.25, 0.25, 0.0);
        Body b1 = Body.CreateArc(start, end, via);
        b1.Name = "Arc";
        p.Bodies.Add(b1);

        // Create a circle.
        Matrix4 matrix_origo = new Matrix4(new Vector3(Axis.X), 0.0);
        Body b2 = Body.CreateCircle(matrix_origo, 0.5);
        b2.Name = "Circle";
        p.Bodies.Add(b2);

        // Create an ellipse.
        Vector3 vector_origo = new Vector3(0.0, 0.0, 0.0);
        Body b3 = Body.CreateEllipse(vector_origo, end, 0.25);
        b3.Name = "Ellipse";
        p.Bodies.Add(b3);

        // Create an elliptic arc.
        Body b4 = Body.CreateEllipticArc(vector_origo, end, via, 0.3, 1.1);
        b4.Name = "Elliptic arc";
        p.Bodies.Add(b4);

        // Create a line.
        Body b5 = Body.CreateLine(start, end);
        b5.Name = "Line";
        p.Bodies.Add(b5);

        // Create a polygon.
        Body b6 = Body.CreatePolygon(vector_origo, via, 8);
        b6.Name = "Polygon";
        p.Bodies.Add(b6);

        // Create a polyline.
        Vector3[] vertices = new Vector3[3] { start, via, end };
        Body b7 = Body.CreatePolyLine(vertices);
        b7.Name = "Polyline";
        p.Bodies.Add(b7);

        // Create a reactangle.
        Body b8 = Body.CreateRectangle(matrix_origo, 0.7, 0.3);
        b8.Name = "Reactangle";
        p.Bodies.Add(b8);

        // Create a spline.
        Body b9 = Body.CreateSpline(vertices, 0.2);
        b9.Name = "Spline";
        p.Bodies.Add(b9);
    }
    catch
    {
        Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
        throw;
    }
    finally
    {
        Project.UndoContext.EndUndoStep();
    }
}

Required Namespaces

ABB.Robotics.RobotStudio

ABB.Robotics.RobotStudio.Stations

See Also

  • Creating Intersection Curves
  • Curve Manipulations
In this article
Back to top Copyright © 2024 ABB