I just replace item.Room by item.Space for my need.
I’m sharing my code for those who can help :
phase = doc.Phases
MEs = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_MechanicalEquipment).WhereElementIsNotElementType().ToElements()
elements_spaces = [element_room(x,phase) for x in MEs]
Hi @Yoann.Obry and @Jean-Marc!
I develop a script for this topic but with a different approach. My goal was to get the room name and number for my MEP element without the need to create MEP space. Use spaces only to get the room information isn’t the best use for the spaces. So, I use 3 method in the script to obtain the better result.
Once the script get where is the MEP element are located, I get the room name and number and i copy this information to my shared parameter. Finally, I get the same information if I compare with the spaces method, but more flexibilities because the data are store in shared parameter.