Re: [Pythoncad-developer] New kernel
CAD Application entire developed in Python
Status: Beta
Brought to you by:
matteoboscolo
|
From: Matteo B. <mat...@bo...> - 2010-03-02 17:08:57
|
Hi gertwing,
We need to spatial queries like "give me all entities within (or outside) a
rectangle", needed for a zoom or select functions.
Or "give me the nearest entities from a given point", needed for snap and
selection functions.
ok
May be you can create this structure in memory at startup looking of the
bounding box .
Let me know if having the bbox information in the entity table is still
necessary ..
> I don't' know how to improve this code
> ..
>
> The name of the layer is inside
> the pickle entity .. so I need to get all the layer and then ask to the
> unpickle elemente the name ..
>
> We can store the entity type
> with the name like this 'LAYER_MAIN' or "LAYER_PIPE"
> but I do not like this sort of naming conversion for the entity type.
>
> Any idea?
We must do the selection based on Id's.
The id is the primary key and is indexed.
When the drawing is opened PythonCAD retrieved all layers from the database,
this is done by the pyKadKernel.getEntityFromType('LAYER').
The layer name is presented to the user, the record id is used internally by
PythonCAD.
When a single layer record is needed the id of the record is used to query
the database.
So instead of
def getEntLayer(self, layerName)
we use
def getEntLayer(self, layerId)
This way we make full use of the database indexes and it will be lightning
fast.
ok
I was thinking to load in memory at startup all the layer tree for fast
access to the data . and create a class for manage all the layers..
Regards,
Matteo
|