|
33 | 33 | from OCC.Core.Standard import Standard_Transient |
34 | 34 | from OCC.Core.Bnd import Bnd_Box |
35 | 35 | from OCC.Core.BRepExtrema import BRepExtrema_ShapeProximity |
| 36 | +from OCC.Core.BRepClass import BRepClass_FaceExplorer, BRepClass_Edge |
36 | 37 | from OCC.Core.BRepOffsetAPI import BRepOffsetAPI_Sewing |
37 | 38 | from OCC.Core.BRepBndLib import brepbndlib_Add |
38 | 39 | from OCC.Core.BRepMesh import BRepMesh_IncrementalMesh |
|
104 | 105 | MethodNotWrappedError, |
105 | 106 | ClassNotWrappedError, |
106 | 107 | ) |
| 108 | +from OCC.Core.TopAbs import TopAbs_Orientation |
| 109 | +from OCC.Core.BRepPrimAPI import BRepPrimAPI_MakeBox |
| 110 | + |
| 111 | +from OCC.Extend.TopologyUtils import TopologyExplorer |
107 | 112 |
|
108 | 113 |
|
109 | 114 | @contextmanager |
@@ -892,6 +897,40 @@ def test_wrap_enum(self) -> None: |
892 | 897 | self.assertEqual(white.Green(), 1.0) |
893 | 898 | self.assertEqual(white.Blue(), 1.0) |
894 | 899 |
|
| 900 | + def test_topabs_orientation_byref(self): |
| 901 | + # see Issue https://github.com/tpaviot/pythonocc-core/issues/1038 |
| 902 | + box = BRepPrimAPI_MakeBox(10, 20, 30).Shape() |
| 903 | + box_face = list(TopologyExplorer(box).faces())[0] |
| 904 | + |
| 905 | + facetopo = BRepClass_FaceExplorer(box_face) |
| 906 | + facetopo.InitWires() # get ready to explore wires/loops of this face |
| 907 | + |
| 908 | + edge_1 = BRepClass_Edge() |
| 909 | + edge_2 = BRepClass_Edge() |
| 910 | + edge_3 = BRepClass_Edge() |
| 911 | + edge_4 = BRepClass_Edge() |
| 912 | + |
| 913 | + facetopo.InitEdges() |
| 914 | + topabs_ori_1 = facetopo.CurrentEdge( |
| 915 | + edge_1 |
| 916 | + ) |
| 917 | + facetopo.NextEdge() |
| 918 | + topabs_ori_2 = facetopo.CurrentEdge( |
| 919 | + edge_2 |
| 920 | + ) |
| 921 | + facetopo.NextEdge() |
| 922 | + topabs_ori_3 = facetopo.CurrentEdge( |
| 923 | + edge_3 |
| 924 | + ) |
| 925 | + facetopo.NextEdge() |
| 926 | + topabs_ori_4 = facetopo.CurrentEdge( |
| 927 | + edge_4 |
| 928 | + ) |
| 929 | + self.assertEqual(topabs_ori_1, TopAbs_Orientation.TopAbs_REVERSED) |
| 930 | + self.assertEqual(topabs_ori_2, TopAbs_Orientation.TopAbs_REVERSED) |
| 931 | + self.assertEqual(topabs_ori_3, TopAbs_Orientation.TopAbs_FORWARD) |
| 932 | + self.assertEqual(topabs_ori_4, TopAbs_Orientation.TopAbs_FORWARD) |
| 933 | + |
895 | 934 |
|
896 | 935 | def suite() -> unittest.TestSuite: |
897 | 936 | test_suite = unittest.TestSuite() |
|
0 commit comments