Space.Number and Space Level is returning a diferente number than where he actualy is

Hi there,

Im runing a dynamo script where i need to get the level and division number of the all elements in revit project.
Everything works fine, except for one element ( Thermostat) , where to location outputed is clearing not where it is

i write this example code see display 2 ways of how i get the level and division number (both give the same result):

elems = IN[1]

for e in elems:

if e.GetFamily.Name.lower() == "LE_Generic_Thermostat":

    # first method 
    space = e.get_Space()
    level = s.GetParameterValueByName("Level")
    print(level)
    
    # second method 
    space = UnwrapElement(space)
    print(space.Level.Name, " | ",space.Number)

the output is this:

-1
-1 | 4

And the location should be level : 0 and division: 7

This is a strange error , because the location in all elements is correct except on this one, why?
When i run the multi-category schedule, I get the correct level , which means the problem is in the dynamo python function, right?

Here is a screenshot of the multi-category-schedule:

Does anyone have a clue of why is this happening, or have a solution?
Any feedback would be great

Thanks

See if this helps :

I am also trying to get the space name and number into a family and this node works for me in sample revit project…

but when i tried it in real time “big” project…it’s not returning the proper space name and number…

following your thread maybe this will help me as well…