CadQuery / CadQuery/cadquery

Center Does Not Work as Expected with 2D Objects

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

Description

Consider the following:

```python
el = cq.Edge.makeEllipse(x_radius = 1.0, y_radius = 10.0)
print(el.Center())
```

You would expect the center to be `(0, 0, 0)` because the ellipse is centered around the origin.

Image

However, the result is:

```python
Vector: (-1.0993893973079381e-16, -0.1653496405078786, 0.0)
```

I created a branch [here](https://github.com/CadQuery/cadquery/tree/center-tol) which added the tolerance parameter in an effort to correct this. It did not work.

Per @adam-urbanczyk it seems like the class `BRepGProp_Cinert` does the actual work, and does not have a tolerance attribute. So we need to figure out the proper way to handle the fact that `Center()` works fine with 3D objects but not with 2D ones.

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.