Cowdens a écrit : > Hey, folks; Hi Dave,
> > What are the correct classes that I should be using for creating viewers? > > I first took a hint from InteractiveViewer, which had a module called > wxDisplay. I use a copy of this for my slicer. > > however, i remember jelle saying that GraphicsCanva3d is quite old-- > yet, this is what i see used in wxDisplay. > > Inside of OCC.Display i see viewer3d and viewer2d, however these do > not appear in the pythonocc documentation. The Viewer2d, Viewer3d and upcoming NISViewer3d are low level python classes for OpenCascade viewers handling. > > Which ones should i be using? I was trying to get rid of my local copy > of wxDisplay, but i could not find which class ultimately has the > SetModeWireFrame() method on it.... wxDisplay* classes allow to use these viewers with the wxPython library. We can imagine that someone wants to use pyQt instead of wxPython. In this case, we should have something like qtDisplay. Viewer3d and Viewer 2d classes manage everything that is related to OpenCascade visualization. wxViewer3d and wxViewer2d manage GUI events (mouse clicks, keyboard events, paint, idling, mouse move etc.) and perform the appropritate operation on the Viewer3d class. The SetModeWireFrame() is an OpenCascade operation, it's then handled in the Viewer3d class. Now, if you want to develop your own viewer, you have many possibilities: 1. Develop your own wxViewer3d class by copy/modify the wxDisplay.py script. It's a *bad* idea since this script is part of pythonOCC and this should be confusing. If you really want to proceed that way, use another module name, for instance SlicerDisplay.py or DaveDisplay.py, but not wxDisplay.py. 2. Overload the wxViewer3d class that come with pythonOCC. from OCC.Display.wxDisplay import wxViewer3d class myViewer(wxViewer3d): etc. In the latest svn rev., I modified the structure of the wxViewer* classes. I created a wxBaseViewer3d that can be used to build customized displays: from OCC.Display.wxDisplay import wxBaseViewer3d class myViewer(wxBaseViewer3d): etc. You just have to overload the methods you want to customize: change the way you rotate/pan shape, keyboard shortcuts etc. This way is more pythonic and you will benefit from fixes/improvements that will come in the base class. 3. You don't want to use wxPython (but Qt, Tkinter etc): develop a new qtDisplay.py or tkDisplay.py module. This new module will use the OCCViewer.py module as-is. At last, note that the wxViewer2d class is still in a very poor state. > > thanks > Dave Cheers, Thomas > ------------------------------------------------------------------------ > > _______________________________________________ > Pythonocc-users mailing list > Pythonocc-users@gna.org > https://mail.gna.org/listinfo/pythonocc-users > _______________________________________________ Pythonocc-users mailing list Pythonocc-users@gna.org https://mail.gna.org/listinfo/pythonocc-users