CadQuery / CadQuery/cadquery

Workplane.mirrorY duplicates pending wires

Open
#777 2 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

Say you want to loft between two loops that are symetrical around the Y axis.

```python
import cadquery as cq

step0 = (
cq.Workplane()
.spline([(0, 0), (2, 2), (0, 3)])
.mirrorY()
)

step1 = (
step0
.transformed(offset=(0, 0, 1))
.spline([(0, 1.5), (1, 2), (0, 3)])
.mirrorY()
)

part = step1.loft()
```

`step0` looks correct:
![screenshot2021-05-26-141536](https://user-images.githubusercontent.com/50230945/119603707-db2e1180-be2c-11eb-9949-80265a70bdec.png)

`step1` however has 3 loops in it, when I expect 2:
![screenshot2021-05-26-141609](https://user-images.githubusercontent.com/50230945/119603766-fef15780-be2c-11eb-97e3-f9414da8a218.png)

`mirrorY` acts on all pending wires. As a side note: `mirrorY` with out of plane wires reflects the wire about the current workplane. Hence my large loop is mirrored from below the plane to above it.

And my loft winds up looking like this:
![screenshot2021-05-26-141732](https://user-images.githubusercontent.com/50230945/119603855-2b0cd880-be2d-11eb-8392-2ba64af278e6.png)

I'm not really sure how to proceed here. Maybe I just need to accept that `mirrorY` will behave like this.

My intuition is that `mirrorY` should act only on edges and wires in the current plane, but we have no way to designate that wires "belong" in a certain plane.

Here is a bit of a radical idea: `CQContext.pendingWires`/`pendingEdges` could be changed to a dict with a key representing the current workplane (perhaps `id(self.Plane)`) and a list of pending Wires or Edges as the value? Then `mirrorX`/`Y`, `offset2D` etc. could just act on the wires created in the current workplane, and `loft` etc. could act on all values?

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.