CadQuery / CadQuery/cadquery

PerpendicularDirSelector doesn't work with curved surfaces

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

Description

I had some issues with PerpendicularDirSelector and from a bit of digging found it is currently limited to faces of type `PLANE` only. I was trying to select gear teeth surfaces which are perpendicular Z but are splines and so are not selected.

It's limited in BaseDirSelector `if isinstance(o, Face) and o.geomType() == "PLANE":` with the comment:

> a face is only parallel to a direction if it is a plane, and its normal is parallel to the dir

which isn't really relevant to checking perpendicularity.

I think this is left over from the original implementation that assumed perpendicular = not parallel (so all direction selectors worked from this base parallel check), but this was fixed in #882. It works as expected if I remove ` and o.geomType() == "PLANE"`:
![image](https://user-images.githubusercontent.com/63357663/156242176-524755c2-5290-44c1-a96b-c473e073b7ed.png)

I assume all faces have a normal defined so can't see an issue with this, but I don't know if there are other reasons to keep this check? Happy to open a PR if this can be done!

Minimum example to test:
```
p = (cq.Workplane('XY')
.circle(10)
.extrude(20)
.faces('#Z')
)
print(p.vals()) # -> []
# Should include the cylindrical surface
```

(gears created with [cq_gears](https://github.com/meadiode/cq_gears) plugin)

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.