Search Results for

    Show / Hide Table of Contents

    Edge Properties

    This example creates a box, and gets one of the edges from it. It then prints some information about the edge in the logger (the output window in RobotStudio).

    Example

    Project.UndoContext.BeginUndoStep("EdgeProperties");
    try
    {
        Station station = Station.ActiveStation;
    
        // Create a box.
        Part myPart = new Part();
        myPart.Name = "MyPart";
        station.GraphicComponents.Add(myPart);
        Body box = Body.CreateSolidBox(
            new Matrix4(Vector3.XVector, 0.0), new Vector3(0.1, 0.1, 0.1));
        box.Name = "MyBox";
        myPart.Bodies.Add(box);
    
        // Get a coedge from the box.
        Coedge myCoedge = box.Shells[0].Faces[0].Loops[0].Coedges[0];
    
        // Get the edge associated with the coedge.
        Edge myEdge = myCoedge.Edge;
    
        // Output som info of the edge.
        Logger.AddMessage(new LogMessage($"The body of the edge is: {myEdge.Body.Name}"));
        Logger.AddMessage(new LogMessage($"The length of edge is: {myEdge.Length}"));
        Logger.AddMessage(new LogMessage(
            $"The start vertex of the edge is: ({myEdge.StartVertex.Position.ToString(numDecimals: 8, separator: ", ")})"));
        Logger.AddMessage(new LogMessage(
            $"The end vertex of the edge is: ({myEdge.EndVertex.Position.ToString(numDecimals: 8, separator: ", ")})"));
        Logger.AddMessage(new LogMessage(
            $"The mid point of the edge is: ({myEdge.MidPoint.ToString(numDecimals: 8, separator: ", ")})"));
    
        // Try to get the centerpoint. It is only defined for eliptic edges
        // and will throw an exception if not defined.
        try
        {
            Logger.AddMessage(new LogMessage(
                $"The center point of the edge is: ({myEdge.CenterPoint.ToString(numDecimals: 8, separator: ", ")})"));
        }
        catch
        {
            Logger.AddMessage(new LogMessage("The center point is only defined for eliptic edges"));
        }
    
        // Get the tangent to the edge at the midpoint.
        Vector3 tanget = myEdge.GetTangent(myEdge.MidPoint);
    
        // Output the tangent.
        Logger.AddMessage(new LogMessage(
            $"The tangent of the edge at the midpoint is: ({tanget.ToString(numDecimals: 8, separator: ", ")})"));
    }
    catch
    {
        Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
        throw;
    }
    finally
    {
        Project.UndoContext.EndUndoStep();
    }
    

    See Also

    • Part
    • Body
    • Coedge
    • Edge
    In this article
    Back to top Copyright © 2026 ABB Robotics