Coedge Properties
This example creates a box and gets one of the coedges from the box. Then it prints some properties of the coedge in the logger (the output window in RobotStudio).
Example
Project.UndoContext.BeginUndoStep("CoedgeProperties");
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];
myCoedge.Edge.Name = "MyEdge";
// Output some info of the coedge.
Logger.AddMessage(new LogMessage($"The body of the coedge is: {myCoedge.Body.Name}"));
Logger.AddMessage(new LogMessage($"The edge of the coedge is: {myCoedge.Edge.Name}"));
Logger.AddMessage(new LogMessage($"The coedge is reversed: {myCoedge.Reversed}"));
Logger.AddMessage(new LogMessage(
$"The start vertex of the coedge is: ({myCoedge.StartVertex.Position.ToString(numDecimals: 8, separator: ", ")})"));
Logger.AddMessage(new LogMessage(
$"The end vertex of the coedge is: ({myCoedge.EndVertex.Position.ToString(numDecimals: 8, separator: ", ")})"));
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}