Hide Table of Contents
GetRootComponent3 Method (IConfiguration)

Gets the root component for this assembly configuration.

.NET Syntax

Visual Basic (Declaration) 
Function GetRootComponent3( _
   ByVal Resolve As System.Boolean _
) As Component2
Visual Basic (Usage) 
Dim instance As IConfiguration
Dim Resolve As System.Boolean
Dim value As Component2
value = instance.GetRootComponent3(Resolve)
Component2 GetRootComponent3( 
   System.bool Resolve
Component2^ GetRootComponent3( 
&   System.bool Resolve


True to activate this configuration; false otherwise

Return Value

  • IComponent2, if Resolve is set to true
  • IComponent2, if Resolve is set to false, and the configuration is active
  • Null or Nothing, if Resolve is set to false and the configuration is not active



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 Nothing 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. IModelDoc2::GetConfigurationByName (called only once)
  2. IConfiguration::GetRootComponent3 (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 or Nothing.

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


See Also


SolidWorks 2010 FCS, Revision Number 18.0

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

Subject:   Feedback on Help Topics
Page:   GetRootComponent3 Method (IConfiguration)
*   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:


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

Web Help Content Version: API Help (English only) 2013 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.