Problems selecting extruded edges for fillet

209 views
Skip to first unread message

Craig Trader

unread,
Mar 20, 2021, 2:21:46 PM3/20/21
to CadQuery
I'm using Python 3.8, CadQuery 2.1, and CQ-editor 0.2 on Ubuntu 20.04.

I'm developing models that will be used to produce bucks (molds) for thermoforming. In order to ease mold release, I need to avoid vertical or negative angles. To make a mold, I'll create a buck model, which has a positive draft angle, select the edges that aren't on the top or bottom, and fillet those edges. Then I'll create a well that has a negative draft angle and cut it out of the buck.

The problem I'm having is that for parts with a negative draft angle, I can't get the edge selector to select the critical edges.

Here's some test code to demonstrate the problem:

import logging
import cadquery as cq

LOG = logging.getLogger(__name__)

def extruded_fillet_test( x, y, z, r, d ):
    part = cq.Workplane().rect( x, y )
    part = part.extrude( z, taper=d )
    part = part.edges( 'not(|X or |Y)' )
    LOG.warning( '%d edges selected', len( part.objects ) )
    part = part.fillet( r )
    return part

f1 = extruded_fillet_test( 100, 100, 20, 5, 0 )
f2 = extruded_fillet_test( 100, 100, 20, 5, 15 )
f3 = extruded_fillet_test( 100, 100, 20, 5, -15 )

When I run this code, I see this in the log:

[2021-03-20 17:47:16.967398] WARNING: temp: 4 edges selected
[2021-03-20 17:47:17.001737] WARNING: temp: 4 edges selected
[2021-03-20 17:47:17.042074] WARNING: temp: 12 edges selected

And here's what you'll see in the preview:

F1: No taper, just fillet, as expected
edge-selector-f1.png

F2: Positive taper, fillet good
edge-selector-f2.png

F3: Negative taper, fillet on top as well as sides -- BAD
edge-selector-f3.png

Can anyone suggest an edge selector expression that will select just the 4 edges that need a fillet, for all 3 scenarios I've shown?

Thanks!

- Craig -

Jeremy Wright

unread,
Mar 20, 2021, 9:46:27 PM3/20/21
to CadQuery
A couple of ideas to think about.

1. Use the not logical operator to select all edges that are not parallel to the X, Y and Z axes.
2. The selector syntax supports vectors instead of axis letters. If you know the vectors related to the edges you want to select, you could try that.

#2 Takes this form:

    stand.faces('>Z').edges('|(1,1,0) or |(1,-1,0)')

Craig Trader

unread,
Mar 21, 2021, 9:09:33 AM3/21/21
to CadQuery
Jeremy ...

Thanks for your response. I tried your suggestions, but they don't do the right thing in the first case (zero taper, where all edges are parallel to one of the 3 axes) or the third case (but not for the reason you'd think).

After further investigation, it appears that the extrude operation does completely different things when the taper angle  is negative. When I create a rectangle and do an extrude with a positive angle, what I get is a 6-faced solid that looks like a truncated pyramid (as expected):

cq.Workplane().rect( 100, 100 ).extrude( 20, taper=15 )
positive-taper.png

When I do the same thing, but use a negative angle, the end result looks like an inverted truncated pyramid, except that the new corners are rounded-off instead of sharp

cq.Workplane().rect( 100, 100 ).extrude( 20, taper=-15 )
negative-taper.png

Obviously, trying to fillet that is going to give me bad results.

I'll need to fix the extrude before I can fix the fillet.

- Craig -

Adam Urbanczyk

unread,
Mar 21, 2021, 9:42:10 AM3/21/21
to CadQuery
You could use loft:

res =(
    cq.Workplane()
    .rect(2,1)
    .workplane(offset=1)
    .rect(3,3/2.).loft()
    .edges('(not|X) and (not|Y)')
    .fillet(0.4)
)

Craig Trader

unread,
Mar 21, 2021, 6:01:26 PM3/21/21
to CadQuery
That's an interesting alternative, but the fillet still ends up looking wrong, because it's only rounding the top and not the bottom. 
But you've given me some different avenues to approach. Thanks!

Reply all
Reply to author
Forward
0 new messages