Find Geometry ONLY INSIDE a room


Hi I am still new to Revit and Dynamo. I am working on a task to optimize floor tile fitting in a room. I made a dynamo script to draw lines and create rectangles (squares) to represent the tiles. I can pick a wall and use the finish face of that wall as the start axis to draw the rectangles. In the screenshot I drew a sample room and used the bottom wall as the starting axis.

Since I need to find the number of tiles used, I used Geometry.DoIntersect to find the rectangles intersecting the surface created from the room boundary curve. However, the problem is it counts the rectangles circled in red as well because they intersect the room boundary, but they are actually OUTSIDE the room. What can I do to exclude this kind of rectangles, and only include rectangles INSIDE the room?

Thank you very much for any help.

Shown here are the rectangles found to be intersecting the room boundary. The bottom row and rightmost column are intersecting the boundary but actually outside the room. My problem is I don’t know how to exclude them :frowning:

Instead of asking if the tiles intersect with the room, actually perform the intersection test. This will give you tiles with an area equal to the width x the length of the tile when they fit in the room, while tiles which don’t fit in the room will have an area less than the width x the length of the tile. Comparing the surface area of each tile to find the tiles which are less than that length and width value will give you a list which can be counted to find the number of tiles which don’t fit.


Those tiles are included since technically they do intersect. It looks like the top boundaries lay on the same line as the bottom room boundary. Simplest solution would be to just translate the tiles a nudge south-east. But you could come up with a more robust solution of shrinking the tiles slightly and accounting for grout or finding the intersection area to set a minimum amount of intersection from.

Yes, I came up with something similar by extruding the rectangles and using the curve of the room boundary to create a surface, then find intersections between the solids (rectangles) and surface (room). I got points, lines and surfaces as results so I can filter out anything that isn’t surface. After that I can check the area of the surfaces to know the number of complete tiles and incomplete tiles used.

Now a more advanced problem would be to find the minimum total number of tiles required to fill the room. Because incomplete (cropped) tiles only use a portion of one tile, many of them can actually be reused, i.e. using one tile for multiple corners that require cutting a small part out to fill. This sounds very challenging, but any idea how to achieve something like this? Ideally the script should work for any room with any kind of weird corners or curves.

Thanks for your answer anyway!

That would be a separate question, but I recommend drawing a REALLY LONG LINE on on two perpendicular vectors (the rotation of the vectors becomes another variable), and then offset one line by the tile width and the other line by the length using a negative to positive range, extrude those into a surface and merge into two polysurfaces (one for the U and one for the V), split the base surface of the room using the U polysurface, and split the splits using the V polysurface.

From there you can filter out full tiles and count those base don area, and then use some type of topological bin-packing to try and make full squares form the split tiles. I recommend ensuring you have a given ‘scratch’ area in between the two tile parts (say a fraction of the overall tile’s dimension) to account for the inevitable nasty edge that results when splitting tiles, and helping to ensure you’re always planning on putting the ‘split’ section against the wall (I’ve had to reject cut tile edges not against a wall before - wasn’t fun to do)