Re: [Pythoncad-developer] Spatiol coords on sqlite
CAD Application entire developed in Python
Status: Beta
Brought to you by:
matteoboscolo
From: Matteo B. <mat...@bo...> - 2010-03-11 06:33:09
|
Hi Gertwin, I just update my local git repo and start the test_kernel.py and it works perfectly.No compile are needed for linux ... :-)... > > Next thing to do is to populate the R*Tree index when inserting > entities in the database. > And do some queries to retrieve entities using the R*Tree. > At each insert or modifies an event is raised .. [pycadkernel].[saveEntityEvent](pycadkernel,entity) so you can get that event and make the insert ..or you can modifies the pycaddbent.py to do such e feature. I prefer that you use the event so we separate the kernel from the user interface.. So if it dose not work we can modify just the code for the RTree. Just one think .. In case of mySql database, using this method will increase the network traffic and the performance will be very bad .. So we have to think to a different system for using the mySql database . May Be we can mark as locked all the entity and make a copy of all the entity that we need in a local db.. when the user have finished we can update all the entity that are modified from the user .. But we can think of it later .... For Now the main think is to test if this system work..(new kernel + R*Tree+wx) So we can have the filling of the new solution.. I will go on with the import dxf. Doing so we can make some test using a lot of geometrical data. Regards, Matteo On Wed, 2010-03-10 at 22:27 +0000, ger...@gm... wrote: > Hi All, > > I added a custom build pysqlite to the repository. > This custom build pysqlite enables the R*Tree module. > The R*tree module replaces the in memory quad tree's used in R37 (if > tests succeed). > > I changed the test_kernel.py script to make use of this custom build. > Also I moved the test_kernel.py and pythoncad.pdr to the PythonCAD > directory. > > At this moment I have only build a linux amd64 version. > Other platforms and architectures follow. > > The idea is that no additional installation is needed. > Just pull the latest version from git and run the test_kernel.py > script. > It should just work as before. > > Next thing to do is to populate the R*Tree index when inserting > entities in the database. > And do some queries to retrieve entities using the R*Tree. > > Regards, > Gertwin > > n.b. > Building a custom pysqlite is quite easy. > Download the "pysqlite-2.6.0.tar.gz" from > "http://code.google.com/p/pysqlite/downloads/list". > Unpack the archive. > Alter the "setup.cfg": > > [build_ext] > # -DSQLITE_ENABLE_RTREE=1 builds the R*Tree module > define=-DSQLITE_ENABLE_RTREE=1 > #include_dirs=/usr/local/include > #library_dirs=/usr/local/lib > libraries=sqlite3 > define=SQLITE_OMIT_LOAD_EXTENSION > > run: python setup.py build_static > This will download the sqlite sources and build a single pysqlite > shared library. > Copy the build to the corresponding "PythonCAD > \<platform>\<architecture>" directory. > > > Op schreef "mat...@bo..." > <mat...@bo...>: > > Hi Gertwin, > > > > For me it's ok to use this sqllite extention, > > > > but to chose this option we need to be sure that the > > > > performance are at the top. > > > > > > > > So for my point of view you can recompile sqlite .. and try > > > > to understand how difficuoult is to do such a think.. > > > > Make some test to se if we have good performance. > > > > at the and with all this data in hands we can decide what to > > > > do .. > > > > > > > > Regaeds, > > > > Matteo > > > > > > > > > Hi Matteo, > > > > > > > > > > I didn't know this, thank you. > > > > > In this thread he (or she) wants to make use of the rtree > > > > > module (http://www.sqlite.org/rtree.html). > > > > > > > > > > The rtree module is not standard supported, you must > > > > > recompile sqlite with rtree support. > > > > > If I try to execute this query in sqlite > > > > > > > > > > CREATE VIRTUAL TABLE cad_index USING > > > > > rtree > > > > > (Id INTEGER, minX INTEGER, maxX > > > > > INTEGER, minY INTEGER, maxY INTEGER); > > > > > > > > > > I get an error: "no such module rtree", so we need to > > > > > provide a custom build sqlite along with PythonCad. > > > > > > > > > > I like to use this rtree module in sqlite, we don't have > > > > > to write and maintain our own code. > > > > > My approach until now it creating quad trees in memory > > > > > when opening the database. > > > > > This will take some time and will cost memory, using the > > > > > rtree module of sqlite is a better approach. > > > > > > > > > > We can store the bounding boxes of our entities in this > > > > > table. The Id column is the relation to the entity table. > > > > > > > > > > So what is your opinion about using a custom build sqlite? > > > > > > > > > > Regards, > > > > > Gertwin > > > > > > > > > > > > > > > > > > > > Op schreef Matteo Boscolo mat...@bo...>: > > > > > > > > > > > Hi Gerwin, > > > > > > > > > > > I found this article . > > > > > > > > > > > . > > > > > > > > > > > > > > > > > > > > http://www.mail-archive.com/sql...@sq.../msg47403.html > > > > > > > > > > > may be this can help us to retrieve the entity from db > > > > > > > > > > > > > > > > > > > > > Regards, > > > > > > > > > > > Matteo > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |