Hide Table of Contents
GetRootComponent Method (IConfiguration)

Obsolete. Superseded by IConfiguration::GetRootComponent3.

.NET Syntax

Visual Basic (Declaration) 
Function GetRootComponent() As Object
Visual Basic (Usage) 
Dim instance As IConfiguration
Dim value As Object
 
value = instance.GetRootComponent()
C# 
object GetRootComponent()
C++/CLI 
Object^ GetRootComponent(); 

Return Value

Root component and an IComponent2 object

Example

Remarks

Because every assembly has at least one configuration, you can use this method to begin traversing an assembly and its components.

This method returns a component object that is, essentially, a launching point for your assembly traversal. It is useful only for calling IComponent2::GetChildren. Most other IComponent2 object functions do not work with this root component object and return NULL or an error condition. You can call IComponent2::IsRoot to determine if you have the root component.

An IComponent2 object is based on the currently active configuration; one assembly configuration might suppress the component, while another might display it. Therefore, your traversal of IComponent2 objects might vary if you switch to a different configuration.

The order of calls used in a typical assembly traversal is:

  1. IConfigurationManager::ActiveConfiguration (called only once)
  2. IConfiguration::GetRootComponent (called only once)
  3. IComponent2::GetChildren (called recursively)

From the SolidWorks API, the IConfiguration and IComponent2 objects provide access to all the child components, their transforms, their bodies, as seen in a specific assembly configuration. The component body objects and component transforms can vary based on the configuration; therefore, you should traverse components for each configuration. For example, one assembly configuration might include an assembly-level feature that cuts a hole through each of the components in the assembly.

You can use IComponent2::GetBody on each assembly component to get the body of each component with the hole feature that was applied in this configuration. If you switch to a configuration without the assembly-level hole and re-traverse the component objects, then IComponent2::IGetBody returns the body object without the hole feature.

SolidWorks generates an IAssemblyDoc RegenNotify event to indicate that a change might have taken place in one of your components. If you receive an IAssemblyDoc RegenNotify event, then you should re-traverse your components to be sure that your information is up-to-date.

If this method is called from the configuration of a part document, SolidWorks returns NULL.

You should use this method of assembly traversal to replace previous calls to the member class.

 

See Also



Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   GetRootComponent Method (IConfiguration)
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:




x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: API Help (English only) 2012 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.