Class Edge
An Edge is bounded by one or more vertices, referring to one Vertex at each end. Edges are
closely related to Coedges, which allows the Edge to occur in more than one
Face, thus makes it possible to create solids.
Implements
Inherited Members
Namespace: ABB.Robotics.RobotStudio.Stations
Assembly: ABB.Robotics.RobotStudio.Stations.dll
Syntax
public sealed class Edge : ProjectObject, IHasGeometry
Remarks
The Edge object is generated on demand and is not stored in the station file; therefore Attributes cannot be used to persist attributes.
Properties
View SourceBody
Gets the Body the edge is part of.
Declaration
public Body Body { get; }
Property Value
| Type | Description |
|---|---|
| Body |
Examples
Get Body
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();
}</code></pre>
View Source
CenterPoint
Gets the center point of the edge.
Declaration
public Vector3 CenterPoint { get; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Remarks
Center point is only defined for eliptic edges, this property will throw an exception if used on non eliptic edges.
Examples
Get Center Point
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();
}</code></pre>
View Source
EdgeType
Returns the type of the edge.
Declaration
public EdgeType EdgeType { get; }
Property Value
| Type | Description |
|---|---|
| EdgeType |
EndVertex
Gets the end vertex of the edge.
Declaration
public Vertex EndVertex { get; }
Property Value
| Type | Description |
|---|---|
| Vertex |
Examples
Get End Vertex
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();
}</code></pre>
View Source
Length
Gets the length of the edge.
Declaration
public double Length { get; }
Property Value
| Type | Description |
|---|---|
| double |
Examples
Get Length
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();
}</code></pre>
View Source
MidPoint
Gets the mid point of the edge.
Declaration
public Vector3 MidPoint { get; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Examples
Get Mid Point
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();
}</code></pre>
View Source
StartVertex
Gets the start vertex of the edge.
Declaration
public Vertex StartVertex { get; }
Property Value
| Type | Description |
|---|---|
| Vertex |
Examples
Get Start Vertex
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();
}</code></pre>
Methods
View SourceFacet(double, double, double, double, double, out Vector3[], out double[])
Returns facets that approximate the edge.
Declaration
public bool Facet(double start, double end, double maxTolerance, double maxLength, double maxAngle, out Vector3[] points, out double[] parameters)
Parameters
| Type | Name | Description |
|---|---|---|
| double | start | Starting parameter. |
| double | end | Ending parameter. If less than start, the two are reversed. |
| double | maxTolerance | The desired maximum distance between the approximating facets and the real curve. Ignored if zero. |
| double | maxLength | The desired maximum length of each facet. Ignored if zero. |
| double | maxAngle | The desired maximum angle between the tangets of the two endpoints of any facet. Ignored if zero. |
| Vector3[] | points | Returns the facet points on the curve. |
| double[] | parameters | Returns the parameters (t-values) of the facet points on the curve. |
Returns
| Type | Description |
|---|---|
| bool | True if success. |
Remarks
At least one of the "max" arguments must be non-zero.
FindClosestVertex(Vector3)
Declaration
public Vertex FindClosestVertex(Vector3 testPoint)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | testPoint | The point which to find the closest vertex to. |
Returns
| Type | Description |
|---|---|
| Vertex | The closest Vertex. |
Examples
Find Closest Vertex
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();
}</code></pre>
View Source
GetCoedges()
Declaration
public Coedge[] GetCoedges()
Returns
| Type | Description |
|---|---|
| Coedge[] |
GetCurvature(double)
Returns the curvature of a point on the edge that corresponds to the given parameter value.
Declaration
public Vector3 GetCurvature(double parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| double | parameter | Parameter value. |
Returns
| Type | Description |
|---|---|
| Vector3 | Curvature. |
GetFaces()
Declaration
public Face[] GetFaces()
Returns
| Type | Description |
|---|---|
| Face[] |
GetLengthAtParameter(double)
Returns the distance along this edge from the start.
Declaration
public double GetLengthAtParameter(double parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| double | parameter | Parameter value. |
Returns
| Type | Description |
|---|---|
| double | Distance. |
GetParameterAtLength(double)
Returns the parameter value at the given distance from the start.
Declaration
public double GetParameterAtLength(double length)
Parameters
| Type | Name | Description |
|---|---|---|
| double | length | Distance from start. |
Returns
| Type | Description |
|---|---|
| double | Parameter value. |
GetParameterAtPoint(Vector3)
Returns the parameter on the edge that corresponds to the given point value.
Declaration
public double GetParameterAtPoint(Vector3 point)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | point | Point value. |
Returns
| Type | Description |
|---|---|
| double | Parameter on the edge. |
GetParameterRange(out ParameterRange)
Gets the parameter (t-value) range of the edge.
Declaration
public bool GetParameterRange(out ParameterRange range)
Parameters
| Type | Name | Description |
|---|---|---|
| ParameterRange | range | Returns the range. |
Returns
| Type | Description |
|---|---|
| bool | False if the range is unbounded. |
GetPointAtParameter(double)
Returns the point on the edge that corresponds to the given parameter value.
Declaration
public Vector3 GetPointAtParameter(double parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| double | parameter | Parameter value. |
Returns
| Type | Description |
|---|---|
| Vector3 | Point on the edge. |
GetTangent(Vector3)
Gets the tangent of the edge at the supplied point.
Declaration
public Vector3 GetTangent(Vector3 pointOnCurve)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | pointOnCurve | The point at which to get the tangent. |
Returns
| Type | Description |
|---|---|
| Vector3 | The tangent to the edge at the supplied point |
Examples
Get tangent.
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();
}</code></pre>
View Source
GetTangent(double)
Returns the tangent of the edge at the given parameter value.
Declaration
public Vector3 GetTangent(double parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| double | parameter | Parameter value. |
Returns
| Type | Description |
|---|---|
| Vector3 | Tangent direction. |
IsParameterValid(double)
Returns true if the given parameter is valid for this Edge, i.e. within its parameter range.
Declaration
public bool IsParameterValid(double parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| double | parameter | The parameter value to test |
Returns
| Type | Description |
|---|---|
| bool |