CadQuery / CadQuery/cadquery

Sweep on 3D spline

Open
#1,086 1 comment 0 reactions 0 assignees View on GitHub
question
Dominant language
Python
Stars
5.8k
Forks
541
Avg merge
3d 2h
Merged PRs (30d)
5

Description

Dear Developers,

Thank you for this nice library. I have been trying to sweep a circle along a 3D curve path (curve with lot of bends). I followed the documentation and also previous issues. However when I try to implement them, I dont get the desired results. I am pretty sure, that I am doing something wrong. After having tried out all the suggestions in the previous issues and documentation, I still cant get it right. I would really appreciate your help.

Here is an example that I am trying to do
```
list_of_spline_points = [(26.0, 59.0, 3.0),
(24.0, 57.0, 10.0),
(21.0, 55.0, 20.0),
(19.0, 54.0, 30.0),
(16.0, 52.0, 40.0),
(15.0, 50.0, 51.0),
(14.0, 48.0, 61.0),
(12.0, 46.0, 71.0),
(11.0, 43.0, 81.0),
(11.0, 41.0, 91.0)]
```
The spline looks like this
![image](https://user-images.githubusercontent.com/42536488/169686776-410bc90a-5bd4-45b3-80d2-eac7f1ee955e.png)

```
import cadquery as cq
path = cq.Workplane("XY").spline(list_of_spline_points , includeCurrent=True)
defaultSweep = cq.Workplane("XY", origin=list_of_spline_points [0]).circle(2.0).sweep(path, makeSolid=True, isFrenet=True)
cq.exporters.export(defaultSweep, 'test.stl')
```

What I get in "test.stl"
![image](https://user-images.githubusercontent.com/42536488/169687526-ed037e41-d6d7-4909-8f88-cf9a3c9984c6.png)

I have also tried the below, however I get something similar to above
```
spline_edge = cq.Edge.makeSpline(list_of_spline_points )
spline_cq = cq.Workplane("XY")
spline_cq.objects = [spline_edge]
part = (cq.Workplane("XY").circle(2).sweep(spline_cq,
transition='transformed',
makeSolid=True,
isFrenet=True,
combine=True,
clean=True ))
cq.exporters.export(part, 'part.stl')
```
or
```
path = cq.Workplane("ZX").spline(list_of_spline_points, includeCurrent=True).val()
tangent_plane = cq.Plane(origin=path.positionAt(0), normal=path.tangentAt(0))
sweep = cq.Workplane(tangent_plane).circle(10).sweep(path)
cq.exporters.export(sweep , 'part.stl')
```
Thank you for the help,
Ravi.

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.