Hide Table of Contents
IGetChildren Method (IComponent2)

Gets all of the children components of this component.

.NET Syntax

Visual Basic (Declaration) 
Function IGetChildren() As Component2
Visual Basic (Usage) 
Dim instance As IComponent2
Dim value As Component2
 
value = instance.IGetChildren()
C# 
Component2 IGetChildren()
C++/CLI 
Component2^ IGetChildren(); 

Return Value

  • in-process, unmanaged C++: Pointer to an array of IComponent2 objects
  • VBA, VB.NET, C#, and C++/CLI: Not supported
  • See In-process Methods for details about this type of method.

    Remarks

    If this assembly component is a part document, SolidWorks returns NULL. If this assembly component is the root component or a subassembly, then this method returns the child components that belong to the assembly document.

    The typical order of calls needed in assembly traversal is:

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

     

    COM applications should use to IComponent2::IGetChildrenCount to determine the number of component children, which is the size of the array required to IComponent2::IGetChildren. Because IComponent2::IGetChildren returns an array, this code must be used in an in-process DLL.

    You must call the IComponent2::GetChildren method recursively because it returns only the immediate (one level) children. It does not get child components of the sub-assemblies. For example, if one of the child components of a component is a sub-assembly that has its own children, those children are not returned by this method. You need to call this method again from that sub-assembly component to get its children.

    For a given component, this method returns all of the immediate child components. This includes suppressed, hidden, and lightweight components. Use IComponent2::Visible and IComponent2::GetSuppression to detect the component states.

    Results of an assembly traversal vary based on the configuration currently displayed in your main assembly and based on the configuration referenced by the subassembly component. The list of child components that this method returns can be different depending on which configuration is referenced by the component (see IConfigurationManager::ActiveConfiguration and IComponent2::ReferencedConfiguration).

    For example, if one configuration of your main assembly contains a suppressed subassembly, IComponent2::GetChildren returns an empty array when you call it from that suppressed subassembly component. As another example, a subassembly document (.sldasm file) can contain several configurations, each of which has varying states of suppression for its child components. When inserted into your main assembly, this subassembly
    document can reference any of these configurations. As a result, you might find that the child component suppression states vary based on which configuration is referenced by the subassembly component.

    NOTE: Components might not be returned in the same order from call to call.

     

    See Also

    Availability

    SolidWorks 2001Plus FCS, Revision Number 10.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

     
    *Email:  
    Subject:   Feedback on Help Topics
    Page:   IGetChildren Method (IComponent2)
    *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) 2010 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.