Class FaceCollection
A collection of Face objects.
Inheritance
FaceCollection
Assembly: ABB.Robotics.RobotStudio.Stations.dll
Syntax
public class FaceCollection : ICollection, IEnumerable<Face>, IEnumerable
Examples
Face Collection.
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();
}
Properties
Count
Declaration
public virtual int Count { get; }
Property Value
IsSynchronized
Declaration
public virtual bool IsSynchronized { get; }
Property Value
Item[Int32]
Declaration
public Face this[int index] { get; }
Parameters
Type |
Name |
Description |
Int32 |
index |
|
Property Value
List
Declaration
public List<Face> List { get; }
Property Value
Parent
Declaration
public ProjectObject Parent { get; }
Property Value
SyncRoot
Declaration
public virtual object SyncRoot { get; }
Property Value
Methods
Contains(Face)
Declaration
public bool Contains(Face obj)
Parameters
Type |
Name |
Description |
Face |
obj |
|
Returns
CopyTo(Face[], Int32)
Declaration
public void CopyTo(Face[] array, int index)
Parameters
Type |
Name |
Description |
Face[] |
array |
|
Int32 |
index |
|
CopyTo(Array, Int32)
Declaration
public virtual void CopyTo(Array array, int index)
Parameters
GetEnumerator()
Declaration
public virtual IEnumerator GetEnumerator()
Returns
ToArray()
Declaration
Returns