First time here? Check out the Help page!
1 | initial version |
It's not totally clear to me what you're trying to do but to get the maximum z-coordinate of a surface you can use the surface.coords
attribute to do:
surfaces = idf.idfobjects['BUILDINGSURFACE:DETAILED']
for s in surfaces:
max_z = max(pt[2] for pt in s.coords)
print "%s: %.2f" % (s.Name, max_z)
2 | No.2 Revision |
It's not totally clear to me what you're trying to do but to get the maximum z-coordinate of a surface you can use the surface.coords
attribute to do:
surfaces = idf.idfobjects['BUILDINGSURFACE:DETAILED']
for s in surfaces:
max_z = max(pt[2] for pt in s.coords)
print "%s: %.2f" % (s.Name, max_z)
If you can be clearer on what parameters you want to switch for @@labels@@
then there might be a simple way to do it. Are you trying to substitute the value in the maximum z-coordinates of walls and roof/ceiling to change the ceiling height to have something like this?
BuildingSurface:Detailed,
MyRoof, !- Name
Roof, !- Surface Type
Exterior Roof, !- Construction Name
Zone1, !- Zone Name
Outdoors, !- Outside Boundary Condition
, !- Outside Boundary Condition Object
SunExposed, !- Sun Exposure
WindExposed, !- Wind Exposure
, !- View Factor to Ground
4, !- Number of Vertices
2.23, !- Vertex 1 Xcoordinate
2.52, !- Vertex 1 Ycoordinate
@@ceiling_height@@, !- Vertex 1 Zcoordinate
2.23, !- Vertex 2 Xcoordinate
1.02, !- Vertex 2 Ycoordinate
@@ceiling_height@@, !- Vertex 2 Zcoordinate
3.22, !- Vertex 3 Xcoordinate
1.02, !- Vertex 3 Ycoordinate
@@ceiling_height@@, !- Vertex 3 Zcoordinate
3.22, !- Vertex 4 Xcoordinate
2.52, !- Vertex 4 Ycoordinate
@@ceiling_height@@; !- Vertex 4 Zcoordinate
BuildingSurface:Detailed,
MyWall, !- Name
Wall, !- Surface Type
Exterior Wall, !- Construction Name
Zone1, !- Zone Name
Outdoors, !- Outside Boundary Condition
, !- Outside Boundary Condition Object
SunExposed, !- Sun Exposure
WindExposed, !- Wind Exposure
, !- View Factor to Ground
4, !- Number of Vertices
2.23, !- Vertex 1 Xcoordinate
2.52, !- Vertex 1 Ycoordinate
@@ceiling_height@@, !- Vertex 1 Zcoordinate
2.23, !- Vertex 2 Xcoordinate
2.52, !- Vertex 2 Ycoordinate
0.0, !- Vertex 2 Zcoordinate
2.23, !- Vertex 3 Xcoordinate
2.56, !- Vertex 3 Ycoordinate
0.0, !- Vertex 3 Zcoordinate
2.23, !- Vertex 4 Xcoordinate
2.56, !- Vertex 4 Ycoordinate
@@ceiling_height@@; !- Vertex 4 Zcoordinate
3 | No.3 Revision |
It's not totally clear to me what you're trying to do but to get the maximum z-coordinate of a surface you can use the surface.coords
attribute to do:
surfaces = idf.idfobjects['BUILDINGSURFACE:DETAILED']
for s in surfaces:
max_z = max(pt[2] for pt in s.coords)
print "%s: %.2f" % (s.Name, max_z)
If you can be clearer on what parameters you want to switch for to substitute the value in the maximum z-coordinates of walls and roof/ceiling to change the ceiling @@labels@@
then there might be a simple way to do it. Are you trying height to have something like this?height:
surfaces = idf.idfobjects['BUILDINGSURFACE:DETAILED']
walls_and_roofs = [s for s in surfaces if s.Surface_Type in ['Wall', 'Roof']]
for s in surfaces:
max_z = max(pt[2] for pt in s.coords)
for field in s.fieldnames:
if 'ZCOORDINATE' in field.upper() and s[field] == max_z:
s[field] = '@@ceiling_height@@'
print s
Will output:
BuildingSurface:Detailed,
MyRoof, !- Name
Roof, !- Surface Type
Exterior Roof, !- Construction Name
Zone1, !- Zone Name
Outdoors, !- Outside Boundary Condition
, !- Outside Boundary Condition Object
SunExposed, !- Sun Exposure
WindExposed, !- Wind Exposure
, !- View Factor to Ground
4, !- Number of Vertices
2.23, !- Vertex 1 Xcoordinate
2.52, !- Vertex 1 Ycoordinate
@@ceiling_height@@, !- Vertex 1 Zcoordinate
2.23, !- Vertex 2 Xcoordinate
1.02, !- Vertex 2 Ycoordinate
@@ceiling_height@@, !- Vertex 2 Zcoordinate
3.22, !- Vertex 3 Xcoordinate
1.02, !- Vertex 3 Ycoordinate
@@ceiling_height@@, !- Vertex 3 Zcoordinate
3.22, !- Vertex 4 Xcoordinate
2.52, !- Vertex 4 Ycoordinate
@@ceiling_height@@; !- Vertex 4 Zcoordinate
BuildingSurface:Detailed,
MyWall, !- Name
Wall, !- Surface Type
Exterior Wall, !- Construction Name
Zone1, !- Zone Name
Outdoors, !- Outside Boundary Condition
, !- Outside Boundary Condition Object
SunExposed, !- Sun Exposure
WindExposed, !- Wind Exposure
, !- View Factor to Ground
4, !- Number of Vertices
2.23, !- Vertex 1 Xcoordinate
2.52, !- Vertex 1 Ycoordinate
@@ceiling_height@@, !- Vertex 1 Zcoordinate
2.23, !- Vertex 2 Xcoordinate
2.52, !- Vertex 2 Ycoordinate
0.0, !- Vertex 2 Zcoordinate
2.23, !- Vertex 3 Xcoordinate
2.56, !- Vertex 3 Ycoordinate
0.0, !- Vertex 3 Zcoordinate
2.23, !- Vertex 4 Xcoordinate
2.56, !- Vertex 4 Ycoordinate
@@ceiling_height@@; !- Vertex 4 Zcoordinate
4 | No.4 Revision |
It's not totally clear to me what you're trying to do but to get the maximum z-coordinate of a surface you can use the surface.coords
attribute to do:
surfaces = idf.idfobjects['BUILDINGSURFACE:DETAILED']
for s in surfaces:
max_z = max(pt[2] for pt in s.coords)
print "%s: %.2f" % (s.Name, max_z)
If you want to to substitute the value in the maximum z-coordinates of walls and roof/ceiling to change the ceiling height:
surfaces = idf.idfobjects['BUILDINGSURFACE:DETAILED']
walls_and_roofs = [s for s in surfaces if s.Surface_Type in ['Wall', 'Roof']]
for s in surfaces:
max_z = max(pt[2] for pt in s.coords)
for field in s.fieldnames:
s.fieldnames: # or "for field in s.objls:" if using version <= 0.5.2
if 'ZCOORDINATE' in field.upper() and s[field] == max_z:
s[field] = '@@ceiling_height@@'
print s
Will output:
BuildingSurface:Detailed,
MyRoof, !- Name
Roof, !- Surface Type
Exterior Roof, !- Construction Name
Zone1, !- Zone Name
Outdoors, !- Outside Boundary Condition
, !- Outside Boundary Condition Object
SunExposed, !- Sun Exposure
WindExposed, !- Wind Exposure
, !- View Factor to Ground
4, !- Number of Vertices
2.23, !- Vertex 1 Xcoordinate
2.52, !- Vertex 1 Ycoordinate
@@ceiling_height@@, !- Vertex 1 Zcoordinate
2.23, !- Vertex 2 Xcoordinate
1.02, !- Vertex 2 Ycoordinate
@@ceiling_height@@, !- Vertex 2 Zcoordinate
3.22, !- Vertex 3 Xcoordinate
1.02, !- Vertex 3 Ycoordinate
@@ceiling_height@@, !- Vertex 3 Zcoordinate
3.22, !- Vertex 4 Xcoordinate
2.52, !- Vertex 4 Ycoordinate
@@ceiling_height@@; !- Vertex 4 Zcoordinate
BuildingSurface:Detailed,
MyWall, !- Name
Wall, !- Surface Type
Exterior Wall, !- Construction Name
Zone1, !- Zone Name
Outdoors, !- Outside Boundary Condition
, !- Outside Boundary Condition Object
SunExposed, !- Sun Exposure
WindExposed, !- Wind Exposure
, !- View Factor to Ground
4, !- Number of Vertices
2.23, !- Vertex 1 Xcoordinate
2.52, !- Vertex 1 Ycoordinate
@@ceiling_height@@, !- Vertex 1 Zcoordinate
2.23, !- Vertex 2 Xcoordinate
2.52, !- Vertex 2 Ycoordinate
0.0, !- Vertex 2 Zcoordinate
2.23, !- Vertex 3 Xcoordinate
2.56, !- Vertex 3 Ycoordinate
0.0, !- Vertex 3 Zcoordinate
2.23, !- Vertex 4 Xcoordinate
2.56, !- Vertex 4 Ycoordinate
@@ceiling_height@@; !- Vertex 4 Zcoordinate