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

Revision history [back]

click to hide/show revision 1
initial version

OpenStudio 3.4.0 Python subsurface intersect/match

I am working on a geometry modeler for OpenStudio. I am doing this in FreeCAD 0.20.1 because of its parametric nature, its Python backbone and its open availability (as opposed to SketchUp these days), and I am pairing it with the Python version of the OpenStudio 3.4.0 library (Thank You for porting it to Python!).

At this point, I can generate buildings with or without EXTERIOR windows/doors, and they show up and seem to run OK in OpenStudioApp 1.4.0 (with OpenStudio 3.4.0). I can also change the "3.4.0" to "2.9.1" in the .osm file, then add an extra line to all SubSurface entries (seems like Shading Control was dropped for later versions of OS?), and then open it in the old OpenStudio 2.9.1 SketchUp plugin, and it seems to then show up OK there as well.

To achieve surface intersecting and matching, I am using the following functions from the Python version of the OpenStudio 3.4.0 library:

import openstudio

...

openstudio.model.intersectSurfaces(spaces)
openstudio.model.matchSurfaces(spaces)

where spaces is an OpenStudio space vector like so:

spaces = openstudio.model.SpaceVector()

Like I said, so far, so good. However, this fails when I add INTERIOR windows or doors. Then the intersecting and matching no longer work. But, I can still modify the .osm file as indicated and open it up in the OpenStudio 2.9.1 SketchUp plugin. There I can then first do an intersect and then a match, and then it magically seems to work!

So, I was just wondering if this might ring a bell with anyone, maybe along the lines of intersect/match working OK in 2.9.1 Ruby but not OK in 3.4.0 Python or some such? Are there alternative OpenStudio Python functions?

As a bonus question, I was hoping to change the version from 3.4.0 to 2.9.1 via an OpenStudio Python function, so I don't have to edit the .osm file I create from FreeCAD manually and after the fact? I can't seem to find anything about that.

OpenStudio 3.4.0 Python subsurface intersect/match

I am working on a geometry modeler for OpenStudio. I am doing this in FreeCAD 0.20.1 because of its parametric nature, its Python backbone and its open availability (as opposed to SketchUp these days), and I am pairing it with the Python version of the OpenStudio 3.4.0 library (Thank You for porting it to Python!).

At this point, I can generate buildings with or without EXTERIOR windows/doors, and they show up and seem to run OK in OpenStudioApp 1.4.0 (with OpenStudio 3.4.0). I can also change the "3.4.0" to "2.9.1" in the .osm file, then add an extra line to all SubSurface entries (seems like Shading Control was dropped for later versions of OS?), and then open it in the old OpenStudio 2.9.1 SketchUp plugin, and it seems to then show up OK there as well.

To achieve surface intersecting and matching, I am using the following functions from the Python version of the OpenStudio 3.4.0 library:

import openstudio

...

openstudio.model.intersectSurfaces(spaces)
openstudio.model.matchSurfaces(spaces)

where spaces is an OpenStudio space vector like so:

spaces = openstudio.model.SpaceVector()

Like I said, so far, so good. However, this fails when I add INTERIOR windows or doors. Then the intersecting and matching no longer work. But, I can still modify the .osm file as indicated and open it up in the OpenStudio 2.9.1 SketchUp plugin. There I can then first do an intersect and then a match, and then it magically seems to work!

So, I was just wondering if this might ring a bell with anyone, maybe along the lines of intersect/match working OK in 2.9.1 Ruby but not OK in 3.4.0 Python or some such? Are there alternative OpenStudio Python functions?

As a bonus question, I was hoping to change the version from 3.4.0 to 2.9.1 via an OpenStudio Python function, so I don't have to edit the .osm file I create from FreeCAD manually and after the fact? I can't seem to find anything about that.

OpenStudio 3.4.0 Python subsurface intersect/match

I am working on a geometry modeler for OpenStudio. I am doing this in FreeCAD 0.20.1 because of its parametric nature, its Python backbone and its open availability (as opposed to SketchUp these days), and I am pairing it with the Python version of the OpenStudio 3.4.0 library (Thank You for porting it to Python!).

At this point, I can generate buildings with or without EXTERIOR windows/doors, and they show up and seem to run OK in OpenStudioApp 1.4.0 (with OpenStudio 3.4.0). I can also change the "3.4.0" to "2.9.1" in the .osm file, then add an extra line to all SubSurface entries (seems like Shading Control was dropped for later versions of OS?), and then open it in the old OpenStudio 2.9.1 SketchUp plugin, and it seems to then show up OK there as well.

To achieve surface intersecting and matching, I am using the following functions from the Python version of the OpenStudio 3.4.0 library:

import openstudio

...

openstudio.model.intersectSurfaces(spaces)
openstudio.model.matchSurfaces(spaces)

where spaces is an OpenStudio space vector like so:

spaces = openstudio.model.SpaceVector()

Like I said, so far, so good. However, this fails when I add INTERIOR windows or doors. Then the intersecting and matching no longer work. But, I can still modify the .osm file as indicated and open it up in the OpenStudio 2.9.1 SketchUp plugin. There I can then first do an intersect and then a match, and then it magically seems to work!

So, I was just wondering if this might ring a bell with anyone, maybe along the lines of intersect/match working OK in 2.9.1 Ruby but not OK in 3.4.0 Python or some such? Are there alternative OpenStudio Python functions?

As a bonus question, I was hoping to change the version from 3.4.0 to 2.9.1 via an OpenStudio Python function, so I don't have to edit the .osm file I create from FreeCAD manually and after the fact? I can't seem to find anything about that.

EDIT after logging <<<

I placed the following near the beginning of "it all":

logger = openstudio.FileLogSink("E:/OpenStudio/Measures/Python/test.log")
logger.setLogLevel(openstudio.Debug)

That seems to result in information being recorded to test.log. The outputs are as follows - it is long, so excerpts here only.

Each of the three versions has a bunch of the following:

[openstudio.model.PlanarSurface] <-2> Before setVertices have 11 fields.
[openstudio.model.PlanarSurface] <-2> After clearExtensibleGroups in setVertices have 11 fields.
[openstudio.model.PlanarSurface] <-2> After setVertices have 23 fields.  Size of vertices is 4.

Version 1 (no windows)

... interspersed with a bunch of the above are these three parts:

[openstudio.model.Surface] <-1> Intersection of 'Surface 3' with 'Surface 7' results in (Surface 3), (Surface 7),,[Surface 19], []

[openstudio.model.Surface] <-1> Intersection of 'Surface 19' with 'Surface 13' results in (Surface 19), (Surface 13), [Surface 20, Surface 21], [Surface 22]
[openstudio.model.Surface] <-1> Intersection of 'Surface 7' with 'Surface 3' results in (Surface 7), (Surface 3), [], []

[openstudio.model.Surface] <-1> Intersection of 'Surface 8' with 'Surface 16' results in (Surface 8), (Surface 16), [Surface 23], [Surface 24]
[openstudio.model.Surface] <-1> Intersection of 'Surface 13' with 'Surface 19' results in (Surface 13), (Surface 19), [], []
[openstudio.model.Surface] <-1> Intersection of 'Surface 16' with 'Surface 8' results in (Surface 16), (Surface 8), [], []

Version 2 (one exterior window only)

... interspersed with a bunch of the above are these three parts:

[openstudio.model.Surface] <-1> Intersection of 'Surface 3' with 'Surface 7' results in (Surface 3), (Surface 7), [Surface 19], []

[openstudio.model.Surface] <-1> Intersection of 'Surface 19' with 'Surface 13' results in (Surface 19), (Surface 13), [Surface 20, Surface 21], [Surface 22]
[openstudio.model.Surface] <-1> Intersection of 'Surface 7' with 'Surface 3' results in (Surface 7), (Surface 3), [], []

[openstudio.model.Surface] <-1> Intersection of 'Surface 8' with 'Surface 16' results in (Surface 8), (Surface 16), [Surface 23], [Surface 24]
[openstudio.model.Surface] <-1> Intersection of 'Surface 13' with 'Surface 19' results in (Surface 13), (Surface 19), [], []
[openstudio.model.Surface] <-1> Intersection of 'Surface 16' with 'Surface 8' results in (Surface 16), (Surface 8), [], []

Version 3 (one interior window only)

... interspersed with a bunch of the above is only this one part:

[openstudio.model.Surface] <-1> Intersection of 'Surface 8' with 'Surface 16' results in (Surface 8), (Surface 16),,[Surface 19], [Surface 20]
[openstudio.model.Surface] <-1> Intersection of 'Surface 16' with 'Surface 8' results in (Surface 16), (Surface 8), [], []

Not sure if any of this is helpful, but that's as far as I have gotten.