FaceCollection Class |
Namespace: ABB.Robotics.RobotStudio.Stations
public class FaceCollection : ICollection, IEnumerable, IEnumerable<Face>
The FaceCollection type exposes the following members.
Name | Description | |
---|---|---|
Contains | ||
CopyTo(Array, Int32) | ||
CopyTo(Face, Int32) | ||
Equals | (Inherited from Object.) | |
Finalize | (Inherited from Object.) | |
GetEnumerator | ||
GetHashCode | (Inherited from Object.) | |
GetType | (Inherited from Object.) | |
MemberwiseClone | (Inherited from Object.) | |
ToArray | ||
ToString | (Inherited from Object.) |
Project.UndoContext.BeginUndoStep("FaceProperties"); 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 face from the box. Face myFace = box.Shells[0].Faces[0]; // Make sure the face is visible. myFace.Visible = true; // Make the the face yellow. myFace.Color = Color.Yellow; // Output the name of the body of the face. Logger.AddMessage(new LogMessage("The body of the face is: " + myFace.Body.Name)); // Traverse the loops of the face and output the number of coedges each has. int i = 1; foreach (Loop l in myFace.Loops) { Logger.AddMessage(new LogMessage("Loop number '" + i + "' has '" + l.Coedges.Count + "' coedges")); i++; } // Find the vertex closest to a point. Vector3 point = new Vector3(0.6, 0.6, 0.6); Vertex closestVert = myFace.FindClosestVertex(point); Logger.AddMessage(new LogMessage("The closest vertex to point is : (" + closestVert.Position.x.ToString() + ", " + closestVert.Position.x.ToString() + ", " + closestVert.Position.x.ToString() + ")")); // Create a surface circle. Matrix4 matrix_origo = new Matrix4(new Vector3(Axis.X), 0.0); Body circle = Body.CreateSurfaceCircle(matrix_origo, 0.5); circle.Name = "Surface circle"; myPart.Bodies.Add(circle); if (circle.Shells[0].Faces[0].ReverseNormal()) { Logger.AddMessage(new LogMessage("Face of surface circle succesfully reversed!")); } else { Logger.AddMessage(new LogMessage("Reversal of face of surface circle failed!")); } } catch { Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback); throw; } finally { Project.UndoContext.EndUndoStep(); }