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.