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: # 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
```

You are trying to get the fieldnames of a sequence. You want to get the fieldnames of an object. The snippet of code you've posted doesn't explain why you are looping over surf_names or what is in surf_names. You need to loop over each of the objects in the geometry sequence and test each of those for a match.

Apologies, I had only copied part of the code. See if my edit makes sense now