CadQuery / CadQuery/cadquery

Sweep along arc and radial line leads to non-manifold shapes

Open
#674 1 comment 0 reactions 0 assignees View on GitHub
bug OCC kernel issue
Dominant language
Python
Stars
5.8k
Forks
541
Avg merge
3d 2h
Merged PRs (30d)
5

Description

Best demonstrated with a bit of code and a screenshot. Green is good shape, red is bad shape. The only difference is in using `sweep(…, transition = "round")` (which works) and the default `sweep(…, transition = "right")` (which does not work as intended). The bad shape is just one example … when varying measures, the position of the workplane etc. you'll get very different non-manifold shapes, and it is not obvious how the inputs lead to the changes in output. (Maybe an OpenCascade CAD kernel issue?)

```python
from math import sin, cos, radians

hole_radius = 4.5
circum_radius = 10
height = 5
wall_thickness = 2

left_endpoint = [cos(radians(-135)) * circum_radius, sin(radians(-135)) * circum_radius]
right_endpoint = [cos(radians(-45)) * circum_radius, sin(radians(-45)) * circum_radius]
left_arcpoint = [cos(radians(-135)) * hole_radius, sin(radians(-135)) * hole_radius]
mid_arcpoint = [hole_radius, 0]
right_arcpoint = [ cos(radians(-45)) * hole_radius, sin(radians(-45)) * hole_radius]

path = (
cq
.Workplane("XY")
.moveTo(*left_endpoint)
.lineTo(*left_arcpoint)
.threePointArc(mid_arcpoint, right_arcpoint)
.lineTo(*right_endpoint)
.wire()
)

good_sweep = (
cq
.Workplane("XY")
.workplane(offset = 15)
.center(*left_endpoint)
.transformed(rotate = (90, -45, 0))
.rect(wall_thickness, height)
.sweep(path, transition = "round")
)

bad_sweep = (
cq
.Workplane("XY")
.center(*left_endpoint)
.transformed(rotate = (90, -45, 0))
.rect(wall_thickness, height)
.sweep(path, transition = "right") # Only difference to the good part is transition type.
)

show_object(path, name = "path")
show_object(good_sweep, name = "good sweep", options = {"color": "green"})
show_object(bad_sweep, name = "bad sweep", options = {"color": "red"})

```

![SweepBugExample](https://user-images.githubusercontent.com/843907/109814310-a7c55780-7c2e-11eb-9e81-43f0209215da.png)

I'm using CadQuery and CQ-editor installed from their master branches in early January 2021, using Conda.

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.