CadQuery / cadquery

A python parametric CAD scripting framework based on OCCT
https://cadquery.readthedocs.io
Other
3.16k stars 289 forks source link

cadquery.selectors.AreaNthSelector documentation examples not functioning #1347

Open nesdnuma opened 1 year ago

nesdnuma commented 1 year ago

Hello,

I've tried both examples of cadquery.selectors.AreaNthSelector documentation with CQ-Editor build 219.

I got an error message: " 'AreaNthSelector' is not defined. "

Of course I've added import cadquery as cq before each example before testing.

1

result = ( cq.Workplane("XY") .circle(5) .extrude(2) .circle(2) .extrude(10) .faces(">Z[-2]") .wires(AreaNthSelector(0)) .fillet(2) )

2

result = ( cq.Workplane("XY") .rect(20, 20) .extrude(10) .edges("|Z or <Z") .fillet(2) .faces(">Z") .shell(2) .faces(">Z") .wires(AreaNthSelector(-1)) .toPending() .workplane() .offset2D(-1) .extrude(1) .faces(">Z[-2]") .wires(AreaNthSelector(0)) .toPending() .workplane() .cutBlind(2) )

jmwright commented 1 year ago

Either...

import cadquery as cq

result = ( cq.Workplane("XY") .circle(5) .extrude(2) .circle(2) .extrude(10) .faces(">Z[-2]") .wires(cq.selectors.AreaNthSelector(0)) .fillet(2) )

...or...

import cadquery as cq
from cadquery.selectors import AreaNthSelector

result = ( cq.Workplane("XY") .circle(5) .extrude(2) .circle(2) .extrude(10) .faces(">Z[-2]") .wires(AreaNthSelector(0)) .fillet(2) )

...work for me.

nesdnuma commented 1 year ago

Thank you.

May I suggest to add this line in the examples? from cadquery.selectors import AreaNthSelector

jmwright commented 1 year ago

Sure. Would you be willing to open a PR?