Working with bodies
How to access the bodies in the real model
The “bodies” of a model are rooms or other features such as an adjacent_building, a topographical shade, a local_shade or a tree. These are accessed using the get_bodies() method of the VEModel class.
import iesve
currentproject = iesve.VEProject.get_current_project()
realmodel = currentproject.models[0]
bodies = realmodel.get_bodies(False) # SelectedOnly = False; used to select all bodies in the model.
How to access the room bodies in the real model
This uses the get_bodies() method of the VEModel class to access the “bodies” in the real model. The returned list of bodies is then filtered using a Python list comprehension statement to return only those bodies which are rooms (i.e. those bodies where the type property is equal to the iesve.VEBody_type.room instance).
import iesve
currentproject = iesve.VEProject.get_current_project()
realmodel = currentproject.models[0]
bodies = realmodel.get_bodies(False) # SelectedOnly = False; used to select all bodies in the model.
roombodies = [x for x in bodies if x.type == iesve.VEBody_type.room] # iesve.VEBody_type.room has an integer value of 1.
currentproject is an instance of the
VEProjectclass.realmodel is an instance of the
VEModelclass.bodies is a list of
VEBodyinstances.roombodies is a list of
VEBodyinstances of typeiesve.VEBody_type.room.