mirrorY/mirrorX deliver unexpected edges back
- Dominant language
- Python
- Stars
- 5.8k
- Forks
- 541
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 5
Description
I am trying to visualize interims steps when working with cadquery. Doing so, I ran into some issues with `mirrorY`et. al. (btw. it does not seem to be a problem when using `extrude()`, only when you try to visualize the wires):
### 1) Method close() works fine
```python
import cadquery as cq
from jupyter_cadquery.cadquery import Assembly, Part, Edges, Faces, Wires, show
yz = cq.Workplane("YZ")
xy = cq.Workplane("YX")
diam = 5.2
base_thickness = 2
base_width = 38
base_length = 64
gap = 6
holder_thickness = 1
holder_length = 22
holder_width = diam + 2 * holder_thickness
holder_height = diam + holder_thickness
side_margin = base_width/2 - holder_width
bottom_margin = 15
base = (xy
.vLineTo(-base_length/2 + gap/2, forConstruction=True)
.hLineTo(-gap/2)
.vLineTo(-base_length/2)
.hLineTo(-base_width/2)
.vLineTo(-base_length/2 + 10)
.hLineTo(-base_width/2 + gap/2)
.vLineTo(holder_length / 2 - 2)
.hLineTo(-base_width/2)
.vLineTo(holder_length / 2)
.threePointArc((-base_width*3/8, base_length*3/8), (-gap/2, base_length/2))
.vLineTo((base_length-gap)/2)
.hLineTo(0)
)
Wires(base.close())
```

### 2) Method mirrorY() returns unexpected edges
```
base = (xy
.vLineTo(-base_length/2 + gap/2, forConstruction=True)
.hLineTo(-gap/2)
.vLineTo(-base_length/2)
.hLineTo(-base_width/2)
.vLineTo(-base_length/2 + 10)
.hLineTo(-base_width/2 + gap/2)
.vLineTo(holder_length / 2 - 2)
.hLineTo(-base_width/2)
.vLineTo(holder_length / 2)
.threePointArc((-base_width*3/8, base_length*3/8), (-gap/2, base_length/2))
.vLineTo((base_length-gap)/2)
.hLineTo(0)
)
Wires(base.mirrorY())
```

### 3) Own mirrorY without wire consolidation returns what I would expect
```python
def my_mirrorY(workplane):
n = workplane.wire(forConstruction=False)
mirroredWires = workplane.plane.mirrorInPlane(n.wires().vals(), 'Y')
for w in mirroredWires:
n.objects.append(w)
n._addPendingWire(w)
return n
base = (xy
.vLineTo(-base_length/2 + gap/2, forConstruction=True)
.hLineTo(-gap/2)
.vLineTo(-base_length/2)
.hLineTo(-base_width/2)
.vLineTo(-base_length/2 + 10)
.hLineTo(-base_width/2 + gap/2)
.vLineTo(holder_length / 2 - 2)
.hLineTo(-base_width/2)
.vLineTo(holder_length / 2)
.threePointArc((-base_width*3/8, base_length*3/8), (-gap/2, base_length/2))
.vLineTo((base_length-gap)/2)
.hLineTo(0)
)
Wires(my_mirrorY(base))
```

Note, `Wires()` uses `OCC.Extend.TopologyUtils.discretize_wire` to extract drawable edges
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.