Skip to content

Commit 27771f4

Browse files
committed
doc: selecting vertices/edges #14
1 parent 6417383 commit 27771f4

File tree

4 files changed

+78
-10
lines changed

4 files changed

+78
-10
lines changed

Diff for: cadscript/body.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def fillet(self, edgesStr: str, amount: float) -> 'Body':
2626
Fillets the specified edges of the body.
2727
2828
Args:
29-
edgesStr (str): The edges to fillet.
29+
edgeQuery (str): The edges to fillet. The query syntax is documented at :ref:`query_edges`.
3030
amount (float): The radius of the fillet.
3131
3232
Returns:
@@ -41,7 +41,7 @@ def chamfer(self, edgesStr: str, amount: float) -> 'Body':
4141
Chamfers the specified edges of the body.
4242
4343
Args:
44-
edgesStr (str): The edges to chamfer.
44+
edgeQuery (str): The edges to chamfer. The query syntax is documented at :ref:`query_edges`.
4545
amount (float): The distance of the chamfer.
4646
4747
Returns:

Diff for: cadscript/sketch.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ def fillet(self,
610610
611611
Args:
612612
query (str | Vector2DType | Iterable[Vector2DType]): The vertices to fillet.
613-
The query string is documented at :ref:`query_vertices`.
613+
The query syntax is documented at :ref:`query_vertices`.
614614
You can also pass a point or a list of points to fillet the nearest vertices.
615615
radius (float): The fillet radius.
616616
@@ -631,7 +631,7 @@ def chamfer(self,
631631
632632
Args:
633633
query (str | Vector2DType | Iterable[Vector2DType]): The vertices to chamfer.
634-
The query string is documented at :ref:`query_vertices`.
634+
The query syntax is documented at :ref:`query_vertices`.
635635
You can also pass a point or a list of points to chamfer the nearest vertices.
636636
amount (float): The chamfer amount.
637637

Diff for: docs/source/doc_query_string.rst

+73-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The following methods allow you to select points (aka vertices) in a sketch base
1818
* :py:meth:`Sketch.chamfer`
1919
* :py:meth:`Sketch.fillet`
2020

21-
The following query strings are supported:
21+
The following query bits are supported:
2222

2323
.. list-table::
2424
:header-rows: 1
@@ -42,11 +42,11 @@ The following query strings are supported:
4242
- >>X[1]
4343
- The search string ">>X" sorts all vertices in positive X direction.\
4444
The "[1]" selects the second vertex (or list of vertices with the\
45-
same distance) in that list (first in the list has index 0).
45+
same position) in that list (first in the list has index 0).
4646
* - <<[]
4747
- <<Y[2]
48-
- The search string "<<Y" sorts all vertices in nagative Y direction.\
49-
Returns the third vertex (or list of vertices with the same distance)\
48+
- The search string "<<Y" sorts all vertices in negative Y direction.\
49+
Returns the third vertex (or list of vertices with the same position)\
5050
in that list.
5151
* - or
5252
- >Y or <Y
@@ -56,9 +56,77 @@ The following query strings are supported:
5656
- Vertices farthest in the positive y dir and negative x dir
5757
* - not
5858
- not >Y
59-
- Vertices not farthest in the positive y dir
59+
- All vertices but farthest in the positive y dir
6060

6161

6262

63+
.. _query_edges:
6364

65+
Selecting Edges
66+
---------------
67+
68+
69+
The following methods allow you to select points (aka vertices) in a sketch based on a query string.
70+
71+
.. hlist::
72+
73+
* :py:meth:`Body.chamfer`
74+
* :py:meth:`Body.fillet`
75+
76+
The following query bits are supported:
77+
78+
79+
80+
.. list-table::
81+
:header-rows: 1
82+
83+
* - Query
84+
- Example
85+
- Selects
86+
* - \*
87+
- \*
88+
- Selects all edges
89+
* - ALL
90+
- ALL
91+
- Selects all edges
92+
* - \+
93+
- \+Z
94+
- Edges aligned in the Z direction
95+
* - \|
96+
- \|Z
97+
- Edges parallel to z direction
98+
* - #
99+
- #Z
100+
- Edges perpendicular to z direction
101+
* - >
102+
- >Y
103+
- Edges farthest in positive y direction
104+
* - <
105+
- <Y
106+
- Edges closest in positive y direction
107+
* - >>[]
108+
- >>Y[1]
109+
- The search string ">>Y" sorts all edges in positive Y direction.\
110+
The "[1]" selects the second edge (or list of edges with the\
111+
same position) in that list (first in the list has index 0).
112+
* - <<[]
113+
- <<Y[0]
114+
- The search string "<<Y" sorts all edges in negative Y direction.\
115+
The "[0]" selects the first edge (or list of edges with the\
116+
same position) in that list.
117+
* - >[]
118+
- >Y[1]
119+
- Sorts all **parallel** edges in the positive y direction, gets the second one.
120+
* - <[]
121+
- <Y[2]
122+
- Sorts all **parallel** edges in the negative y direction, gets the third one.
123+
* - or
124+
- >Y or <Y
125+
- Edges farthest in the positive or negative y dir
126+
* - and
127+
- >Y and <X
128+
- Edges farthest in the positive y dir and negative x dir
129+
* - not
130+
- not >Y
131+
- All edges but the farthest in the positive y dir
64132

Diff for: examples/bracket.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
# We add a fillet now. We want only the point where the circle and the rectangle meet
6262
# at a sharp angle.
6363
# The search string ">>X" sorts all points (also called vertices) in positive X direction.
64-
# The "[1]" selects the second point in that list, which is the one we want.
64+
# The "[1]" selects the second point in that list (first in the list has index 0), which is the one we want.
6565
# ">>X[0]" would select the point where the circle and the rectangle meet at the bottom.
6666
# ">>X[2]" returns the corners of the rectangle at the right side. Here two points are selected,
6767
# because they both have the same X coordinate.

0 commit comments

Comments
 (0)