Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question

Revision history [back]

puts plenumSurface.adjacentSurface.get.to_s # DOES NOT WORK!

will return a string of the whole OS:Surface object. To get the name of the adjacent surface:

puts plenumSurface.adjacentSurface.get.name.to_s

As for

puts plenumSurface.adjacentSurface.handle # DOES NOT WORK!

you need to .get the adjacentSurface, otherwise you're asking for the handle of an OS:OptionalSurface, which is an undefined method for that class. Instead:

puts plenumSurface.adjacentSurface.get.handle

will return the adjacent surface's handle.

puts plenumSurface.adjacentSurface.get.to_s # DOES NOT WORK!

WORK!

will return a string of the whole OS:Surface object. To get the name of the adjacent surface:

puts plenumSurface.adjacentSurface.get.name.to_s

As for

puts plenumSurface.adjacentSurface.handle # DOES NOT WORK!

you need to .get the adjacentSurface, otherwise you're asking for the handle of an OS:OptionalSurface, which is an undefined method for that class. Instead:

puts plenumSurface.adjacentSurface.get.handle

will return the adjacent surface's handle.

Note that all of the above will only work if the plenumSurface always has an adjacent surface defined, which might not always be the case. For more about making sure optional types exist before 'getting' them, see the bit about boost::optional in the measure writing guide.

puts plenumSurface.adjacentSurface.get.to_s # DOES NOT WORK!

will return a string of the whole OS:Surface object. To get the name of the adjacent surface:

puts plenumSurface.adjacentSurface.get.name.to_s

As for

puts plenumSurface.adjacentSurface.handle # DOES NOT WORK!

you need to .get the adjacentSurface, otherwise you're asking for the handle of an OS:OptionalSurface, which is an undefined method for that class. Instead:

puts plenumSurface.adjacentSurface.get.handle

will return the adjacent surface's handle.

Note that all of the above will only work if the plenumSurface always has an adjacent surface defined, which might not always be the case. For more about making sure optional types exist before 'getting' them, see the bit about boost::optional in the measure writing guide.