pythonocc-core icon indicating copy to clipboard operation
pythonocc-core copied to clipboard

qtBaseViewer Freezing when adding shapes

Open nsmela opened this issue 1 year ago • 1 comments

Using PySide6 and Qt6 imported a STL file to TopoDS_Shape update the display using self.display.DisplayShape(), app is freezing for nearly 10+ seconds before showing the model in the display

tried using QThread, and then QRunnable to make the process multithreaded, fails. Turns out you cannot update GUI objects in a separate thread with Qt.

tried converting the shape into AIS_Shape and calling self.display.Context.Display(), but no improvement

Is there a way to update the display without freezing the display? Create a duplicate of the context, add the shapes and then use that to update the display? Would that be with the Context.Display or is Load() a better option? Or is there an object I can convert the imported stl shape into that will make updating the display faster?

For my own notes: Overview

nsmela avatar Nov 08 '23 21:11 nsmela

tried using QThread, and then QRunnable to make the process multithreaded, fails. Turns out you cannot update GUI objects in a separate thread with Qt.

I think that's because of GIL, you can try to use nogil (You should use threading, instead of QThread). I haven't tested that, but I that's a solution.

I am still keeping trying to make the pythonocc multithreaded.

ovo-Tim avatar Nov 10 '23 00:11 ovo-Tim