Click or drag to resize
GraphicComponent Class
The base class of all objects in the station that represent physical objects or entities.
Inheritance Hierarchy

Namespace:  ABB.Robotics.RobotStudio.Stations
Assembly:  ABB.Robotics.RobotStudio.Stations (in ABB.Robotics.RobotStudio.Stations.dll) Version: 7.0.8747.636
Syntax
C#
public abstract class GraphicComponent : ProjectObject, 
	IHasTransform, IHasFrames, IAttachableChild, ISupportCopy

The GraphicComponent type exposes the following members.

Constructors
  NameDescription
Protected methodGraphicComponent
Initializes a new instance of the GraphicComponent class
Protected methodGraphicComponent(PimDocument)
Initializes a new instance of the GraphicComponent class
Protected methodGraphicComponent(GraphicComponent)
Initializes a new instance of the GraphicComponent class
Top
Properties
  NameDescription
Public propertyAttributes
Returns a collection of dynamic attributes attached to the object
(Inherited from ProjectObject.)
Public propertyChildren
Enumerates all child objects.
(Inherited from ProjectObject.)
Public propertyClipPlane
Gets or sets a ClipPlane that will hide all geometry in the negative z space of its transform.
Public propertyCode exampleColor
Gets or sets the color of the object in the graphics.
Public propertyContainingProject
Returns the Project that this object is a part of, or null if it is not part of a Project.
(Inherited from ProjectObject.)
Public propertyDetectable
Gets or sets a value indicating the the component can be detected by sensors.
Public propertyDisplayName
Gets the name of the the object that should be displayed in the GUI.
(Inherited from ProjectObject.)
Public propertyFrames
Gets a FrameCollection object that represents all the Frames on this object.
Protected propertyGfxData
Protected propertyInternalChildren (Inherited from ProjectObject.)
Protected propertyInternalParent (Inherited from ProjectObject.)
Public propertyLibrary
Returns the GraphicComponentLibrary that contains the definition of this component, or null.
Public propertyName
Gets or sets the name of the object
(Inherited from ProjectObject.)
Public propertyOpacity
Gets or sets the opacity of the object.
Public propertyCode exampleParent
The Parent property returns a reference to the parent GraphicComponent object.
(Overrides ProjectObjectParent.)
Public propertyCode examplePickingEnabled
Gets or sets if the component can be picked and selected in 3D graphic windows.
Public propertyCode exampleTransform
Gets the Transform of the object.
Public propertyTypeDisplayName
Gets a localized name for the type of this object.
(Inherited from ProjectObject.)
Public propertyUIVisible
Gets or sets a value that indicates if this object should be displayed in GUI such as an object browser.
(Inherited from ProjectObject.)
Public propertyUniqueId
Gets a persisted, globally unique identifier for this object, that can be used to find the object using the GetObjectFromUniqueId(String) method.
(Inherited from ProjectObject.)
Public propertyCode exampleVisible
Gets or sets whether the object should be displayed in the graphics or not.
Top
Methods
  NameDescription
Protected methodAfterLoad (Overrides ProjectObjectAfterLoad(PimDocument).)
Protected methodBackup (Inherited from ProjectObject.)
Protected methodBeforeSave (Inherited from ProjectObject.)
Public methodStatic memberCanImport
Returns true if the fileName refers to a file type that is possible to import using ImportAsync().
Public methodCode exampleCopy
Creates a deep copy of the object.
Public methodCode exampleCopyInstance
Creates a copy but keeps a connection to the definition of the GraphicComponent, typically in a Library definition.
Public methodDelete
Deletes this object permanently.
Public methodCode exampleDeleteGeometry
Recursively deletes all CAD geometry.
Public methodDeleteGeometry(Boolean) Obsolete.
Public methodCode exampleDisconnectFromLibrary
Moves the definition to the Station or Project. This causes the Library property to return Null.
Public methodEquals (Inherited from Object.)
Public methodExportXml(String)
Exports this to an XML file
Public methodExportXml(String, String)
Exports this to an XML file
Protected methodFinalize (Inherited from Object.)
Public methodFindObjects
Recursively finds object that satisfy a condition.
(Inherited from ProjectObject.)
Public methodGetBoundingBox(Boolean)
Computes the (axis-aligned) bounding box for this object.
Public methodCode exampleGetBoundingBox(Boolean, Vector3, Vector3) Obsolete.
Computes the (axis-aligned) bounding box for this object.
Public methodGetBoundingBox(Boolean, IntPtr, IntPtr) Obsolete.
Protected methodGetGfxChildren
Protected methodGetGfxMatrix
Public methodGetHashCode (Inherited from Object.)
Protected methodGetMatrix
Public methodCode exampleGetNormalToSurface Obsolete.
Calculates the closest point and the corresponding normal.
Public methodGetType (Inherited from Object.)
Public methodCode exampleHighlight(Boolean)
Highlights the object using the default highlight style and color.
Public methodHighlight(Boolean, Color)
Highlights the object using a specified color.
Public methodStatic memberImportAsync(String)
Creates a GraphicComponent from the given CAD or graphics file.
Public methodStatic memberImportAsync(String, GraphicImportSettings, IProgressCallback)
Creates a GraphicComponent from the given CAD or graphics file.
Public methodStatic memberImportXml(String) Obsolete.
Public methodStatic memberImportXml(String, String) Obsolete.
Public methodStatic memberImportXml(String, String, DictionaryString, String) Obsolete.
Public methodStatic memberImportXml(String, String, String, String) Obsolete.
Public methodStatic memberImportXmlAsync(String)
Creates a GraphicComponent from an RSXML file.
Public methodStatic memberImportXmlAsync(String, String)
Creates a GraphicComponent specified in a Library XML file.
Public methodStatic memberImportXmlAsync(String, String, DictionaryString, String)
Creates a GraphicComponent specified in a Library XML file.
Public methodStatic memberImportXmlAsync(String, String, String, String)
Creates a GraphicComponent from in-memory XML.
Protected methodMemberwiseClone (Inherited from Object.)
Public methodCode exampleMoveDefinitionToLibrary
Moves the definition to a new Library.
Protected methodNotifyChange (Inherited from ProjectObject.)
Protected methodNotifyChange(ProjectObjectChangeType) (Inherited from ProjectObject.)
Protected methodOnCreatingObject (Overrides ProjectObjectOnCreatingObject.)
Protected methodOnDelete (Overrides ProjectObjectOnDelete.)
Protected methodOnUndoRedo (Overrides ProjectObjectOnUndoRedo.)
Public methodSetMaterial
Sets the material of the object.
Protected methodSetMatrix
Public methodToString (Inherited from ProjectObject.)
Public methodCode exampleTryGetNormalToSurface
Calculates the closest point and the corresponding normal.
Top
Fields
Examples
GraphicComponent Example.
Part Properties Example
Project.UndoContext.BeginUndoStep("PartProperties");
try
{
    Station station = Station.ActiveStation;

    // Create a part.
    #region PartPropertiesStep1
    Part myPart1 = new Part();
    myPart1.Name = "MyPart_1";
    #endregion

    // Add the part to the graphics componenets collection of the station.
    #region PartPropertiesStep2
    station.GraphicComponents.Add(myPart1);
    #endregion

    // Create a box and add it to myPart.
    #region PartPropertiesStep3
    Matrix4 box_origin = new Matrix4(Vector3.XVector, 0.0);
    Vector3 box_size = new Vector3(0.1, 0.1, 0.1);
    Body box = Body.CreateSolidBox(box_origin, box_size);
    box.Name = "MyBox";
    myPart1.Bodies.Add(box);
    #endregion

    // Create a cylinder and add it to myPart.
    #region PartPropertiesStep4
    Matrix4 origin = new Matrix4(new Vector3(Axis.X), 0.0);
    double radius = 0.2;
    double height = 1.0;
    Body myCylinder = Body.CreateSolidCylinder(origin, radius, height);
    myCylinder.Name = "MyCylinder";
    myPart1.Bodies.Add(myCylinder);
    #endregion

    // Make all the geometries in myPart orange.
    // When using VSTA, change to these lines instead:
    // Byte R1 = 255; Byte G1 = 165; Byte B1 = 0;
    // VSTABridge.SetColor(myPart, R1, G1, B1);
    #region PartPropertiesStep5
    myPart1.Color = Color.Orange;
    #endregion

    #region PartPropertiesStep6
    myPart1.Visible = true;
    #endregion
    myPart1.PickingEnabled = true;

    // Move myPart and all the bodies in it 100 mm along the 
    //X-axis and 100 mm along the Y-axis.
    #region PartPropertiesStep7
    myPart1.Transform.X = myPart1.Transform.X + 0.1;
    myPart1.Transform.Y = myPart1.Transform.Y + 0.1;
    #endregion

    // Create a copy of myPart.
    #region PartPropertiesStep8
    Part myPart2 = (Part)myPart1.Copy();
    myPart2.Name = "MyPart_2";
    #endregion

    // Add myPart2 to the station.
    #region PartPropertiesStep9
    station.GraphicComponents.Add(myPart2);
    #endregion
    #region PartPropertiesStep10
    GraphicComponentLibrary myLib = myPart2.MoveDefinitionToLibrary();
    Logger.AddMessage(
      new LogMessage("The RootComponent of the Lib is: " + myLib.RootComponent.Name));

    // Save a copy of the lib.
    // Get the path to the UserProjectsFolder.
    string userProjPath =
        (string)Options.GetValue("RobotStudio", "Directories.UserProjects");
    if (userProjPath != null)
    {
        myLib.SaveAs(userProjPath + "\\Libraries\\myLib.rslib");
    }
    else
    {
        // If there is no UserprojPath, save it in user documents.
        myLib.SaveAs(Path.Combine
        (System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), "myLib.rslib"));
    }
    #endregion

    // Create a new instance of myPart.
    #region PartPropertiesStep11
    Part myPart3 = (Part)myPart1.CopyInstance();
    #endregion

    // Add myPart3 to the station.
    station.GraphicComponents.Add(myPart3);

    // Delete the geometry of myPart3, this causes 
    // the geometry of myPart1 to be deleted to,
    // since they use the same definition.
    #region PartPropertiesStep12
    myPart3.DeleteGeometry();
    #endregion

    // Disconnect myPart2 from its library.
    #region PartPropertiesStep13
    myPart2.DisconnectFromLibrary();
    #endregion

    // Get the normal of myPart2
    #region PartPropertiesStep14
    BoundingBox bbox = myPart2.GetBoundingBox(true);
    Vector3 firstCorner = bbox.min;
    Vector3 secondCorner = bbox.max;
    Logger.AddMessage
        (new LogMessage("The first corner of the bounding box is ( "
        + firstCorner.x + "; " + firstCorner.y + "; " + firstCorner.z + ")"));
    Logger.AddMessage
        (new LogMessage("The second corner of the bounding box is ( "
        + secondCorner.x + "; " + secondCorner.y + "; " + secondCorner.z + ")"));
    Vector3 testPoint = new Vector3(0.0, 0.0, 0.0);
    Vector3 hitPoint;
    Vector3 hitPointNormal;
    Face hitFace;
    myPart2.GetNormalToSurface(testPoint, out hitPoint, out hitPointNormal, out hitFace);
    #endregion

    // Make the hitFace green.
    // When using VSTA, change to these lines instead:
    // Byte R = 0; Byte G = 255; Byte B = 0;
    // VSTABridge.SetColor(hitFace, R, G, B);
    hitFace.Color = Color.Green;

    Logger.AddMessage
     (new LogMessage("The hit point from GetNormalToSurface at test point (0,0,0) is: ( "
     + hitPoint.x + "; " + hitPoint.y + "; " + hitPoint.z + ")"));
    Logger.AddMessage
     (new LogMessage("The hit point normal from GetNormalToSurface at test point (0,0,0) is: ( "
     + hitPointNormal.x + "; " + hitPointNormal.y + "; " + hitPointNormal.z + ")"));
}
catch
{
    Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
    throw;
}
finally
{
    Project.UndoContext.EndUndoStep();
}
Version Information

Supported in: 1.0.0.0
See Also