Skip to content

Sketch distribute fix #1826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion cadquery/occ_impl/shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2184,7 +2184,12 @@ def locationAt(
T = gp_Trsf()
if planar:
T.SetTransformation(
gp_Ax3(pnt, gp_Dir(0, 0, 1), gp_Dir(normal.XYZ())), gp_Ax3()
gp_Ax3(
pnt,
gp_Dir(0, 0, 1),
gp_Dir(Vector(0, 0, 1).cross(Vector(tangent)).normalized().wrapped),
),
gp_Ax3(),
)
else:
T.SetTransformation(
Expand Down
3 changes: 3 additions & 0 deletions tests/test_sketch.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ def test_distribute():

assert s5._selection[0].Center().toTuple() == approx((0.0, 6.0, 0.0))

# make sure that we can use distribute on straight lines
_ = Sketch().segment((0, 0), (10, 0)).edges().distribute(3).rect(1, 2)


def test_rarray():

Expand Down