First time here? Check out the Help page!
1 | initial version |
You can fix this situation using geomeppy
(PyPI, GitHub). The function geomeppy.polygons.break_polygons
splits the larger surface into two surfaces that surround the hole.
To use it you need to convert the surfaces to geomeppy.Polygon3D
objects.
from geomeppy import IDF
from geomeppy.polygons import Polygon3D
from geomeppy.polygons import break_polygons
# set your IDF up as normal, but using the IDF object imported from geomeppy
# get your surfaces
# larger_surface is the one which has a hole
# smaller_surface is the one which is a hole
surface = Polygon3D(larger_surface.coords)
hole = Polygon3D(smaller_surface.coords)
new_surfaces = break_polygons(surface, hole) # produces two sets of coords for the split surface
# get the global geometry rules for your IDF
try:
ggr = idf.idfobjects['GLOBALGEOMETRYRULES'][0]
except IndexError:
ggr = None
# add the new surfaces to your IDF
for i, new_coords in enumerate(new_surfaces, 1):
new = idf.copyidfobject(larger_surface)
new.Name = "%s_%i" % (larger_surface.Name, i)
set_coords(new, new_coords, ggr)
# remove the old surface
idf.removeidfobject(larger_surface)
Alternatively, if you read your IDF into geomeppy
then it will take care of all the surface intersections for you. Just call idf.intersect()
on your geomeppy.IDF
object.
Here's the result of calling idf.intersect()
on a test building similar to the one in your example.