Re: [Pythoncad-developer] Pushed many changes to the R38 branch
CAD Application entire developed in Python
Status: Beta
Brought to you by:
matteoboscolo
From: <ger...@gm...> - 2010-01-08 15:33:06
|
Hi Matteo, Draw functionality like segment, circle, polyline etc. should work, text and dimension not. At this point I did not expect a performance improvement for redraw. The method of drawing is basically the same as it was except that is now done by a few functions in viewport.py. Panning works only from the menu at this point, not with the mouse buttons. The rendering is now done to a pixmap and not directly to the screen. When panning the pixmap is moved around the screen without the need of a redraw. When panning stops a redraw is needed for the visible area of the drawing. The only thing I did until now was a rewrite of the rendering, all it is now all done by cairo. I did not expect the dxf import was faster (except maybe for rendering at the end). The strange messages when closing PythonCAD I don't know where the came from. I am not aware of any changes in that area. I think they are from the image class disposing entities from layers, this cost a very long time with large drawings. Last night I did some more thinking on how display performance can be improved. One thing is that when a redraw is done all entites are queried from the image class and rendered on the pixmap canvas. I think getting the coordinates from the entities and translate them to cairo paths cost some time. Also PythonCAD itself does the mapping from world to screen coordinates (without the use of the cairo matrix). Maybe a large performance gain can be achieved if we once query the entities and store the cairo rendering paths in lists. If we make use of the cairo transformation matrix for zooming and translation we only have to replay the paths in the lists without accessing the individual entities. This is a little like the opengl display lists work. At this point I am most concerned about the large memory consumption and the time needed to unload (garbage collection?) a drawing from PytonCAD. I posted this a week ago on the pythoncad-developer list, a small dxf file leads to a memory use of almost 1GB. I know PythonCAD is now a single threaded application which uses only one of my the available cpu cores. But don't you think stuff will be much more difficult when we go multi threaded? I think first we must get the core (generic + rendering) right before adding new functionality. Maybe we can first look at this and decide what to do to get this right. We can always rewrite the package Generic + rendering in C/C++ as an dynamic python extension library (just a thought). The Interface package and the dxf/dwg import/export can remain in python. If you find some time the next days please look the the performance and memory consumption of loading/unloading drawings. I will do the same, we can discuss these things on the python-developer mailing list and hopefully also get some input from others. Regards, Gertwin Op schreef Matteo Boscolo <mat...@bo...>: > Hi Gertwin, > I've done some test and is seems to go faster then the previous version. > It's hard to make some test without some drawing functionality like > lines circles .... > I've done some tests importing the dxf files under doc folder and it > seems faster then the older system but not as much as I expected. > In my installation the pan mouse functionality dose not work. > And i get some strange message when i close PythonCad > __imageRemovedChild > remaining connections for obj: > 0x97a1d6c> > message: added_child > connected to obj: > 0x97ab68c> > message: removed_child > connected to obj: > 0x97ab68c> > >At least the panning is faster now (but after pan a redraw it needed > >which can be slow for large drawings). > Could be use Tread for beach Redraw ? so the user can work and in the > batch mode we get the redraw. > I made some Test with treading while importing dxf file but i get some > bad error and i stop developing it. > I can make some test on it to get it work .. > >I think for really good performance you need display lists as used in > >opengl. > We can think of it .. i like to do e good job and performance in > zooming/redrawing are very important in a cad program. > So if you think that the display list will be the right choice.. we can > work on it we can share the work. > Regards, > Matteo > On Thu, 2010-01-07 at 22:26 +0000, ger...@gm... wrote: > > Hello, > > > > I just pushed many changed into the R38 repository. > > > > This means the old drawing methods are mostly replaced by the new > > cairo ones. > > All draw functions (entity draw and rubberbanding and future selection > > draw) are now in the draw.py modules. > > > > Not all entity draw functions are replaced by new ones, I will convert > > them one by one the next days. > > There are issues with drawings when a very large part of the entity is > > off screen (maybe need some clipping). > > There are issues with rubberbanding which can be slow at some times > > (after dynamic zoom with mouse wheel while drawing). > > Mouse wheel zoom is pointer position sensitive, zooming is done around > > the mouse pointer and not screen center. > > > > At this stage the cairo drawing should give a good indication of the > > performance which can be achieved. > > I have not done any optimizations but I don't think it will be more > > than 1.5x faster as it is now. > > At least the panning is faster now (but after pan a redraw it needed > > which can be slow for large drawings). > > Also each dynamic zoom with the wheel mouse button requires a redraw. > > When zoomed into a small part of the drawing less entities are drawn > > than redraw is faster, whole drawing redraw is still slow. > > > > Please look at the drawing performance and share your feelings (is it > > fast enough, does it need changes). > > I think for really good performance you need display lists as used in > > opengl. > > > > Regards, > > Gertwin |