Skip to content

Commit 7b9728a

Browse files
committedJul 11, 2024
allow "ALL" and "*" for Body.chamfer() and Body.fillet()
1 parent 27771f4 commit 7b9728a

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed
 

‎CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changelog
22

3-
3+
- allow "ALL" and "*" for Body.chamfer() and Body.fillet()
44

55
## [0.5.3] - 2024-07-10
66

‎cadscript/body.py

+21-6
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,18 @@ class Body:
2121
def __init__(self, workplane: cq.Workplane):
2222
self.__wp = workplane
2323

24-
def fillet(self, edgesStr: str, amount: float) -> 'Body':
24+
def _select_edges(self,
25+
query: str
26+
) -> cq.Workplane:
27+
'''
28+
Selects edges in the body
29+
'''
30+
if query == "ALL" or query == "*":
31+
return self.__wp.edges()
32+
else:
33+
return self.__wp.edges(query)
34+
35+
def fillet(self, edgeQuery: str, amount: float) -> 'Body':
2536
"""
2637
Fillets the specified edges of the body.
2738
@@ -32,11 +43,13 @@ def fillet(self, edgesStr: str, amount: float) -> 'Body':
3243
Returns:
3344
Body: The modified body object.
3445
"""
35-
result = self.__wp.edges(edgesStr).fillet(amount)
36-
self.__wp = result
46+
selection = self._select_edges(edgeQuery)
47+
if selection:
48+
result = selection.fillet(amount)
49+
self.__wp = result
3750
return self
3851

39-
def chamfer(self, edgesStr: str, amount: float) -> 'Body':
52+
def chamfer(self, edgeQuery: str, amount: float) -> 'Body':
4053
"""
4154
Chamfers the specified edges of the body.
4255
@@ -47,8 +60,10 @@ def chamfer(self, edgesStr: str, amount: float) -> 'Body':
4760
Returns:
4861
Body: The modified body object.
4962
"""
50-
result = self.__wp.edges(edgesStr).chamfer(amount)
51-
self.__wp = result
63+
selection = self._select_edges(edgeQuery)
64+
if selection:
65+
result = selection.chamfer(amount)
66+
self.__wp = result
5267
return self
5368

5469
def move(self, translationVector: Vector3DType) -> 'Body':

0 commit comments

Comments
 (0)