drlukeparry / pyslm

PySLM: A Python Library for 3D Printing and Additive Manufacturing
http://lukeparry.uk/projects/pyslm
GNU Lesser General Public License v2.1
90 stars 16 forks source link

Bug in Support Generation for large and complex stl parts #46

Open Vipul-M-Rawal opened 3 weeks ago

Vipul-M-Rawal commented 3 weeks ago

Hi, I am facing issues generating block supports for the given parts. I am getting almost the same problems for many parts. To solve the issues I made some changes in the parameters also, but still the issue persists. I am attaching the stl file and the code below:

code : Code.txt

I am getting the given errors:

ERROR:root:Support generation failed: Input must be >= 1-d.

WARNING: Traceback (most recent call last): File "c:\Users\vipul.k\Music\VolumeGen\Volume.py", line 98, in supportBlockRegions = supportGenerator.identifySupportRegions(myPart, OVERHANG_ANGLE, True) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\pyslm\support\gridBlockSupport.py", line 1936, in identifySupportRegions supportBlocks = super().identifySupportRegions(part, overhangAngle, findSelfIntersectingSupport) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\pyslm\support\support.py", line 851, in identifySupportRegions heightMap, heightMapUpper, heightMapLower = self._identifySelfIntersectionHeightMap(subregion, offsetPoly, cutMeshUpper, bbox) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\pyslm\support\support.py", line 624, in _identifySelfIntersectionHeightMap lowerImg = render.projectHeightMap(cutMesh, self.rayProjectionResolution, True, bboxCpy) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\pyslm\support\render.py", line 188, in projectHeightMap c.show(visible=True) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\app\canvas.py", line 435, in show self._backend._vispy_set_visible(visible) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\app\backends_qt.py", line 465, in _vispy_set_visible self.showNormal() File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\app\backends_qt.py", line 626, in event out = super(QtBaseCanvasBackend, self).event(ev) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\app\backends_qt.py", line 626, in event out = super(QtBaseCanvasBackend, self).event(ev) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\app\backends_qt.py", line 928, in paintGL self._vispy_canvas.events.draw(region=None) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\util\event.py", line 453, in call self._invoke_callback(cb, event) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\util\event.py", line 471, in _invoke_callback _handle_exception(self.ignore_callback_errors, << caught exception here: >> File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\util\event.py", line 469, in _invoke_callback cb(event) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\pyslm\support\render.py", line 175, in on_draw self.program.draw('triangles', self.filled_buf) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\gloo\program.py", line 543, in draw canvas.context.flush_commands() File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\gloo\context.py", line 172, in flush_commands self.glir.flush(self.shared.parser) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\gloo\glir.py", line 584, in flush self._shared.flush(parser) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\gloo\glir.py", line 506, in flush parser.parse(self._filter(self.clear(), parser)) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\gloo\glir.py", line 824, in parse self._parse(command) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\gloo\glir.py", line 800, in _parse ob.set_framebuffer(args) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\gloo\glir.py", line 1758, in set_framebuffer self._validate() File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\gloo\glir.py", line 1823, in _validate raise RuntimeError(_bad_map.get(res, 'Unknown framebuffer error: %r.' RuntimeError: Target not equal to GL_FRAMEBUFFER WARNING:vispy:Traceback (most recent call last): File "c:\Users\vipul.k\Music\VolumeGen\Volume.py", line 98, in supportBlockRegions = supportGenerator.identifySupportRegions(myPart, OVERHANG_ANGLE, True) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\pyslm\support\gridBlockSupport.py", line 1936, in identifySupportRegions supportBlocks = super().identifySupportRegions(part, overhangAngle, findSelfIntersectingSupport) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\pyslm\support\support.py", line 851, in identifySupportRegions heightMap, heightMapUpper, heightMapLower = self._identifySelfIntersectionHeightMap(subregion, offsetPoly, cutMeshUpper, bbox) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\pyslm\support\support.py", line 624, in _identifySelfIntersectionHeightMap lowerImg = render.projectHeightMap(cutMesh, self.rayProjectionResolution, True, bboxCpy) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\pyslm\support\render.py", line 188, in projectHeightMap c.show(visible=True) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\app\canvas.py", line 435, in show self._backend._vispy_set_visible(visible) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\app\backends_qt.py", line 465, in _vispy_set_visible self.showNormal() File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\app\backends_qt.py", line 626, in event out = super(QtBaseCanvasBackend, self).event(ev) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\app\backends_qt.py", line 626, in event out = super(QtBaseCanvasBackend, self).event(ev) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\app\backends_qt.py", line 928, in paintGL self._vispy_canvas.events.draw(region=None) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\util\event.py", line 453, in call self._invoke_callback(cb, event) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\util\event.py", line 471, in _invoke_callback _handle_exception(self.ignore_callback_errors, << caught exception here: >> File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\util\event.py", line 469, in _invoke_callback cb(event) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\pyslm\support\render.py", line 175, in on_draw self.program.draw('triangles', self.filled_buf) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\gloo\program.py", line 543, in draw canvas.context.flush_commands() File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\gloo\context.py", line 172, in flush_commands self.glir.flush(self.shared.parser) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\gloo\glir.py", line 584, in flush self._shared.flush(parser) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\gloo\glir.py", line 506, in flush parser.parse(self._filter(self.clear(), parser)) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\gloo\glir.py", line 824, in parse self._parse(command) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\gloo\glir.py", line 800, in _parse ob.set_framebuffer(args) File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\gloo\glir.py", line 1758, in set_framebuffer self._validate() File "C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\vispy\gloo\glir.py", line 1823, in _validate raise RuntimeError(_bad_map.get(res, 'Unknown framebuffer error: %r.' RuntimeError: Target not equal to GL_FRAMEBUFFER ERROR: Invoking <bound method Canvas.on_draw of <Canvas (PyQt5) at 0x22ccc1ee4e0>> for DrawEvent ERROR:vispy:Invoking <bound method Canvas.on_draw of <Canvas (PyQt5) at 0x22ccc1ee4e0>> for DrawEvent

INFO:root:Time taken for support geometry creation: 46.22 seconds C:\Users\vipul.k\AppData\Roaming\Python\Python312\site-packages\pyglet\libs\win32__init__.py:318: UserWarning: Could not set COM MTA mode. Unexpected behavior may occur. warnings.warn("Could not set COM MTA mode. Unexpected behavior may occur.")

Structure-pack_200 mm.zip

drlukeparry commented 3 weeks ago

the error appears related to the vispy module, which is using the pyglet backend, which I have observed to create some problems in the past depending on the system/platform used. Additionally, the functionality depends on having reasonably modern openGL graphics drivers that support floating-point depth framebuffers, otherwise the raytracing approach method breaks down when attempting to create supports. I imagine under certain virtualisation / cloud platforms this could be problematic.

I would suggest to install PyQt5 / PyQt6 and set the corresponding backend for vispy to use this and see if this fixes the problem you are encountering.