Re: [Pythoncad-developer] Pushed many changes to the R38 branch
CAD Application entire developed in Python
Status: Beta
Brought to you by:
matteoboscolo
From: Matteo B. <mat...@bo...> - 2010-01-09 08:30:07
|
Hi Gertwin, > > Draw functionality like segment, circle, polyline etc. should work, > text and dimension not. > I found an error in the gtkImage: the init collection is defined as __inittool = { Tools.PasteTool : cmd.paste_mode_init, this is not right, the method that set the tool: def __imageToolChanged(self, obj, *args): _tool = self.__image.getTool() if _tool is not None: _init = GTKImage.__inittool.get(type(_tool)) #here the _init is none because the tool is #Tools.paste_tool.PasteTool if _init is not None: _init(self) __inittool = { Tools.paste_tool.PasteTool : cmd.paste_mode_init, I have done this fix in my local repository and now it works well. let me know witch is the difference in your code ... I wold like to commit this change but i do not understand why your code works fine en i get this errors !?!? > > 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. ok me too > Panning works only from the menu at this point, not with the mouse > buttons. After some tests it look very fast even if with a lot of entity in the drawing. > 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). me to .. > The strange messages when closing PythonCAD I don't know where the > came from. I still have some strange message even if i draw entity and zooming ... may be we have to make some fix on it .. > 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. It seems an clever idea we can do some tests on it .. I can look in deep to the pytoncad entity and try to find a solution. may be we can optimize the way haw pythoncad get the entity. Using a db will be a solution !?!?! > > 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. Witch dxf file ? could you please commit it in the doc folder on git ? I would like to make some tests. During dxf import I create an array to store all the error that we find in the dxf file. may be we do not destroy in a well manner the obj that read the dxf.. > > 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? > Of course but all the new cad system works with multi tread .. so it will be nice to have such a functionality .. so we can have batch working ..es (When Solidworks create the drawing view or open a big 3d assembly it use the multitread system for generete the view or the hystory tree of the assembly). I'm not so skilled in multi thread application, but i can do some test.. > I think first we must get the core (generic + rendering) right before > adding new functionality. right > Maybe we can first look at this and decide what to do to get this > right. ok. I think that the pan is very fast . I did some test importing more then one dxf file(it means a lot of entity) and the pan working fast. The well zoom is still working slow may be there is to match redraw (one for each step?). It's possible to scale the pixmap insted of redraw the entire drawing area? > We can always rewrite the package Generic + rendering in C/C++ as an > dynamic python extension library (just a thought). I agree with you, but we need to have all the basic feature ready .. and a well defined structure of the core application before translate the code in c/c++. > 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. ok i will do some test an let you know > 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, Matteo |