# Create a subcomponent of a selected component

**URL:** <https://forums.sketchup.com/t/create-a-subcomponent-of-a-selected-component/181952>\
**Category:** Ruby API\
**Tags:** components\
**Created:** [November 21, 2021, 3:21pm UTC](https://forums.sketchup.com/t/create-a-subcomponent-of-a-selected-component/181952 "2021-11-21T15:21:38Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [November 22, 2021, 8:50pm UTC](https://forums.sketchup.com/t/create-a-subcomponent-of-a-selected-component/181952/4 "2021-11-22T20:50:41Z")

</div>

> [@juliendufren2016](#):
>
> No, the definition of the child component is not defined.  
> So I need your help to define it.

Then define it … definition objects are created using a factory method of the model’s [`DefinitionList`](https://ruby.sketchup.com/Sketchup/DefinitionList.html) collection. See:

- [`Sketchup::DefinitionList.add()`](https://ruby.sketchup.com/Sketchup/DefinitionList.html#add-instance_method)

Once the “child” definition exists, code can add instances of it to any entities collection, be it the model’s or one of the (group or component) definition’s entities.

---

_[View the full topic](https://forums.sketchup.com/t/create-a-subcomponent-of-a-selected-component/181952)._
