[PythonCAD] Small fixes for fourteenth release and new stuff at repo

Art Haas ahaas at airmail.net
Wed Jun 2 13:36:01 EDT 2004


Hi.

I've been working on removing some of the code duplication in the
various Quadtree subclasses. Many of these classes have the same code
for moving through the tree duplicated two or three times. I've changed
most of these routines now to use a common method call to walk through
the Quadtrees, and things look pretty good. I've sent my changes to the
repository so people using subversion can grab them and see. The old
routines are still present, they now have a temporary 'old_' prefix in
their name. When I'm happy with the new routines these older ones will
be removed.

While working on this stuff I found a dumb bug in the VCLineQuadtree
code. In the file 'Generic/vcline.py', on lines 487-488 you'll see this:

_bmin = _bounds[0]
_bmax = _bounds[0]

The '_bmax' index is wrong - it should be '2'. Change the line like so:

_bmax = _bounds[2]

Also, there was an omission in the 'Generic/layer.py' file. The
canParent() method of the Layer class is missing the 'text.TextBlock'
class in the tuple listing valid children of the layer. The method
starts on line 1917, and you'll see that the isinstance() second
argument is a tuple with lots of class types listed. Adding in
'text.TextBlock' to the tuple fixes a problem seen when adding text to a
drawing. The last line of the tuple looks like this ...

ccircle.CCircle, dimension.Dimension))

Change it to ...

ccircle.CCircle, dimension.Dimension, text.TextBlock))

and the problem is fixed. Sorry that this slipped by.

If you pull the code from the repo you'll also get fixes for splitting
entities. When splitting a group of entities selected within a boxed
region, the code previously relied on the entities being in a sorted
order from leftmost to rightmost. The quadtree stuff did away with that
assumption, but the splittin code had a number of tests that needed to
be removed which weren't until now. Splitting a number of entities works
much better now that the tests have been fixed.

Art
-- 
Man once surrendering his reason, has no remaining guard against absurdities
the most monstrous, and like a ship without rudder, is the sport of every wind.

-Thomas Jefferson to James Smith, 1822



More information about the PythonCAD mailing list