pythonocc-core
pythonocc-core copied to clipboard
RuntimeError: out of range index raised from method Compute of class ShapeTesselator
I test the code from core_tesselator_unittest.py and I try to test my file, I keep getting the following runtime error: Standard_OutOfRangeNCollection_AliasedArray::value(), out of range index raised from method Compute of class ShapeTesselator. It does not seem to be coming from my code. I have no idea how to fix it or check it.
You can find my code below and the full terminal output
- my test code

- terminal output
ERROR: test_tesselate_STEP_file (main.TestTesselator) loads a step file, tesselate. The as1_pe_203 contains
Traceback (most recent call last): File "d:\pythonocc-core\test\core_tesselator_unittest.py", line 129, in test_tesselate_STEP_file stp_file_tesselator.Compute(compute_edges=True) File "C:\Anaconda3\envs\py3d\lib\site-packages\OCC\Core\Tesselator.py", line 250, in Compute return _Tesselator.ShapeTesselator_Compute(self, compute_edges, mesh_quality, parallel) RuntimeError: Standard_OutOfRangeNCollection_AliasedArray::value(), out of range index raised from method Compute of class ShapeTesselator
Ran 8 tests in 1.324s
FAILED (errors=1)
Can you please provide the stp file you used for your test
I used two files for my test, one is as1-oc-214.stp in pythonocc-core/test/test_io/. test.zip
The same problem occurs for pythonocc-demos/examples/core_webgl_STEP_to_X3D.py and pythonocc-demos/examples/core_webgl_x3dom_bigfile_multipleshapes.py
RuntimeError: Standard_OutOfRangeNCollection_AliasedArray::value(), out of range index raised from method Compute of class ShapeTesselator
I used the step files provided in the repository. I used the following version: pythonocc-core 7.7.0, python 3.9.16
I also get the same error when running "load_step_ap203_multiple_shapes.ipynb" in /jupyter_notebooks. With pythonocc-core 7.7.0, Jupyter Notebook 6.5.4 and Python 3.10.10.
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
Cell In[22], line 6
3 for solid in t.solids():
4 # random colors, just for fun
5 random_color = format_color(randint(0,255), randint(0,255), randint(0,255))
----> 6 my_renderer.DisplayShape(solid, shape_color=random_color, render_edges=True)
File ~\Miniforge3\lib\site-packages\OCC\Display\WebGl\jupyter_renderer.py:788, in JupyterRenderer.DisplayShape(self, shp, shape_color, render_edges, edge_color, edge_deflection, vertex_color, quality, transparency, opacity, topo_level, update, selectable)
786 output.append(result)
787 else:
--> 788 result = self.AddShapeToScene(
789 shp,
790 shape_color,
791 render_edges,
792 edge_color,
793 vertex_color,
794 quality,
795 transparency,
796 opacity,
797 )
798 output.append(result)
800 if selectable: # Add geometries to pickable or non pickable objects
File ~\Miniforge3\lib\site-packages\OCC\Display\WebGl\jupyter_renderer.py:874, in JupyterRenderer.AddShapeToScene(self, shp, shape_color, render_edges, edge_color, vertex_color, quality, transparency, opacity)
861 def AddShapeToScene(
862 self,
863 shp,
(...)
871 ):
872 # first, compute the tessellation
873 tess = ShapeTesselator(shp)
--> 874 tess.Compute(compute_edges=render_edges, mesh_quality=quality, parallel=True)
875 # get vertices and normals
876 vertices_position = tess.GetVerticesPositionAsTuple()
File ~\Miniforge3\lib\site-packages\OCC\Core\Tesselator.py:250, in ShapeTesselator.Compute(self, compute_edges, mesh_quality, parallel)
248 def Compute(self, compute_edges: "bool"=False, mesh_quality: "float"=1.0, parallel: "bool"=False) -> "void":
249 r"""Compute(ShapeTesselator self, bool compute_edges=False, float mesh_quality=1.0, bool parallel=False)"""
--> 250 return _Tesselator.ShapeTesselator_Compute(self, compute_edges, mesh_quality, parallel)
RuntimeError: Standard_OutOfRangeNCollection_AliasedArray::value(), out of range index raised from method Compute of class ShapeTesselator