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

Shading Surface ends up in wrong location

asked 2023-04-08 04:11:10 -0600

wassimj's avatar

updated 2023-04-10 10:27:07 -0600

Hello, I have written my own python-based software to load and visualise the geometry inside an .OSM file. I am using openstudio.model.exampleModel() for testing.

I am able to locate the spaces and the apertures correctly, but for some reason, one shading surface ends up in the wrong location (inside the building rather than on the aperture. While spaces have a transformation matrix and I apply that correctly, shading surfaces do not seem to have a transformation matrix so I directly take their vertices. The exported gbxml file is correct, but my geometry translation is not (and on only one surface which is weird since I loop through all of them and apply the same computation). image description image description

I also did a test where I found the shading surface definition in the exported OSM file (which displays correctly in the OpenStudio application) and located one vertex which was at 10, 8.1, 2.1 so I placed a box there manually and indeed it is exactly at one corner of that shading surface (which is at the wrong location). So, I must be missing some transformation that needs to be applied to that shading surface?

image description image description

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2023-04-08 04:53:14 -0600

wassimj's avatar

Solved it! So in analysing this, I realised that if a surface group has a parent space, it should be transformed by the transformation matrix of the parent space. Thus, I modified my code as such and it worked perfectly.

for aShadingSurface in shadingSurfaces:
            shadingFace = surfaceToFace(aShadingSurface)
            if aShadingSurface.shadingSurfaceGroup().is_initialized():
                shadingGroup = aShadingSurface.shadingSurfaceGroup().get()
                if shadingGroup.space().is_initialized():
                    space = shadingGroup.space().get()
                    osTransformation = space.transformation()
                    osTranslation = osTransformation.translation()
                    osMatrix = osTransformation.rotationMatrix()
                    rotation11 = osMatrix[0, 0]
                    rotation12 = osMatrix[0, 1]
                    rotation13 = osMatrix[0, 2]
                    rotation21 = osMatrix[1, 0]
                    rotation22 = osMatrix[1, 1]
                    rotation23 = osMatrix[1, 2]
                    rotation31 = osMatrix[2, 0]
                    rotation32 = osMatrix[2, 1]
                    rotation33 = osMatrix[2, 2]
                    shadingFace = topologic.TopologyUtility.Transform(shadingFace, osTranslation.x(), osTranslation.y(), osTranslation.z(), rotation11, rotation12, rotation13, rotation21, rotation22, rotation23, rotation31, rotation32, rotation33)
            shadingFaces.append(shadingFace)

image description

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Training Workshops

Careers

Question Tools

1 follower

Stats

Asked: 2023-04-08 04:11:10 -0600

Seen: 93 times

Last updated: Apr 08 '23