From dfdc217dd1c6f6188a26848a295fde4191de9f66 Mon Sep 17 00:00:00 2001 From: Pranjal Bhatia <233476158+pranjalbhatia710@users.noreply.github.com> Date: Sun, 31 May 2026 11:50:57 +0400 Subject: [PATCH 1/2] docs: explain selector chaining --- doc/selectors.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/doc/selectors.rst b/doc/selectors.rst index 323826cd0..29b56513e 100644 --- a/doc/selectors.rst +++ b/doc/selectors.rst @@ -52,6 +52,26 @@ Much more complex expressions are possible as well: .chamfer(0.1) ) +Selector methods can also be chained. Each selector operates on the current +selection, so chaining is useful when an expression is easier to read as a +sequence of narrowing steps. For example, ``faces(">Y").edges("%CIRCLE")`` first +selects the positive Y face and then selects only the circular edges belonging to +that face: + +.. cadquery:: + + result = ( + cq.Workplane("XY") + .box(4, 4, 1) + .faces(">Z") + .workplane() + .rarray(2, 2, 2, 2) + .hole(0.5) + .faces(">Z") + .edges("%CIRCLE") + .chamfer(0.08) + ) + .. _filteringfaces: Filtering Faces From 73388125df0bff8fdda71f24de2fc85eb15e2812 Mon Sep 17 00:00:00 2001 From: AU Date: Fri, 5 Jun 2026 17:45:09 +0200 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: AU --- doc/selectors.rst | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/doc/selectors.rst b/doc/selectors.rst index 29b56513e..bef9b9432 100644 --- a/doc/selectors.rst +++ b/doc/selectors.rst @@ -52,26 +52,7 @@ Much more complex expressions are possible as well: .chamfer(0.1) ) -Selector methods can also be chained. Each selector operates on the current -selection, so chaining is useful when an expression is easier to read as a -sequence of narrowing steps. For example, ``faces(">Y").edges("%CIRCLE")`` first -selects the positive Y face and then selects only the circular edges belonging to -that face: - -.. cadquery:: - - result = ( - cq.Workplane("XY") - .box(4, 4, 1) - .faces(">Z") - .workplane() - .rarray(2, 2, 2, 2) - .hole(0.5) - .faces(">Z") - .edges("%CIRCLE") - .chamfer(0.08) - ) - +Note that in the above example selector methods are chained. In this case each selector refines the previous selection, i.e. only edges from the selected face are considered when calling ``faces(...).edges(...)``. Chaining can make complicated selections easier to read or possible at all. .. _filteringfaces: Filtering Faces