Brep / dupfaceborder

Using rhinoscript / python.

Run the code in the attached py file. Select the left rail, the right rail, then the profile curve. You will see the brep that is created along with the two polysurfaces that are duplicated.

Question 1: Why are there 2 polysurfaces? Code says they are not the same but they appear to be the same.

Question 2: Why is there only 1 face in the brep? It appears that there are 4 faces.

Question 3: How do I duplicate the borders of all the faces? How do I exclude the same edges as the profile at the front and the end of the brep? If I use brep.DuplicateEdgeCurves(), it duplicates the edges except for the two the arrows are pointing at in the screenshot. If I can figure this out then how do I exclude the profile curves at the start and end of the brep? In Rhino, if I use DupFaceBorder and select all 4 faces, then all of the border lines are created including the ones the arrows are pointing to.

Sweep2 DupFace Issue.3dm (31.6 KB)
Sweep2 DupFace (1.8 KB)

2022-09-25 22_03_08-Sweep2 DupFace Issue.3dm (31 KB) - Rhinoceros 7 Commercial - Perspective

Hi Mike - you need to split up the faces yourself, I’d do something like this:

   breps = sweep.PerformSweep(oc1, oc2, op)

    print 'Number of breps created: ' + str(breps.Count)
    # Add the new brep
    for brep in breps:
        faces = brep.Faces
    b = breps[0]
    if b.IsValid:
        bnew = sc.doc.Objects.AddBrep(b)
        print("The sweep was not a valid brep. Exiting")

Does that do what you need?


@pascal - Thanks Pascal! I think that will work!