CadQuery / CadQuery/cadquery

cutting a groove

Open
#619 18 comments 0 reactions 0 assignees View on GitHub
OCC kernel issue question
Dominant language
Python
Stars
5.8k
Forks
541
Avg merge
3d 2h
Merged PRs (30d)
5

Description

What would be the best way to go about cutting a groove into an arbitrary solid? (to create an annular snap-fit joint)

My first thought was to create a copy of the solid, slice it in half along the desired groove location by intersecting it with a large box which contains one half of the solid and selecting the edge of the bottom face of the intersection. Now I have a wire that perfectly follows the contour of the solid. What I would like to do now is to sweep a sphere along this path and cut away from the original solid with it.

I've looked through all the API documentation and examined all the examples but I can't find anything that is similar to what I'm trying to do. Creating a sphere and then calling `sweep` simply gives `list index out of range`. I know this probably means it's looking for 2d shapes on the stack and not finding any, but this error message is not particularly useful as it's too generic.

I tried to sweep a circle rather than a sphere the result takes a very long time to compute and is not correct. I think that right now that the swept shape doesn't stay tangent/parallel to the curve being swept through and I can't find any way to achieve this.
I think it's possible to create a donut shape in cadquery by revolving a circle but I'm not looking for a circular donut shape.

![image](https://user-images.githubusercontent.com/4923501/107067563-5a90ca00-67d7-11eb-8634-847427f84a94.png)
```python
import cadquery as cq
print(cq.__version__) # 2.1
path = cq.Workplane('XY').ellipse(5, 7)
tube = cq.Workplane('YZ').circle(0.5).sweep(path)
show_object(path, options={'alpha': 0.5})
show_object(tube, options={'alpha': 0.5})
```

for now I think another approach could be to intersect a thin box and the solid then create a shell of the intersection and cut that away from the original solid but I don't like this approach as much.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.