# Find\_entity\_by\_id returns different Entity

**URL:** <https://forums.sketchup.com/t/find-entity-by-id-returns-different-entity/344443>\
**Category:** Ruby API\
**Created:** [February 5, 2026, 10:00pm UTC](https://forums.sketchup.com/t/find-entity-by-id-returns-different-entity/344443 "2026-02-05T22:00:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pat\_99](https://avatars.discourse-cdn.com/v4/letter/p/e480ec/32.png) [@Pat\_99](https://forums.sketchup.com/u/Pat_99)\
**Post date:** [February 5, 2026, 10:00pm UTC](https://forums.sketchup.com/t/find-entity-by-id-returns-different-entity/344443/1 "2026-02-05T22:00:23Z")

</div>

In the attached file there is a component which contains a subcomponent and within this is only an edge.

When getting the subcomponent by **find\_entity\_by\_id** (entity.guid) Sketchup is returning a different object with a different scale.

I already solved the issue by directly storing the entity in the list but I wonder what is causing this problem here.

Here is a simplified script to reproduce the issue:

```auto
def print_details(entity)
msg = “\n===============================\n”
msg += “#{entity}”
msg += “\nTYPE: #{entity.class}”
msg += “\nGUID: #{entity.guid}”
msg += “\nEntityID: #{entity.entityID}”
msg += “\nPERS ID: #{entity.persistent_id}\n”
msg += (“\nDef name: " + entity.definition.name + “\n”)
msg += “Matrix: #{entity.transformation.to_a.join(”,\n”)}\n"
puts msg
end

def id_test()
model = Sketchup::active_model

ent_instance = nil

model.entities.each do |entity|
if entity.is_a? Sketchup::ComponentInstance
entity.definition.entities.each do |sub_ent|
if sub_ent.is_a? Sketchup::ComponentInstance
ent_instance = sub_ent
break
end
end
end
end

print_details(ent_instance)

ent_tmp = Sketchup.active_model.find_entity_by_id(ent_instance.guid)

print_details(ent_tmp)
end

```

> # OUTPUT:
> 
> #Sketchup::ComponentInstance:0x0000028d81d68948
> 
> TYPE: Sketchup::ComponentInstance
> 
> GUID: 3kG1Q74FTAjRALzO029s2s
> 
> EntityID: 19876
> 
> PERS ID: 860278
> 
> Def name: centerline
> 
> Matrix: 1.0,
> 
> 0.0,
> 
> 7.048027557333175e-29,
> 
> 0.0,
> 
> 0.0,
> 
> 1.0,
> 
> 0.0,
> 
> 0.0,
> 
> 4.674090022094917e-28,
> 
> 0.0,
> 
> 30.617283950617278,
> 
> 0.0,
> 
> 1.830708661417323,
> 
> 1.8307086614173222,
> 
> 0.0,
> 
> 1.0
> 
> ===============================
> 
> #Sketchup::ComponentInstance:0x0000028d81b39320
> 
> TYPE: Sketchup::ComponentInstance
> 
> GUID: 3kG1Q74FTAjRALzO029s2s
> 
> EntityID: 17391
> 
> PERS ID: 859635
> 
> Def name: centerline
> 
> Matrix: 1.0,
> 
> 0.0,
> 
> 1.1100643402799756e-28,
> 
> 0.0,
> 
> 0.0,
> 
> 1.0,
> 
> 0.0,
> 
> 0.0,
> 
> 4.674090022094918e-28,
> 
> 0.0,
> 
> 48.22222222222222,
> 
> 0.0,
> 
> 1.830708661417323,
> 
> 1.8307086614173222,
> 
> -6.310887241768095e-30,
> 
> 1.0
> 
> =\> nil

[get\_by\_guid\_issue.skp](https://forums.sketchup.com/uploads/short-url/vgng9MHw4EHxWUkMdZ92eRTjVGF.skp) (634.1 KB)

---

<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:** [February 5, 2026, 11:01pm UTC](https://forums.sketchup.com/t/find-entity-by-id-returns-different-entity/344443/2 "2026-02-05T23:01:21Z")

</div>

> [@Pat\_99](#):
>
> I already solved the issue by directly storing the entity in the list but I wonder what is causing this problem here.

If you have more than one instance of the outer component, then each will share the subcomponent instance because they have the same definition. (It is the definition that has the collection of entities.)
