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 ...
"Then the intersecting and matching no longer work". What doesn't work? Does it crash? Can you provide a dumb .OSM and some sample python code so we can reproduce?
Instead of using
FileLogSink
, if you can see the console output, do this:openstudio.Logger.instance().standardOutLogger().setLogLevel(openstudio.Debug)
LogLevels:
Trace
,Debug
,Info
,Warn
(default),Error
,Fatal
I strongly caution against assuming that a model created in a given OS version will work in an earlier one, so use this footgun at your own risk:
model.versionObject().get().setString(1, "2.9.0")
Thank you Julian Marrec. Last thing first, I agree 100% with your caution, and I am only using the 2.9.1 hack so I can keep using SketchUp 2017 for geometry debugging purposes. Should I ever get to the point where this works, this should no longer be needed.
Now, as to "no longer work". I have a simple model with three connected spaces of different heights. In the 1st version, there are no window, in the 2nd version there is one exterior window only in one of the spaces and in the 3rd version there is one interior window only between that space and the adjacent space. ... more next comment.
all three versions are treated identically in my FreeCAD to OpenStudio conversion, and all run to "completion" without error. However, only the 1st and 2nd show the proper intersecting and matching. The 3rd shows intersecting and matching on walls where there is not the interior window, but NONE of either on the wall with the interior window. Wish I could share the .OSM files, but don't know how. Have not had time yet to implement macumber's logging to get more info.
Just to close the loop, I did this with Trace, Info, Debug, Warn, Error and Fatal now - some result in no messages at all, for others, all that is added to what I already mentioned above is a bunch of the following:
Not sure where this leaves things now. My hope was that there might have been a difference between 3.4.0 computeIntersection and 2.9.X-LTS computeIntersection, but that does not seem to be the case now. Both seem to disallow subsurface intersections? How does SketchUp 2.9.1 do it?