Skip to content

Commit

Permalink
Indexing fix (#1163)
Browse files Browse the repository at this point in the history
* Indexing fix

* Test for tessellate

* black fix
  • Loading branch information
adam-urbanczyk authored Oct 4, 2022
1 parent e4eac12 commit d5806e3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cadquery/occ_impl/shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1218,7 +1218,7 @@ def tessellate(
vertices += [
Vector(v.X(), v.Y(), v.Z())
for v in (
poly.Node(i).Transformed(Trsf) for i in range(1, poly.NbNodes())
poly.Node(i).Transformed(Trsf) for i in range(1, poly.NbNodes() + 1)
)
]

Expand Down
7 changes: 7 additions & 0 deletions tests/test_exporters.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,3 +350,10 @@ def test_assy_vtk_rotation(tmpdir):
break

assert matched_rot


def test_tessellate(box123):

verts, triangles = box123.val().tessellate(1e-6)
assert len(verts) == 24
assert len(triangles) == 12

0 comments on commit d5806e3

Please sign in to comment.