[Drawkit] DXF reader and DrawKit text objects

Allan allandaly at me.com
Thu Feb 5 06:07:00 PST 2009


Graham, Brad,

Turns out the existing DXF reader codes are not going to work for me.  
In the case of dxf_lib it's too simple in that it doesn't deal with  
"blocks" correctly and the underlying code is not particularly well  
structured (not object oriented). Dime is a much better library, but  
it's just too expensive for me -- they only want to license it as part  
of the larger Coin_3D package and they want over $3000 for it. So I've  
decided to create a stand-alone DXF reader framework. I'm most of the  
way through it and have implemented lines, polylines, arcs, and  
circles so far. These are the basic building blocks I need for what  
I'm doing and I have the import to the DKSimpleDXF application working  
well.

The three final things I need to deal with are TEXT entities (single  
line of text), MTEXT objects (multiple lines), and blocks. I'm a bit  
stuck on the TEXT import right now and I'm hoping you can help with  
some advice. The DXF TEXT entity does not use the concept of a  
bounding box or bounding rectangle like DrawKit does. In a TEXT  
entity, it anchors to an alignment point and then drawings the text  
springing from that point.

Is there any equivalent to this in DrawKit? I have played around with  
the DKTextShape and the associated DKTextAdornment quite a bit and  
cannot find anything there. I've also played with the DKTextPath and  
it also needs to be made "big enough" to show all the text. Am I going  
to have to get the TEXT entity data from the DXF file and then  
calculate the size of a bounding box or long-enough text-path to  
contain the text I create so it all will show?

Along these lines, the DKTextAdornment property  
"allowsTextToExtendHorizontally" seems like it might be intended to  
accomplish what I'm trying to do here (let the text extend beyond the  
bounding box of the associated shape), but even when I set this  
property to YES the text disappears as I make the bounding box smaller  
and doesn't actually seem to "ExtendHorizontally."

Any thoughts? Thanks for any help you can provide.

-Allan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.apptree.net/pipermail/drawkit-apptree.net/attachments/20090205/a00369fe/attachment.htm>


More information about the Drawkit mailing list