[Drawkit] DXF Import Progress / Example
Brad Larson
larson at sonoplot.com
Thu Jan 22 09:54:04 PST 2009
On Jan 22, 2009, at 2:47 AM, Allan wrote:
> Hello Brad and Graham,
>
> I spent some time looking over your revised SonoPlot application,
> Brad, and realized quickly that the DXF import process is pretty
> complicated due to the way DXF files are formatted. You've certainly
> done a good job with it, but for what I'm doing I need a more
> comprehensive approach to getting all of the object types available
> in the DXF files into my application.
>
> Rather than take on the task of more-or-less writing an entire
> generalized DXF importer based on the SonoPlot approach, I spent
> some time looking for existing DXF import libraries and actually
> found a couple written in c++ that seemed usable. There's a nice
> summary of available tools at http://tomacorp.com/dxf.html where
> they list and compare a number of existing libraries. Here's a quick
> summary of the two I looked at.
>
I'll certainly take a look at the libraries you mentioned, but I'd
still prefer to have a native, well-documented solution for doing
this. Maybe I can port their processing routines to Cocoa to
incorporate in the loading methods I'm using. These are good examples
that I hadn't found on my brief search a couple of months ago.
>
> Another question I have for you, Graham, is what is the correct
> logic in the "simple" DK demo program to do a zoom to fit the entire
> extents of the imported DXF into the area of the drawing that you
> can see on the screen? In other words, how would I implement a "zoom
> extents" command now that I have the DXF imported and it extends
> outside the viewable area? I did play with the GCZoom methods some,
> but couldn't make anything work yet -- but I haven't spent much time
> on that so far.
>
If you look in SonoDraw within the SPPatternDocument class, you'll
find the zoomToMenuSelection: method, which responds to menu items
that select new zoom scales. One of those scales fits the document
within the window and uses following line of code:
[[self mainView] zoomFitInWindow:sender];
______________________
Brad Larson, Ph.D.
SonoPlot, Inc.
3030 Laura Lane, Suite 120
Middleton, WI 53562
More information about the Drawkit
mailing list