CadQuery / CadQuery/cadquery

Rotations seem to be lost when using loft

Open
#304 8 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

```
s = cq.selectors.StringSyntaxSelector

box = cq.Workplane("front")
box = box.box(10, 10, 3)

def transform(s, r, c):
return s.rotate((0,0,1), (0,0,0), 10).rotate((0,1,0), (0,0,0), 10)

# example to flush the left face
test = box.rotate((0,0,1), (0,0,0), 10).rotate((0,1,0), (0,0,0), 10)

# the list of points with which we make the wire need to be in rotational order
left1 = transform(box.vertices(s("Y and >Z")), 0, 0).val()
left2 = transform(box.vertices(s("Y and Z")), 0, 0).val()
left_ordered = [left1, left2, left3, left4, left1]
tups = [v.toTuple() for v in left_ordered]

left_face = cq.Wire.makePolygon([cq.Vector(t) for t in tups])

# get minimum value for flush and rewrite the vectors
min_tup = min([t[0] for t in tups])
left_flush = [(min_tup, t[1], t[2]) for t in tups]
vects = [cq.Vector(t) for t in left_flush]
left_flush = cq.Wire.makePolygon(vects)

# here's where the issue lies
# uncomment these lines, and the box seems to lose the second rotation in transform(), and no longer aligned with the left_flush solid
#test.ctx.pendingWires = [left_face, left_flush]
#test = test.loft(combine=True)

show_object(test)
show_object(left_face)
show_object(left_flush)
```
Not sure if this is due to me misunderstanding how the stack works. The lines with `test.ctx.pendingWires` and `test.loft()` seem to mess with the rotation of test, by removing the most recent operation (see the two rotate's in transform()).

With those two lines commented out, the box is of the desired rotation and lines up with the wires to be lofted:
![correct_rotate](https://user-images.githubusercontent.com/10680546/77792303-87fcdb00-703e-11ea-8ca2-090766833cfa.png)
But when I uncomment the lines to complete the loft, the second/last rotation seems to be lost:
![incorrect_rotate](https://user-images.githubusercontent.com/10680546/77792290-829f9080-703e-11ea-9860-086e6e8620c2.png)

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.