Parent Category: Big Blue Saw Blog
Created: Tuesday, 28 November 2017 19:45
Written by Simon Arthur
At Big Blue Saw, we get a lot of DXF files from our customers, and some of the file sizes are just too big. Sometimes even simple designs can result in huge file sizes, making them inconvenient to store, e-mail, load into CAD programs or use to get a quote in our online quoting and ordering system. Let's look at problems that bloat file size and how we can slim down the files so that they're more managable.
First, keep in mind that there is a certain amount of overhead associated with the DXF file format. This overhead varies based on the DXF version used. The DXF format originated with AutoCAD, the granddaddy of all 2D CAD software. As AutoCAD added more features with each release, the file format changed. Versions of the DXF format are named based on the AutoCAD version where they were first introduced. Some popular versions include R12 (AutoCAD version 12), R15 (AutoCAD 2000, the 15th relase of AutoCAD), and R32, from the 32nd release of AutoCAD, AutoCAD 2018, the latest as of this writing. (All of this also applies to the DWG file format as well.) In general, the newer DXF formats have more overhead, meaning that the files eat up more storage.
Consider this simple 8 inch square, drawn in QCad. Let's see how the various DXF versions affect the size of the file when it's saved.
When saving as an R12 DXF in QCad, the file size is 17,392 bytes. Saving as an R27 DXF, though, balloons file file size up to 101,172 bytes, a 5.8x increase.
We have some custom tools that we use internally at Big Blue Saw to manipulate DXF files, and using those, we can strip the file down to a puny 469 bytes!
But that's not always the whole story. Take a look at the design below, again made with QCad. The internal holes are made using the spline tool.
QCad lets us save as both an R12 DXF and an R27 DXF. Here are the file sizes for both versions:
|| 176,226 bytes
|| 136,518 bytes
Unlike in the previous example, the R12 file is actually much larger.
Let's take a closer look at what's going on. If you zoom in on one of the irregularly shaped holes you can see that the spline has been turned into a series of small lines.
This is because R12 and earlier DXF versions do not support splines directly. So QCad, like many CAD tools, converts these splines into tiny lines in order to approximate the true shape. With all of these lines, the file size increased dramatically.
Again, at Big Blue Saw we have a tool we use internally which can turn both splines and curves made of many segments into smooth circular arcs which are compatible with the R12 DXF format. You can do this manually by drawing arcs on top of the shape in a new layer. After running this tool, the file size is only 61,851 bytes, less than half size of the R27 version with the splines. The image below gives you an idea of what the arc segments look in the updated file.
Another common source of file bloat comes from tracing bitmap (AKA raster) images to vector format. If we use an automatic tracing tool on the raster image below, we can produce a DXF file.
The DXF file that results from the trace is 15,752 bytes.
Again, if we zoom on the details in the design, we can see that it's made from hundreds of tiny segments.
Replacing those segments with smooth circular arcs brings the file size down by half.
The resulting file is just 7600 bytes.
There's one final source of file bloat I want to show you: unused blocks. Here's a file sent to us by a customer (slightly modified to protect the customer's design).
This simple design clocks in at a whopping 7.3 megabytes. It's not made up of a zillion tiny lines like in the previous examples, either, just a simple curve at the top and 3 line segments. So why is the file size so huge? Opening the file in QCad gives us the answer.
There are hundreds of unused blocks in this design. Fixing the file size is a matter of deleting the unused blocks or copying the visible design and pasting it into a new file. (A similar problem can occur with unused or invisible layers as well.)
This reduces our 7.3 megabyte behemoth to a much more managable 16,042 bytes.