# How to p-a-r-s-e a model with Nested Component Information

**URL:** <https://forums.sketchup.com/t/how-to-p-a-r-s-e-a-model-with-nested-component-information/46837>\
**Category:** SketchUp SDK\
**Tags:** sketchup, render, sdk, components, subcomponents\
**Created:** [June 19, 2017, 7:50am UTC](https://forums.sketchup.com/t/how-to-p-a-r-s-e-a-model-with-nested-component-information/46837 "2017-06-19T07:50:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sanketsans](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/sanketsans/32/33475_2.png) [@sanketsans](https://forums.sketchup.com/u/sanketsans)\
**Post date:** [June 19, 2017, 7:50am UTC](https://forums.sketchup.com/t/how-to-p-a-r-s-e-a-model-with-nested-component-information/46837/1 "2017-06-19T07:50:10Z")

</div>

Hey,  
I was parsing a model with component and models. When I parse it, I get the information from ModelInfo i.e;

 ![](https://global.discourse-cdn.com/sketchup/original/3X/0/d/0d3e0491b82d35b1fbef5a03f35efd72843e739b.png)  
But since, it says there are no faces nor edges - I am not able to render it or create a Mesh ( since creating a mesh requires a face).  
But when I check the Nested Component option i.e;  
 ![](https://global.discourse-cdn.com/sketchup/original/3X/d/2/d2758a6fd9375d3a17a05668169519c87ae161d9.png)  
I get all the information about faces , edges, etc.  
My question is how to parse this kind of model or how to get the information as given by checking the Nested component option. I have already referred to skp\_to\_xml sample in sketchup sdk -There is no information about the same in it ! ( I am using C++)

---

<div class="post-metadata">

**Author:** ![Aerilius](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@Aerilius](https://forums.sketchup.com/u/Aerilius)\
**Post date:** [June 19, 2017, 12:02pm UTC](https://forums.sketchup.com/t/how-to-p-a-r-s-e-a-model-with-nested-component-information/46837/2 "2017-06-19T12:02:23Z")

</div>

SketchUp has more entity types than just faces. That means if you are looking only for faces, but not for component instances, you won’t find faces inside component instances.

You either have to get the instances (and groups) in the current entities collection:

1. [SUEntitiesGetInstances](http://extensions.sketchup.com/developer_center/sketchup_c_api/sketchup/entities_8h.html#ac76f012418ee2a76e70270150efc1f13)
2. and then you get the definition for an instance [SUComponentInstanceGetDefinition](http://extensions.sketchup.com/developer_center/sketchup_c_api/sketchup/component__instance_8h.html#a6ea3ed30018c6d2b746f1f0073790861)
3. get its entities [SUComponentDefinitionGetEntities](http://extensions.sketchup.com/developer_center/sketchup_c_api/sketchup/component__definition_8h.html#a54f87a72b985e301d74e7348dfb47add)
4. and then its transformation and contained faces, (and again recursively all contained instances and groups as above!) [SUEntitiesGetFaces](http://extensions.sketchup.com/developer_center/sketchup_c_api/sketchup/entities_8h.html#a2aba417c8e046c51cd849fd50dec75e5)

There might be a non-recursive alternative by just reading the definitions and where they are contained (kind of a nesting/dependency **graph** ).

1. Get the definitions: [SUModelGetComponentDefinitions](http://extensions.sketchup.com/developer_center/sketchup_c_api/sketchup/model_8h.html#a88a0130f20d41b5d51083b08fec8ce3e) (analog for [SUModelGetGroupDefinitions](http://extensions.sketchup.com/developer_center/sketchup_c_api/sketchup/model_8h.html#ae71ebf4bf59085ca433140699dce7ce4))
2. and for each definition you get the contained geometry
3. and for all instances ([SUComponentDefinitionGetInstances](http://extensions.sketchup.com/developer_center/sketchup_c_api/sketchup/component__definition_8h.html#ac46e626a68dcd4b882d22e35634c08fa)) the transformation and the parent entities (I don’t know how in C API?).

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sketchup/original/3X/f/2/f2a121500b085ed60806607a82720b092d800bb3.png) [@system](https://forums.sketchup.com/u/system)\
**Post date:** [September 19, 2017, 4:02am UTC](https://forums.sketchup.com/t/how-to-p-a-r-s-e-a-model-with-nested-component-information/46837/3 "2017-09-19T04:02:29Z")

</div>

Closed on September 19, 2017, 4:02am UTC

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.
