Search Results for

    Show / Hide Table of Contents

    Class GraphicComponentCollection

    A collection of GraphicComponent objects.

    Inheritance
    object
    GraphicComponentCollection
    Namespace: ABB.Robotics.RobotStudio.Stations
    Assembly: ABB.Robotics.RobotStudio.Stations.dll
    Syntax
    public class GraphicComponentCollection
    Examples

    GraphicComponent Collection.

    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 user project folder.
                string userProjPath =
                    (string)Options.GetValue("RobotStudio", "Directories.UserDocuments");
                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
                // Close the library
                myLib.Close();
    
                // 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.TryGetNormalToSurface(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();
            }</code></pre>
    

    Properties

    View Source

    Count

    Declaration
    public virtual int Count { get; }
    Property Value
    Type Description
    int
    View Source

    IsSynchronized

    Declaration
    [ExcludeFromCodeCoverage]
    public virtual bool IsSynchronized { get; }
    Property Value
    Type Description
    bool
    View Source

    this[int]

    Declaration
    public GraphicComponent this[int index] { get; }
    Parameters
    Type Name Description
    int index
    Property Value
    Type Description
    GraphicComponent
    View Source

    this[string]

    This is obsolete, use TryGetGraphicComponent instead.

    Declaration
    public GraphicComponent this[string name] { get; }
    Parameters
    Type Name Description
    string name
    Property Value
    Type Description
    GraphicComponent

    The first GraphicComponent with this name in the collection.

    View Source

    Parent

    Declaration
    public ProjectObject Parent { get; }
    Property Value
    Type Description
    ProjectObject
    View Source

    SyncRoot

    Declaration
    [ExcludeFromCodeCoverage]
    public virtual object SyncRoot { get; }
    Property Value
    Type Description
    object

    Methods

    View Source

    Add(GraphicComponent)

    Adds a GraphicComponent to the collection.

    Declaration
    public void Add(GraphicComponent graphicComponent)
    Parameters
    Type Name Description
    GraphicComponent graphicComponent

    The GraphicComponent to add to the collection.

    Examples

    Add GraphicComponent.

    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 user project folder.
                string userProjPath =
                    (string)Options.GetValue("RobotStudio", "Directories.UserDocuments");
                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
                // Close the library
                myLib.Close();
    
                // 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.TryGetNormalToSurface(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();
            }</code></pre>
    
    View Source

    AddLibraryComponent(string)

    Loads a library component from a file and adds it to the collection.

    Declaration
    public GraphicComponent AddLibraryComponent(string fileName)
    Parameters
    Type Name Description
    string fileName

    File name of the library file (.rslib) to load.

    Returns
    Type Description
    GraphicComponent

    The added GraphicComponent.

    View Source

    Clear()

    Declaration
    public void Clear()
    View Source

    Clear(bool)

    Declaration
    public void Clear(bool disposeChildren)
    Parameters
    Type Name Description
    bool disposeChildren
    View Source

    Contains(GraphicComponent)

    Declaration
    public bool Contains(GraphicComponent obj)
    Parameters
    Type Name Description
    GraphicComponent obj
    Returns
    Type Description
    bool
    View Source

    Contains(string)

    Declaration
    public bool Contains(string name)
    Parameters
    Type Name Description
    string name
    Returns
    Type Description
    bool
    View Source

    CopyTo(GraphicComponent[], int)

    Declaration
    public void CopyTo(GraphicComponent[] array, int index)
    Parameters
    Type Name Description
    GraphicComponent[] array
    int index
    View Source

    CopyTo(Array, int)

    Declaration
    public virtual void CopyTo(Array array, int index)
    Parameters
    Type Name Description
    Array array
    int index
    View Source

    GetEnumerator()

    Declaration
    public IEnumerator GetEnumerator()
    Returns
    Type Description
    IEnumerator
    View Source

    IndexOf(GraphicComponent)

    Declaration
    public int IndexOf(GraphicComponent obj)
    Parameters
    Type Name Description
    GraphicComponent obj
    Returns
    Type Description
    int
    View Source

    Insert(int, GraphicComponent)

    Declaration
    public void Insert(int index, GraphicComponent graphicComponent)
    Parameters
    Type Name Description
    int index
    GraphicComponent graphicComponent
    View Source

    Remove(GraphicComponent)

    Remove a GraphicComponent from the collection.

    Declaration
    public void Remove(GraphicComponent graphicComponent)
    Parameters
    Type Name Description
    GraphicComponent graphicComponent

    The GraphicComponent to remove from the collection.

    Remarks

    If this is a mechanism and robot, the dummy task associated with this will also be removed.

    Examples

    Remove GraphicComponent.

    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 user project folder.
                string userProjPath =
                    (string)Options.GetValue("RobotStudio", "Directories.UserDocuments");
                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
                // Close the library
                myLib.Close();
    
                // 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.TryGetNormalToSurface(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();
            }</code></pre>
    
    View Source

    Remove(GraphicComponent, bool)

    Remove a GraphicComponent from the collection.

    Declaration
    public void Remove(GraphicComponent graphicComponent, bool dispose)
    Parameters
    Type Name Description
    GraphicComponent graphicComponent

    The GraphicComponent to remove from the collection.

    bool dispose

    Indicates if the GraphicComponent should be disposed when this change is no longer undoable. Set to true if the component will not be used subsequently.

    Remarks

    If this is a mechanism and robot, the dummy task associated with this will also be removed. Trying to remove a component from a Mechanism will cause an exception.

    Examples

    Remove GraphicComponent.

    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 user project folder.
                string userProjPath =
                    (string)Options.GetValue("RobotStudio", "Directories.UserDocuments");
                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
                // Close the library
                myLib.Close();
    
                // 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.TryGetNormalToSurface(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();
            }</code></pre>
    
    View Source

    ToArray()

    Declaration
    public GraphicComponent[] ToArray()
    Returns
    Type Description
    GraphicComponent[]
    View Source

    TryGetGraphicComponent(string, out GraphicComponent)

    Gets the GraphicComponent with the specified name.

    Declaration
    public bool TryGetGraphicComponent(string name, out GraphicComponent graphicComponent)
    Parameters
    Type Name Description
    string name

    The name of the GraphicComponent to get.

    GraphicComponent graphicComponent

    When this method returns, contains the GraphicComponent associated with the specified name, if the name is found; otherwise, null.

    Returns
    Type Description
    bool

    true if the GraphicComponentCollection contains an element with the specified name; otherwise, false.

    Exceptions
    Type Condition
    ArgumentException

    name is a null reference.

    • View Source
    In this article
    Back to top Copyright © 2026 ABB Robotics