-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
surface.area is zero when the first 3 vertices of the surface are in one line #384
Comments
You may have identified the problem correctly. Let me see if the code can be updated to fix that issue. |
Problem: surface.area (for Building:Surface:Detailed) does not work when first 3 points are linear Solution: Try the other points. Area will be calculated if any points are non-linear
I have fixed this in branch Once I cleanup the code, I'll merge it into Basically I try all the points in the polygon until it hits a non-linear sequence of points. Then it can finish the area calculation. If all points are linear, an area of zero is returned |
I have made a new release in pypi and in github. |
I updated my eppy version but the bug still seems to be there, the area of surfaces like these still calculates as zero. I saw in the tests that a case like this was added, so in theory it should be fine right? But even when I use the coordinates of the test case in my code, it also gives me zero. So I'm not sure what's going on. |
that's unexpected. I'll check. |
@VanroyKato , It seems to work on my end. See below. idf file
code:
|
I am mystified. |
It's 3.8.13 |
OK .. let me try a couple of things |
Since I can't recreate the error, you will have to help me here. The code should get to line The function It is either not hitting this function OR something is going wrong in the function. Download the eppy code and put some print statements in If you are familiar with the python debugger |
Alright, I'll see if I can find out more! |
OK ... I think I see where the problem is coming from. eppy can run with and without numpy installed. Let me check this out. |
Yes !!! |
I'll work on fixing this. |
fixed this in issue #386 Problem: surface.area (for Building:Surface:Detailed) does not work when first 3 points are linear and numpy is installed. |
@VanroyKato , |
released a new version on pypi |
I created a geometry in OpenStudio exported the .idf and wanted to edit some things in python using eppy.
When creating a geometry in OS apparently the floor vertices aren't simplified and if there are multiple zones adjacent to a wall, it will keep all the coordinates, creating situations where there's 3 or more vertices in one line.
This causes a problem when wanting to calculate the surface area. I assume the problem is in the unit_normal function since it takes just the 3 first vertices of the surface, returning 0 when these are in one line.
Example of a surface that caused this problem:
BuildingSurface:Detailed,
Face 161, !- Name
Floor, !- Surface Type
Offices_ZN_1_FLR_1_Floor_Ffactor, !- Construction Name
Offices_ZN_1_FLR_1, !- Zone Name
GroundFCfactorMethod, !- Outside Boundary Condition
, !- Outside Boundary Condition Object
NoSun, !- Sun Exposure
NoWind, !- Wind Exposure
AutoCalculate, !- View Factor to Ground
5, !- Number of Vertices
19, !- Vertex 1 Xcoordinate
0, !- Vertex 1 Ycoordinate
0, !- Vertex 1 Zcoordinate
19, !- Vertex 2 Xcoordinate
9, !- Vertex 2 Ycoordinate
0, !- Vertex 2 Zcoordinate
19, !- Vertex 3 Xcoordinate
16.95, !- Vertex 3 Ycoordinate
0, !- Vertex 3 Zcoordinate
45.02, !- Vertex 4 Xcoordinate
16.95, !- Vertex 4 Ycoordinate
0, !- Vertex 4 Zcoordinate
45.02, !- Vertex 5 Xcoordinate
0, !- Vertex 5 Ycoordinate
0; !- Vertex 5 Zcoordinate
The text was updated successfully, but these errors were encountered: