I have extrapolated the room areas, however, someone on the team created gaps that wouldn’t work in an energy model where I need all the walls to be attached side to side (basically a wall is a paper) so now I got the lines between the walls around the centerlines and I want to create new regions (rooms) I have a problem the code just gives me nulls. here is the code:
import Rhino.Geometry as rg
def find_enclosed_regions(curves, tol):
# Create a list to store the enclosed regions
enclosed_regions = []
# Loop through each curve in the list
for i, crv1 in enumerate(curves):
# Create an empty list to store the curves that are enclosed by the current curve
enclosed_curves = []
# Check if the curve is closed
if not crv1.IsClosed:
continue
# Loop through the remaining curves in the list
for j, crv2 in enumerate(curves[i+1:], i+1):
# Check if the curve is closed
if not crv2.IsClosed:
continue
# Check if the first curve contains the second curve
if crv1.Contains(crv2, rg.Plane.WorldXY, tol, True):
enclosed_curves.append(crv2)
# Check if the second curve contains the first curve
elif crv2.Contains(crv1, rg.Plane.WorldXY, tol, True):
enclosed_curves.append(crv1)
# If there are any enclosed curves, add them to the list of enclosed regions
if enclosed_curves:
enclosed_curves.append(crv1)
enclosed_regions.append(enclosed_curves)
return enclosed_regions