[Dxfreader-info] BLOCKS refactor and BBDXFTuple rename
Status: Beta
Brought to you by:
allandaly
From: Allan D. <all...@gm...> - 2009-03-22 15:51:40
|
Mike, I started to tackle the BLOCKS logic/parsing/etc. A BLOCK definition in the BLOCKS section is a collection of regular DXF entities that are defined exactly the same in the BLOCKS section as they are in the main ENTITIES section. The one difference is that a BLOCK definition has some meta-data attached to it -- a name, some flags, an XYZ origin point for example. Entities inside the block have their XYZ coordinates set relative to this block origin point. Both a BLOCK definition and the ENTITIES section contain a collection of entities. In order to structure things cleanly I think we need to refactor the entities array and accessor methods out of the BBDXFModel object and create a new BBDXFEntitiesCollection object to hold them instead. A BBDXFModel can then contain one of these entity collections to represent the main entities collection and a BBDXFBLock can also contain one of these entity collections to contain all the entities associated with that block. The BBDXFModel can also of course contain all the other model data defined in the drawing (the header dictionary you created, for example) and the BBDXFBlock object can contain all the block meta-data. The other thing I wanted to suggest is that your BBDXFTuple object be renamed to DXFTwople. Since it's just an internal private object, there's no need to put the BB on there since it will not be reference or reused publicly and there's no chance for any confusion with anyone else's Tuple (or Twople) object. Second since the object refers to a pair of two lines inside the DXF file, I think using the word "two" in there would make things a bit clearer. Once upon a time I did a lot of theater and there was a "twofer" plug that allowed you to put two theatrical lights into one plug. The "two" helps explain things -- your "tu" confused me on the first pass through. Are you OK with renaming that? I propose "DXFTwople." The next big topic here is who does what and how do we coordinate? Let's make a plan for working in parallel and then I'll dive in to these changes. I also want to hear your thoughts on these changes. Thanks. -Allan |