Merge pull request #171 from Hatatister/feature_loft_checking

loft with a single wire crashes #161
This commit is contained in:
Jeremy Wright
2019-08-14 08:15:48 -04:00
committed by GitHub
2 changed files with 11 additions and 1 deletions

View File

@ -1214,6 +1214,8 @@ class Solid(Shape, Mixin3D):
wants to make an infinitely thin shell for a real FreeCADPart.
"""
# the True flag requests building a solid instead of a shell.
if len(listOfWire) < 2:
raise ValueError("More than one wire is required")
loft_builder = BRepOffsetAPI_ThruSections(True, ruled)
for w in listOfWire:

View File

@ -259,6 +259,14 @@ class TestCadQuery(BaseTest):
# the resulting loft had a split on the side, not sure why really, i expected only 3 faces
self.assertEqual(7, s.faces().size())
def testLoftWithOneWireRaisesValueError(self):
s = Workplane("XY").circle(5)
with self.assertRaises(ValueError) as cm:
s.loft()
err = cm.exception
self.assertEqual(str(err), "More than one wire is required")
def testLoftCombine(self):
"""
test combining a lof with another feature
@ -2050,4 +2058,4 @@ class TestCadQuery(BaseTest):
# find solid should return a compund of two solids
s = r.findSolid()
self.assertEqual(len(s.Solids()),2)
self.assertTrue(isinstance(s,Compound))
self.assertTrue(isinstance(s,Compound))