CadQuery / CadQuery/cadquery

Allow creating named workplanes (like 'XY') through the fluent API

Open
#464 7 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

Often it's easiest to create a workplane with one of the named orientations (like 'XY') and an offset in world coords. The `Workplane.workplane` method can't directly do this. I find myself continually abusing the `Workplane.copyWorkplane` method to create workplanes like so:
```python
part = part.copyWorkplane(cq.Workplane("YZ", origin=(dim_x, dim_y, dim_z)))
```
and I see I'm not the only one who's picked up this habit: https://github.com/CadQuery/cadquery/issues/357#issuecomment-670413077

Would you be interested in a PR that refactored the workplane generating code from `Workplane.__init__` into a new method on the Workplane class like:
```python
def namedWorkplane(inplane='XY', origin=(0, 0, 0)):
```
`Workplane.__init__` would keep the same arguments and just pass them on to `self.namedWorkplane` to set up the first plane.

Now my example above would become:
```python
part = part.namedWorkplane('YZ', origin=(dim_x, dim_y, dim_z))
```

Just as a side note, IMHO the `Workplane.workplane` method is focussed around making workplanes relative to a face. I like it how it is and I don't think it should be overloaded/overcomplicated to do this job as well.

I'm happy to do this PR, just thought I should get some opinions before I go refactor the code, write tests and docs.

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.