Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve fillet/chamfer identification algorithm to support selecting edges from face from solid #393

Open
bernhard-42 opened this issue Nov 25, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@bernhard-42
Copy link
Collaborator

One of the selection patterns I use is first to select the right face and the edges.

def hook(d, d2, t):
    c1 = CenterArc((0, 0, 0), d + t / 2, 0, 255)
    c2 = CenterArc((d2 + d + t, 0, 0), d2 + t / 2, 180, 270)
    r = Plane.YZ * Pos(d2 + t / 2, 0, d + d2 + t) * Rectangle(t, 1.2 * t)
    h = sweep(r, path=c1 + c2)
    f = h.faces().filter_by(GeomType.PLANE).sort_by(Axis.X)
    e = f[0].edges().filter_by(Axis.Z) + f[-1].edges().filter_by(Axis.Z)
    h = fillet(e, 1)
    return h

h1 = hook(2.05, 8, 3)

If I try this, I get ValueError: 2D fillet operation takes only Vertices.
Kind of clear, because the topo_parent of the edges are faces.

Changing it to

def hook(d, d2, t):
    c1 = CenterArc((0, 0, 0), d + t / 2, 0, 255)
    c2 = CenterArc((d2 + d + t, 0, 0), d2 + t / 2, 180, 270)
    r = Plane.YZ * Pos(d2 + t / 2, 0, d + d2 + t) * Rectangle(t, 1.2 * t)
    h = sweep(r, path=c1 + c2)
    f = h.faces().filter_by(GeomType.PLANE).sort_by(Axis.X)
    e = f[0].edges().filter_by(Axis.Z) + f[-1].edges().filter_by(Axis.Z)
    e[0].topo_parent = f[0].topo_parent
    e[1].topo_parent = f[0].topo_parent
    e[2].topo_parent = f[-1].topo_parent
    e[3].topo_parent = f[-1].topo_parent
    h = fillet(e, 1)
    return h

makes it work.

Roger's comment on Discord:

"I think this could be improved. As you know, the topo_parent is set to whatever Shape the selector was working with so Face.edges() is going to assigned a Face as the parent (which is correct but a bit incomplete). fillet uses this parent to decide if this is a 1, 2 or 3D fillet operation which in this case isn't really what is desired. A more advanced type of fillet identification algorithm should be used here with takes into consideration the object passed to fillet, the listed topo_parent and even the higher level topological parents of the listed topo_parent. This needs to be carefully done though to avoid any negative impacts (like loosing the ability to fillet a Face that was extracted from a Solid)."

@gumyr gumyr added the enhancement New feature or request label Nov 26, 2023
@gumyr gumyr added this to the Post Release 1.0.0 milestone Nov 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants