Nominating a 'face' and then extracting it later

Hi all,

I’d like to create a primitive (box 90% of the time) and somehow identify one of the faces as the important one. This will be the ‘machining face’ to cut on a CNC router. (Think melamine in a kitchen cabinet)

The shape may get modified, resized, have cutouts through it, etc. Ultimately I want to do something like a ‘DupFaceBorder’ of that face only, including the border, and ideally pick up other geometry that is grouped on that face, keeping their layers when the new 2D geometry is created.

Of course in a real job there will be 50-100 panels, thus the need to script it.

Thanks in advance!


Fast answer after some trivial checks…

What about the other 10%?

And similarly:

What is “etc”?

I gave some fast check by using grasshopper, if you set a specific surface as the first, it keeps being the first after fillet/chamfer (on vertical edges), boolean difference, moving face, and obviously global transformations like scale/mirror.
But it will give unpredictable results if you use commands like boolean intersections or if you fillet/chamfer an edge that lies on your important face… more tests needed.
(To “set” a specific surface as first you can explode the solid, unselect all, and join the surfaces by clicking your “important” face as the first one.)
Not always reliable.

Also, another idea would be to rebuild only the “important” surface to an uncommon degree (like 6); whatever transformation/edit will occur, at the end the only surface with degree=6 will be the important one.
But moving a face of the solid also resets the degree of the important face to 1 …
Not working.

Make a small marker. A particular small blind hole (that you will move out of the way in case of need with move hole command) that is easy detectable by a script. At the end of the edits, the face “hosting” the marker will be the “important” one.
Edit: and maybe you want to mark the opposite face to avoid hassle into removing the hole from the important… like irl carpenters using pencil on hidden surfaces of the furniture :rofl:
Possible solution.

Very rough ideas ^

Hi @agmckenna,

It’s pretty easy to add a tag to the face you think is important. It’s also pretty easy to find the tag latter when needed.

import Rhino
import scriptcontext as sc

def tag_important_face():
    go = Rhino.Input.Custom.GetObject()
    go.SetCommandPrompt("Select face to attach data")
    go.GeometryFilter = Rhino.DocObjects.ObjectType.Surface
    go.SubObjectSelect = True
    if go.CommandResult() != Rhino.Commands.Result.Success:
    objref = go.Object(0)
    brep = objref.Brep()
    face = objref.Face()
    if not brep or not face:
    surface_index = face.SurfaceIndex 
    new_brep = brep.DuplicateBrep()
    srf = new_brep.Surfaces[face.SurfaceIndex].SetUserString("interesting", str(face.FaceIndex))
    sc.doc.Objects.Replace(objref.ObjectId, new_brep);

def find_important_faces():
    rh_objects = sc.doc.Objects.FindByObjectType(Rhino.DocObjects.ObjectType.Brep)
    if not rh_objects:
    for rh_obj in rh_objects:
        brep = rh_obj.BrepGeometry
        for srf in brep.Surfaces:
            face_index_str = srf.GetUserString("interesting")
            if face_index_str:
                face_index = int(face_index_str)
                print rh_obj.Id.ToString()+ " (" + str(face_index) + ")"


– Dale

1 Like

@maje90 thank you! and apologies for the couple of vague items.

“Box 90% of the time… Shape may be modified…”
I|t will ALWAYS be a panel of consistent thickness, a kitchen door or carcass panel. There are some times it will have a cutout or not be rectangular as per the picture example. A door might have a routered section out of it. (Shaker door)

There may be some fillets on edges, that that might be an issue as you point out, and in fact it highlights another flaw in my plan as per attached. The face size would then not be representative of the panel size. So I think I’m going to need to use the BACK face for cutting, and the geometry on the front for additional drilling / routing.

The smaller marker is interesting, I will look into that idea a bit more.




Thanks @dale, that is great, and looks like a great platform to build what I’m after from.

I’m sure others have scripted to achieve similar things for kitchen cabinets, doors, etc. that can export geometry for toolpathing and cutting on a CNC.

Do you have any search terms or threads you recommend?