Class GraphicComponentGroup
The GraphicComponentGroup is an assembly of GraphicComponent objects.
Implements
Inherited Members
Namespace: ABB.Robotics.RobotStudio.Stations
Assembly: ABB.Robotics.RobotStudio.Stations.dll
Syntax
sistent("ComponentInstance")]
public class GraphicComponentGroup : GraphicComponent, IHasTransform, IHasFrames, IAttachableChild, ISupportCopy, IGfxObject, IAttachableParent, IHasGraphicComponents
Examples
GraphicComponentGroup Example.
Project.UndoContext.BeginUndoStep("GraphicComponentGroupProperties");
try
{
Station station = Station.ActiveStation;
// Create the GraphicComponentGroup.
GraphicComponentGroup myGCGroup = new GraphicComponentGroup();
myGCGroup.Name = "myGCGroup";
// Add the GraphicComponentGroup to the GraphicComponents of the station.
station.GraphicComponents.Add(myGCGroup);
// Create a part.
Part myPart1 = new Part();
myPart1.Name = "MyPart1";
// Create a box and add it to myPart1.
Body box = Body.CreateSolidBox(new Matrix4(Vector3.XVector, 0.0), new Vector3(0.4, 0.4, 0.4));
box.Name = "MyBox";
myPart1.Bodies.Add(box);
// Add myPart1 to myGCGroup.
myGCGroup.GraphicComponents.Add(myPart1);
// Create another part.
Part myPart2 = new Part();
myPart2.Name = "MyPart2";
//Create a cylinder and add it to myPart2.
Matrix4 origin = new Matrix4(new Vector3(0.5, 0.5, 0.5), 0.0);
Body myCylinder = Body.CreateSolidCylinder(origin, 0.2, 1);
myCylinder.Name = "myCylinder";
myPart2.Bodies.Add(myCylinder);
// Add myPart1 to myGCGroup.
myGCGroup.GraphicComponents.Add(myPart2);
// Create a third part.
Part myPart3 = new Part();
myPart3.Name = "MyPart3";
// Create a box and add it to myPart3.
Body box2 = Body.CreateSolidBox(new Matrix4(Vector3.XVector, 0.0), new Vector3(0.1, 0.1, 0.1));
box2.Name = "MyBox_2";
myPart3.Bodies.Add(box2);
// Add myPart3 to the station.
station.GraphicComponents.Add(myPart3);
// Attach myPart3 to myGCGroup, mount it on top of the cylinder, using an offset matrix.
if (myGCGroup.CanAttachChild(myPart3))
{
myGCGroup.Attach(myPart3, true, new Matrix4(new Vector3(0.0, 0.0, 1.0)));
}
else
{
Logger.AddMessage(new LogMessage("Could not attach myPart3 to myGCGroup"));
}
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
Constructors
GraphicComponentGroup()
Creates and initializes a new GraphicComponentGroup object.
Declaration
public GraphicComponentGroup()
Examples
GraphicComponentGroup Example.
Project.UndoContext.BeginUndoStep("GraphicComponentGroupProperties");
try
{
Station station = Station.ActiveStation;
// Create the GraphicComponentGroup.
GraphicComponentGroup myGCGroup = new GraphicComponentGroup();
myGCGroup.Name = "myGCGroup";
// Add the GraphicComponentGroup to the GraphicComponents of the station.
station.GraphicComponents.Add(myGCGroup);
// Create a part.
Part myPart1 = new Part();
myPart1.Name = "MyPart1";
// Create a box and add it to myPart1.
Body box = Body.CreateSolidBox(new Matrix4(Vector3.XVector, 0.0), new Vector3(0.4, 0.4, 0.4));
box.Name = "MyBox";
myPart1.Bodies.Add(box);
// Add myPart1 to myGCGroup.
myGCGroup.GraphicComponents.Add(myPart1);
// Create another part.
Part myPart2 = new Part();
myPart2.Name = "MyPart2";
//Create a cylinder and add it to myPart2.
Matrix4 origin = new Matrix4(new Vector3(0.5, 0.5, 0.5), 0.0);
Body myCylinder = Body.CreateSolidCylinder(origin, 0.2, 1);
myCylinder.Name = "myCylinder";
myPart2.Bodies.Add(myCylinder);
// Add myPart1 to myGCGroup.
myGCGroup.GraphicComponents.Add(myPart2);
// Create a third part.
Part myPart3 = new Part();
myPart3.Name = "MyPart3";
// Create a box and add it to myPart3.
Body box2 = Body.CreateSolidBox(new Matrix4(Vector3.XVector, 0.0), new Vector3(0.1, 0.1, 0.1));
box2.Name = "MyBox_2";
myPart3.Bodies.Add(box2);
// Add myPart3 to the station.
station.GraphicComponents.Add(myPart3);
// Attach myPart3 to myGCGroup, mount it on top of the cylinder, using an offset matrix.
if (myGCGroup.CanAttachChild(myPart3))
{
myGCGroup.Attach(myPart3, true, new Matrix4(new Vector3(0.0, 0.0, 1.0)));
}
else
{
Logger.AddMessage(new LogMessage("Could not attach myPart3 to myGCGroup"));
}
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
Properties
GraphicComponents
Gets a GraphicComponentCollection object that represents all the graphic components on this GraphicComponentGroup object.
Declaration
public GraphicComponentCollection GraphicComponents { get; }
Property Value
Type | Description |
---|---|
GraphicComponentCollection | The GraphicComponentCollection that represents all the graphic components on this GraphicComponentGroup object. |
Examples
GraphicComponentGroup Example.
Project.UndoContext.BeginUndoStep("GraphicComponentGroupProperties");
try
{
Station station = Station.ActiveStation;
// Create the GraphicComponentGroup.
GraphicComponentGroup myGCGroup = new GraphicComponentGroup();
myGCGroup.Name = "myGCGroup";
// Add the GraphicComponentGroup to the GraphicComponents of the station.
station.GraphicComponents.Add(myGCGroup);
// Create a part.
Part myPart1 = new Part();
myPart1.Name = "MyPart1";
// Create a box and add it to myPart1.
Body box = Body.CreateSolidBox(new Matrix4(Vector3.XVector, 0.0), new Vector3(0.4, 0.4, 0.4));
box.Name = "MyBox";
myPart1.Bodies.Add(box);
// Add myPart1 to myGCGroup.
myGCGroup.GraphicComponents.Add(myPart1);
// Create another part.
Part myPart2 = new Part();
myPart2.Name = "MyPart2";
//Create a cylinder and add it to myPart2.
Matrix4 origin = new Matrix4(new Vector3(0.5, 0.5, 0.5), 0.0);
Body myCylinder = Body.CreateSolidCylinder(origin, 0.2, 1);
myCylinder.Name = "myCylinder";
myPart2.Bodies.Add(myCylinder);
// Add myPart1 to myGCGroup.
myGCGroup.GraphicComponents.Add(myPart2);
// Create a third part.
Part myPart3 = new Part();
myPart3.Name = "MyPart3";
// Create a box and add it to myPart3.
Body box2 = Body.CreateSolidBox(new Matrix4(Vector3.XVector, 0.0), new Vector3(0.1, 0.1, 0.1));
box2.Name = "MyBox_2";
myPart3.Bodies.Add(box2);
// Add myPart3 to the station.
station.GraphicComponents.Add(myPart3);
// Attach myPart3 to myGCGroup, mount it on top of the cylinder, using an offset matrix.
if (myGCGroup.CanAttachChild(myPart3))
{
myGCGroup.Attach(myPart3, true, new Matrix4(new Vector3(0.0, 0.0, 1.0)));
}
else
{
Logger.AddMessage(new LogMessage("Could not attach myPart3 to myGCGroup"));
}
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
Methods
Attach(IAttachableChild, Boolean, Matrix4)
Attaches a child object to this GraphicComponentGroup.
Declaration
public bool Attach(IAttachableChild child, bool mount, Matrix4 offset)
Parameters
Type | Name | Description |
---|---|---|
IAttachableChild | child | The child to be attached. |
Boolean | mount | Specifies whether the child should be mounted, i.e. moved, on to the location of the parent |
Matrix4 | offset | Specifies the offset matrix to be used from the attachment point. This is only used when mount is set to True. |
Returns
Type | Description |
---|---|
Boolean | True, if the attachmet succeded |
Examples
GraphicComponentGroup Example.
Project.UndoContext.BeginUndoStep("GraphicComponentGroupProperties");
try
{
Station station = Station.ActiveStation;
// Create the GraphicComponentGroup.
GraphicComponentGroup myGCGroup = new GraphicComponentGroup();
myGCGroup.Name = "myGCGroup";
// Add the GraphicComponentGroup to the GraphicComponents of the station.
station.GraphicComponents.Add(myGCGroup);
// Create a part.
Part myPart1 = new Part();
myPart1.Name = "MyPart1";
// Create a box and add it to myPart1.
Body box = Body.CreateSolidBox(new Matrix4(Vector3.XVector, 0.0), new Vector3(0.4, 0.4, 0.4));
box.Name = "MyBox";
myPart1.Bodies.Add(box);
// Add myPart1 to myGCGroup.
myGCGroup.GraphicComponents.Add(myPart1);
// Create another part.
Part myPart2 = new Part();
myPart2.Name = "MyPart2";
//Create a cylinder and add it to myPart2.
Matrix4 origin = new Matrix4(new Vector3(0.5, 0.5, 0.5), 0.0);
Body myCylinder = Body.CreateSolidCylinder(origin, 0.2, 1);
myCylinder.Name = "myCylinder";
myPart2.Bodies.Add(myCylinder);
// Add myPart1 to myGCGroup.
myGCGroup.GraphicComponents.Add(myPart2);
// Create a third part.
Part myPart3 = new Part();
myPart3.Name = "MyPart3";
// Create a box and add it to myPart3.
Body box2 = Body.CreateSolidBox(new Matrix4(Vector3.XVector, 0.0), new Vector3(0.1, 0.1, 0.1));
box2.Name = "MyBox_2";
myPart3.Bodies.Add(box2);
// Add myPart3 to the station.
station.GraphicComponents.Add(myPart3);
// Attach myPart3 to myGCGroup, mount it on top of the cylinder, using an offset matrix.
if (myGCGroup.CanAttachChild(myPart3))
{
myGCGroup.Attach(myPart3, true, new Matrix4(new Vector3(0.0, 0.0, 1.0)));
}
else
{
Logger.AddMessage(new LogMessage("Could not attach myPart3 to myGCGroup"));
}
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
CanAttachChild(IAttachableChild)
Test if the supplied child can be attached.
Declaration
public bool CanAttachChild(IAttachableChild child)
Parameters
Type | Name | Description |
---|---|---|
IAttachableChild | child | The child to be tested. |
Returns
Type | Description |
---|---|
Boolean | True, if the supplied child can be attached, false otherwise |
Examples
GraphicComponentGroup Example.
Project.UndoContext.BeginUndoStep("GraphicComponentGroupProperties");
try
{
Station station = Station.ActiveStation;
// Create the GraphicComponentGroup.
GraphicComponentGroup myGCGroup = new GraphicComponentGroup();
myGCGroup.Name = "myGCGroup";
// Add the GraphicComponentGroup to the GraphicComponents of the station.
station.GraphicComponents.Add(myGCGroup);
// Create a part.
Part myPart1 = new Part();
myPart1.Name = "MyPart1";
// Create a box and add it to myPart1.
Body box = Body.CreateSolidBox(new Matrix4(Vector3.XVector, 0.0), new Vector3(0.4, 0.4, 0.4));
box.Name = "MyBox";
myPart1.Bodies.Add(box);
// Add myPart1 to myGCGroup.
myGCGroup.GraphicComponents.Add(myPart1);
// Create another part.
Part myPart2 = new Part();
myPart2.Name = "MyPart2";
//Create a cylinder and add it to myPart2.
Matrix4 origin = new Matrix4(new Vector3(0.5, 0.5, 0.5), 0.0);
Body myCylinder = Body.CreateSolidCylinder(origin, 0.2, 1);
myCylinder.Name = "myCylinder";
myPart2.Bodies.Add(myCylinder);
// Add myPart1 to myGCGroup.
myGCGroup.GraphicComponents.Add(myPart2);
// Create a third part.
Part myPart3 = new Part();
myPart3.Name = "MyPart3";
// Create a box and add it to myPart3.
Body box2 = Body.CreateSolidBox(new Matrix4(Vector3.XVector, 0.0), new Vector3(0.1, 0.1, 0.1));
box2.Name = "MyBox_2";
myPart3.Bodies.Add(box2);
// Add myPart3 to the station.
station.GraphicComponents.Add(myPart3);
// Attach myPart3 to myGCGroup, mount it on top of the cylinder, using an offset matrix.
if (myGCGroup.CanAttachChild(myPart3))
{
myGCGroup.Attach(myPart3, true, new Matrix4(new Vector3(0.0, 0.0, 1.0)));
}
else
{
Logger.AddMessage(new LogMessage("Could not attach myPart3 to myGCGroup"));
}
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
Detach(IAttachableChild)
Detaches a child object from this GraphicComponentGroup.
Declaration
public bool Detach(IAttachableChild child)
Parameters
Type | Name | Description |
---|---|---|
IAttachableChild | child | The child to be detached. |
Returns
Type | Description |
---|---|
Boolean | True, if the detachment succeded |
Examples
GraphicComponentGroup Example.
Project.UndoContext.BeginUndoStep("GraphicComponentGroupProperties");
try
{
Station station = Station.ActiveStation;
// Create the GraphicComponentGroup.
GraphicComponentGroup myGCGroup = new GraphicComponentGroup();
myGCGroup.Name = "myGCGroup";
// Add the GraphicComponentGroup to the GraphicComponents of the station.
station.GraphicComponents.Add(myGCGroup);
// Create a part.
Part myPart1 = new Part();
myPart1.Name = "MyPart1";
// Create a box and add it to myPart1.
Body box = Body.CreateSolidBox(new Matrix4(Vector3.XVector, 0.0), new Vector3(0.4, 0.4, 0.4));
box.Name = "MyBox";
myPart1.Bodies.Add(box);
// Add myPart1 to myGCGroup.
myGCGroup.GraphicComponents.Add(myPart1);
// Create another part.
Part myPart2 = new Part();
myPart2.Name = "MyPart2";
//Create a cylinder and add it to myPart2.
Matrix4 origin = new Matrix4(new Vector3(0.5, 0.5, 0.5), 0.0);
Body myCylinder = Body.CreateSolidCylinder(origin, 0.2, 1);
myCylinder.Name = "myCylinder";
myPart2.Bodies.Add(myCylinder);
// Add myPart1 to myGCGroup.
myGCGroup.GraphicComponents.Add(myPart2);
// Create a third part.
Part myPart3 = new Part();
myPart3.Name = "MyPart3";
// Create a box and add it to myPart3.
Body box2 = Body.CreateSolidBox(new Matrix4(Vector3.XVector, 0.0), new Vector3(0.1, 0.1, 0.1));
box2.Name = "MyBox_2";
myPart3.Bodies.Add(box2);
// Add myPart3 to the station.
station.GraphicComponents.Add(myPart3);
// Attach myPart3 to myGCGroup, mount it on top of the cylinder, using an offset matrix.
if (myGCGroup.CanAttachChild(myPart3))
{
myGCGroup.Attach(myPart3, true, new Matrix4(new Vector3(0.0, 0.0, 1.0)));
}
else
{
Logger.AddMessage(new LogMessage("Could not attach myPart3 to myGCGroup"));
}
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
MergeToPart()
Copies all geometry into a single Part.
Declaration
public Part MergeToPart()
Returns
Type | Description |
---|---|
Part |
Remarks
CAD geometry will be preserved only if all contained Parts have geometry.
MergeToPart(IProgressCallback)
Copies all geometry into a single Part.
Declaration
public Part MergeToPart(IProgressCallback progress)
Parameters
Type | Name | Description |
---|---|---|
IProgressCallback | progress | Progress notification |
Returns
Type | Description |
---|---|
Part |
Remarks
CAD geometry will be preserved only if all contained Parts have geometry.
Scale(Double, IProgressCallback)
Scales all geometry uniformly around the origin of the group.
Declaration
public void Scale(double factor, IProgressCallback progress = null)
Parameters
Type | Name | Description |
---|---|---|
Double | factor | Scale factor |
IProgressCallback | progress | Progress callback |