# How to get the coordinates of the nested component's axis relative to the world coordinate system?

**URL:** <https://forums.sketchup.com/t/how-to-get-the-coordinates-of-the-nested-components-axis-relative-to-the-world-coordinate-system/251564>\
**Category:** Ruby API\
**Tags:** components\
**Created:** [December 12, 2023, 7:44am UTC](https://forums.sketchup.com/t/how-to-get-the-coordinates-of-the-nested-components-axis-relative-to-the-world-coordinate-system/251564 "2023-12-12T07:44:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sohappy\_kk](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@sohappy\_kk](https://forums.sketchup.com/u/sohappy_kk)\
**Post date:** [December 12, 2023, 7:44am UTC](https://forums.sketchup.com/t/how-to-get-the-coordinates-of-the-nested-components-axis-relative-to-the-world-coordinate-system/251564/1 "2023-12-12T07:44:20Z")

</div>

Hi fellow seniors, I have encountered a problem now. I am traversing some components in the scene, and they may be within a certain component or group, and may be nested at multiple levels. Now I need to get the component axes of these components. The coordinates are relative to the world coordinate system, but when I use the .transformation.origin method, the results are relative to the coordinate axis in the group space where it is located. I try to determine the parent space where these components are located. parent , when it is in a group, the return value is ComponentDefinition. I am a little confused, why is it not a component instance or group? Now how do I proceed, is there perhaps a more convenient way to get the coordinates of the component axis within the group relative to the world coordinate system? Thank you so much!

---

<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:** [December 12, 2023, 3:43pm UTC](https://forums.sketchup.com/t/how-to-get-the-coordinates-of-the-nested-components-axis-relative-to-the-world-coordinate-system/251564/2 "2023-12-12T15:43:46Z")

</div>

> [@sohappy\_kk](#):
>
> I try to determine the parent space where these components are located. parent , when it is in a group, the return value is ComponentDefinition. I am a little confused, why is it not a component instance or group?

Because component and group instances do **not** themselves have an [`Entities`](https://ruby.sketchup.com/Sketchup/Entities.html) collection. It is their parent **definition** that owns the collection of entities.

> [@sohappy\_kk](#):
>
> Now how do I proceed, is there perhaps a more convenient way to get the coordinates of the component axis within the group relative to the world coordinate system?

As you traverse the model hierarchy, build a current path of the instances in an array and then you can get the combined transformation via [`InstancePath#transformation`](https://ruby.sketchup.com/Sketchup/InstancePath.html#transformation-instance_method) by passing that array to the [`InstancePath`](https://ruby.sketchup.com/Sketchup/InstancePath.html#initialize-instance_method) class constructor method.
