Skip to content

Commit 5812b02

Browse files
committed
Added test case for PR tpaviot#614 - return None is TopoDS_Shape is Null in function transformer
1 parent 6c64319 commit 5812b02

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

test/core_wrapper_features_unittest.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
from OCC.Core.BRepPrimAPI import BRepPrimAPI_MakeBox
2929
from OCC.Core.BRepBuilderAPI import (BRepBuilderAPI_MakeVertex,
3030
BRepBuilderAPI_MakeEdge)
31-
from OCC.Core.gp import (gp_Pnt, gp_Vec, gp_Pnt2d, gp_Lin, gp_Dir,
31+
from OCC.Core.gp import (gp_Pnt, gp_Vec, gp_Pnt2d, gp_Lin, gp_Dir, gp_Ax2,
3232
gp_Quaternion, gp_QuaternionSLerp, gp_XYZ, gp_Mat)
3333
from OCC.Core.GC import GC_MakeSegment
3434
from OCC.Core.STEPControl import STEPControl_Writer
@@ -52,6 +52,8 @@
5252
BRepCheck_EmptyWire)
5353
from OCC.Core.Geom import Geom_Curve, Geom_Line, Geom_BSplineCurve
5454
from OCC.Core.BRep import BRep_Tool_Curve
55+
from OCC.Core.HLRBRep import HLRBRep_Algo, HLRBRep_HLRToShape
56+
from OCC.Core.HLRAlgo import HLRAlgo_Projector
5557

5658
@contextmanager
5759
def assert_warns_deprecated():
@@ -658,6 +660,20 @@ def test_in_place_operators(self):
658660
self.assertEqual(d.Y(), 7.)
659661
self.assertEqual(d.Z(), 9.)
660662

663+
def test_shape_conversion_as_py_none(self):
664+
# see issue #600 and PR #614
665+
# a null topods_shape should be returned as Py_None by the TopoDS transformer
666+
# the following test case returns a null topods_shape
667+
box = BRepPrimAPI_MakeBox(1., 1., 1.).Shape()
668+
hlr = HLRBRep_Algo()
669+
hlr.Add(box)
670+
projector = HLRAlgo_Projector(gp_Ax2(gp_Pnt(), gp_Dir(-1.75, 1.1, 5)))
671+
hlr.Projector(projector)
672+
hlr.Update()
673+
hlr.Hide()
674+
hlr_shapes = HLRBRep_HLRToShape(hlr)
675+
visible_smooth_edges = hlr_shapes.Rg1LineVCompound()
676+
self.assertTrue(visible_smooth_edges is None)
661677

662678
def suite():
663679
test_suite = unittest.TestSuite()

0 commit comments

Comments
 (0)