Rhinocommon failing to extract correct faces from an boolean intersection

Recently I was working on some code to automate a process in Rhino and stumbled upon a rather curious issue I was unable to solve

I am writing a program which:

  • takes two boxes
  • makes a boolean intersection of them
  • extracts the faces of the said intersection

while the intersection part is performing fine, for some reason the faces_list = list(intersection.Faces) part returns faces of the two original boxes instead of the intersection

please find below the code and the test rhino file and thank you in advance for your help

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino
import Rhino.Geometry as rg

def main():

    plate_a_guid = rs.GetObject("Pick the first plate", rs.filter.polysurface)
    plate_b_guid = rs.GetObject("Pick the second plate", rs.filter.polysurface)

    plate_a = rs.coercebrep(plate_a_guid)
    plate_b = rs.coercebrep(plate_b_guid)

    intersection = rg.Brep.CreateBooleanIntersection(plate_a, plate_b, sc.doc.ModelAbsoluteTolerance)[0]

    sc.doc.Objects.AddBrep(intersection)

    faces_list = list(intersection.Faces)

    for face in faces_list:
        sc.doc.Objects.AddSurface(face)

if __name__ == "__main__":
    main()

ForForum.3dm (57.1 KB)

ForForum.py (682 Bytes)