Part/Toponaming: import code for TopoShape::prepareProfiles() from LS3
* add test for issue #15735 Signed-off-by: CalligaroV <vincenzo.calligaro@gmail.com>
This commit is contained in:
committed by
Yorik van Havre
parent
3b60bf7194
commit
bb86ed3206
@@ -20,6 +20,81 @@ class RegressionTests(unittest.TestCase):
|
||||
with self.assertRaises(IndexError):
|
||||
result.pop()
|
||||
|
||||
def test_issue_15735(self):
|
||||
"""
|
||||
15735: Point in sketch as loft profile won't work in dev, but works in stable
|
||||
The following test is a simplified version of the issue, but the outcome is the same
|
||||
"""
|
||||
|
||||
# Arrange
|
||||
from FreeCAD import Base
|
||||
import Sketcher
|
||||
|
||||
self.Doc = newDocument("TestLoftWithPointSketch")
|
||||
|
||||
ArcSketch = self.Doc.addObject("Sketcher::SketchObject", "ArcSketch")
|
||||
ArcSketch.Placement = Base.Placement(
|
||||
Base.Vector(0.000000, 0.000000, 0.000000),
|
||||
Base.Rotation(0.500000, 0.500000, 0.500000, 0.500000),
|
||||
)
|
||||
ArcSketch.MapMode = "Deactivated"
|
||||
|
||||
geoList = []
|
||||
geoList.append(
|
||||
Part.ArcOfCircle(
|
||||
Part.Circle(
|
||||
Base.Vector(0.000000, 0.000000, 0.000000),
|
||||
Base.Vector(0.000000, 0.000000, 1.000000),
|
||||
10.000000,
|
||||
),
|
||||
3.141593,
|
||||
6.283185,
|
||||
)
|
||||
)
|
||||
ArcSketch.addGeometry(geoList, False)
|
||||
del geoList
|
||||
|
||||
constraintList = []
|
||||
ArcSketch.addConstraint(Sketcher.Constraint("Radius", 0, 10.000000))
|
||||
constraintList.append(Sketcher.Constraint("Coincident", 0, 3, -1, 1))
|
||||
constraintList.append(Sketcher.Constraint("PointOnObject", 0, 2, -1))
|
||||
constraintList.append(Sketcher.Constraint("PointOnObject", 0, 1, -1))
|
||||
ArcSketch.addConstraint(constraintList)
|
||||
del constraintList
|
||||
|
||||
self.Doc.recompute()
|
||||
|
||||
PointSketch = self.Doc.addObject("Sketcher::SketchObject", "PointSketch")
|
||||
PointSketch.Placement = Base.Placement(
|
||||
Base.Vector(-10.000000, 0.000000, 0.000000),
|
||||
Base.Rotation(0.500000, 0.500000, 0.500000, 0.500000),
|
||||
)
|
||||
PointSketch.MapMode = "Deactivated"
|
||||
|
||||
PointSketch.addGeometry(Part.Point(Base.Vector(0.000000, 0.000000, 0)))
|
||||
PointSketch.toggleConstruction(0)
|
||||
|
||||
PointSketch.addConstraint(Sketcher.Constraint("Coincident", 0, 1, -1, 1))
|
||||
|
||||
self.Doc.recompute()
|
||||
|
||||
Loft = self.Doc.addObject("Part::Loft", "Loft")
|
||||
Loft.Sections = [
|
||||
ArcSketch,
|
||||
PointSketch,
|
||||
]
|
||||
Loft.Solid = False
|
||||
Loft.Ruled = False
|
||||
Loft.Closed = False
|
||||
|
||||
# Act
|
||||
self.Doc.recompute()
|
||||
|
||||
# Assert
|
||||
self.assertTrue(Loft.isValid())
|
||||
if Loft.isValid():
|
||||
closeDocument(self.Doc.Name)
|
||||
|
||||
def test_OptimalBox(self):
|
||||
box = Part.makeBox(1, 1, 1)
|
||||
self.assertTrue(box.optimalBoundingBox(True, False).isValid())
|
||||
@@ -46,4 +121,3 @@ class RegressionTests(unittest.TestCase):
|
||||
|
||||
# Put me in def tearDown(self): ?
|
||||
closeDocument(self.Doc.Name)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user