[PythonCAD] Question about transferring objects between layers

Art Haas ahaas at airmail.net
Tue Feb 7 21:03:35 CET 2006


Hi.

As I wrote in an earlier message, I've started reworking the code that
handles transferring objects between layers. While starting to make
some of the planned changes, I thought of a scenario that could occur
and wonder how other packages that use layers handle it.

Suppose we have a segment S and its two endpoints P1 and P2. These three
objects are in some layer, and now I decide to transfer either of the
points to another layer. As both endpoints of the segment must be in
the same layer as the segment itself, what should be the expected way to
handle this operation? Should the program allow the point to move, and
then by default transfer the segment as well, or should this operation
raise an error?

If the segment was to be transferred between layers, it will
automagically transfer the points if possible (in the initial writing
of the new code), so there is an implicit object transferring
in some operations already. The current transfer code in 'transfer.py'
is based around cloning entities and adding them to the desired layer,
and then deleting the original entities. The new approach will try to
avoid the cloning operations as much as possible, and instead use the
Layer deleteObject() and addObject() methods.

So, how do other CAD packages that hold drawing entities in layers
behave if the operation to transfer the entity results in the
entity having pieces of itself in both layers? I am inclined to
code things so that the entity is automagically transferred, but there
will certainly be times this behavior will be unexpected.

Comments and suggestions welcomed.

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