solid.loft: added checking for at least 2 wires to prevent segmentation fault. see issue #161. now a ValueError is raised
This commit is contained in:
@ -1214,6 +1214,8 @@ class Solid(Shape, Mixin3D):
|
|||||||
wants to make an infinitely thin shell for a real FreeCADPart.
|
wants to make an infinitely thin shell for a real FreeCADPart.
|
||||||
"""
|
"""
|
||||||
# the True flag requests building a solid instead of a shell.
|
# 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)
|
loft_builder = BRepOffsetAPI_ThruSections(True, ruled)
|
||||||
|
|
||||||
for w in listOfWire:
|
for w in listOfWire:
|
||||||
|
@ -259,6 +259,15 @@ class TestCadQuery(BaseTest):
|
|||||||
# the resulting loft had a split on the side, not sure why really, i expected only 3 faces
|
# the resulting loft had a split on the side, not sure why really, i expected only 3 faces
|
||||||
self.assertEqual(7, s.faces().size())
|
self.assertEqual(7, s.faces().size())
|
||||||
|
|
||||||
|
def testLoftWithOneWireRaisesValueError(self):
|
||||||
|
s = Workplane("XY").circle(5)
|
||||||
|
try:
|
||||||
|
s.loft()
|
||||||
|
self.assertFail()
|
||||||
|
except ValueError as e:
|
||||||
|
self.assertEqual(str(e), "More than one wire is required")
|
||||||
|
|
||||||
|
|
||||||
def testLoftCombine(self):
|
def testLoftCombine(self):
|
||||||
"""
|
"""
|
||||||
test combining a lof with another feature
|
test combining a lof with another feature
|
||||||
|
Reference in New Issue
Block a user