BodyCollection Class |
Namespace: ABB.Robotics.RobotStudio.Stations
public class BodyCollection : ICollection, IEnumerable, IEnumerable<Body>
The BodyCollection type exposes the following members.
Name | Description | |
---|---|---|
Add |
Adds a Body to the collection.
| |
Clear | ||
Contains | ||
CopyTo(Array, Int32) | ||
CopyTo(Body, Int32) | ||
Equals | (Inherited from Object.) | |
Finalize | (Inherited from Object.) | |
GetEnumerator | ||
GetHashCode | (Inherited from Object.) | |
GetType | (Inherited from Object.) | |
MemberwiseClone | (Inherited from Object.) | |
Remove |
Removes a Body from the collection.
| |
ToArray | ||
ToString | (Inherited from Object.) |
Project.UndoContext.BeginUndoStep("BodyProperties"); try { Station station = Station.ActiveStation; // Create a part to contain the bodies. Part p = new Part(); p.Name = "My_Part"; station.GraphicComponents.Add(p); // Create a solid box. Matrix4 matrix_origo = new Matrix4(new Vector3(Axis.X), 0.0); Vector3 size = new Vector3(0.5, 0.5, 0.5); Body b1 = Body.CreateSolidBox(matrix_origo, size); b1.Name = "Box"; p.Bodies.Add(b1); // Log a summary of the bodies properties. Logger.AddMessage(new LogMessage("The body '" + b1.Name + "' has the following properties:")); Logger.AddMessage(new LogMessage("Center of gravity: x: " + b1.CenterOfGravity.x.ToString() + " y: " + b1.CenterOfGravity.y.ToString() + " z: " + b1.CenterOfGravity.z.ToString())); Logger.AddMessage(new LogMessage("Color: " + b1.Color.ToString())); Logger.AddMessage(new LogMessage("Moment of Inertia: x: (" + b1.MomentOfInertia.x.x.ToString() + ", " + b1.MomentOfInertia.x.y.ToString() + ", " + b1.MomentOfInertia.x.z.ToString() + ")" + " y: (" + b1.MomentOfInertia.y.x.ToString() + ", " + b1.MomentOfInertia.y.y.ToString() + ", " + b1.MomentOfInertia.y.z.ToString() + ")" + " z: (" + b1.MomentOfInertia.z.x.ToString() + ", " + b1.MomentOfInertia.z.y.ToString() + ", " + b1.MomentOfInertia.z.z.ToString() + ")")); Logger.AddMessage(new LogMessage("Has '" + b1.Shells.Count.ToString() + "' number of shells.")); Logger.AddMessage(new LogMessage("Surface area: " + b1.SurfaceArea.ToString())); Logger.AddMessage(new LogMessage("Transform: X: " + b1.Transform.X.ToString() + " Y: " + b1.Transform.Y.ToString() + " Z: " + b1.Transform.Z.ToString() + " Rx: " + b1.Transform.RX.ToString() + " Ry: " + b1.Transform.RY.ToString() + " Rz: " + b1.Transform.RZ.ToString())); Logger.AddMessage(new LogMessage("Visibility: " + b1.Visible.ToString())); Logger.AddMessage(new LogMessage("Volume: " + b1.Volume.ToString())); } catch { Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback); throw; } finally { Project.UndoContext.EndUndoStep(); }