First time here? Check out the Help page!
1 | initial version |
As @__AmirRoth__ says, you need something outside of EnergyPlus to do this. That could be Eppy, as in the script below.
from eppy.iddcurrent import iddcurrent
from eppy.modeleditor import IDF
from future.moves.itertools import zip_longest
from six import StringIO
iddsnippet = iddcurrent.iddtxt
iddfhandle = StringIO(iddcurrent.iddtxt)
IDF.setiddname(iddfhandle)
def adjust_coords(surface, latitude):
coords = surface.coords
# do what you want with the coords here
# make the coords into a flattened list
coords = [i for point in coords for i in point]
# find the vertex fields
n_vertices_index = surface.objls.index('Number_of_Vertices')
last_item = len(surface.obj)
first_item = n_vertices_index + 1 # X of first coordinate
vertex_fields = surface.objls[first_item:last_item]
# set the vertex field values
for field, x in zip_longest(vertex_fields, coords, fillvalue=""):
surface[field] = x
idf = IDF()
idf.initreadtxt('my_base.idf')
shading_surfaces = idf.idfobjects['SHADING:BUILDING:DETAILED']
latitude = idf.getobject('SITE:LOCATION', 'Tampa International Ap').Latitude
for surface in shading_surfaces:
adjust_coords(surface, latitude)
idf.save('my_new.idf')