rarray: bound spacings to greater than 0 (#454)

* rarray: bound spacings to greater than 0
This addresses Issue 451

* Fix a typo. (#452)

* Fix a typo.

* Pin black version in travis

Co-authored-by: Adam Urbańczyk <adam-urbanczyk@users.noreply.github.com>

* rarray: bound spacings to greater than 0
This addresses Issue 451

* Added test for rarray error handling

Co-authored-by: Kevin Menard <kevin@nirvdrum.com>
Co-authored-by: Adam Urbańczyk <adam-urbanczyk@users.noreply.github.com>
This commit is contained in:
Josiah Bradley
2020-09-27 08:05:04 -07:00
committed by GitHub
parent c819dfca48
commit 32f25f7164
2 changed files with 5 additions and 2 deletions

View File

@ -1291,7 +1291,7 @@ class Workplane(object):
false, the lower left corner will be at the center of the work plane false, the lower left corner will be at the center of the work plane
""" """
if xSpacing < 1 or ySpacing < 1 or xCount < 1 or yCount < 1: if xSpacing <= 0 or ySpacing <= 0 or xCount < 1 or yCount < 1:
raise ValueError("Spacing and count must be > 0 ") raise ValueError("Spacing and count must be > 0 ")
lpoints = [] # coordinates relative to bottom left point lpoints = [] # coordinates relative to bottom left point

View File

@ -8,7 +8,7 @@ from random import choice
from random import random from random import random
from random import randrange from random import randrange
from pytest import approx from pytest import approx, raises
# my modules # my modules
@ -960,6 +960,9 @@ class TestCadQuery(BaseTest):
# 6 faces for the box, 2 faces for each cylinder # 6 faces for the box, 2 faces for each cylinder
self.assertEqual(6 + NUMX * NUMY * 2, s.faces().size()) self.assertEqual(6 + NUMX * NUMY * 2, s.faces().size())
with raises(ValueError):
Workplane().rarray(0, 0, NUMX, NUMY, True)
def testPolarArray(self): def testPolarArray(self):
radius = 10 radius = 10