# Exporting 2D graphics to DXF

I have a design that I've produced in Mathematica, consisting of two sets of Rectangle objects. The second set is a mirror image of the first and was produced with array2 = Scale[#, -1, {0, 0}] & /@ array1.

I'm experiencing two issues when I Export the Graphics object to DXF:

1. The second set of Rectangles doesn't get exported.
2. Each Rectangle gets exported as a pair of triangles.

Mathematica's Graphics output:

Importing the DXF file back into Mathematica also shows that the bottom half is missing. I'm at a loss here - what am I doing wrong? Are either of these weird behaviours deliberate?

Edit: Here is a snippet of my code. It generates the design for a surface acoustic wave resonator. This consists of two transducers next to two gratings, each made up of metal strips, separated by a certain number of wavelengths.

l = 2; (* wavelength in \[Mu]m *)

d = 25.5; (* cavity length in wavelengths *)
(* NB this is the distance between the fronts of the transducers *)
vRatio = 1; (* how much faster the speed of sound is in the centre \
section *)

nTransducer = 25; (* number of finger pairs in the transducers *)
nGrating = 370; (* number of fingers in the grating *)
(* NB 2 fingers == 1 wavelength *)

fingerLength = 25; (* finger length in wavelengths *)
(* NB finger length is measured from inside edge of the bus-bar *)

SetDirectory[NotebookDirectory[]];
filePath = "2um.dxf";

fingersT = Table[
Rectangle[
{-(fingerLength/2 - 1/2) l, y},
{(fingerLength/2 - 1/2) l, y + l/4}],
{y, (d*vRatio/2) l, (d*vRatio/2 + nTransducer -
1/2) l, l/2}];

(* -- the rest of the transducer is produced in a similar way -- *)

transducer =
Join[fingersT, lSquaresTOut, rSquaresTOut, lSquaresTIn,
rSquaresTIn] ~Append~ lBarT ~Append~ rBarT;

(* -- a grating is produced above the transducer in the same fashion -- *)

(* This line originally read: array1 = transducer ~Join~ grating; *)
array1 = fingersT;
array2 = Scale[#, -1, {0, 0}] & /@ array1;

diagram = Graphics[array1 ~Join~ array2]
Export[filePath, diagram, "DXF"];

-
Apologies, the annotation should read 'Second array (inversion of first)'. Same thing really. – Benjamin Hodgson Feb 12 '13 at 11:46
Exporting to a different format, such as JPG or SVG, seems to work correctly. – Benjamin Hodgson Feb 12 '13 at 11:48
If you post the actual code used to generate and export then working on this will be so much easier. Otherwise, it´s just guesswork (which I consider a waste of time). – Yves Klett Feb 12 '13 at 11:54
@YvesKlett. Sorry. I didn't want to post the whole thing because it's quite long and not terribly interesting - there are a lot of Rectangles to generate. I'll update the question with an abbreviated version of what I have. – Benjamin Hodgson Feb 12 '13 at 12:01
Excellent (please include the Export part) - what I can tell you right away is that polygons will be triangulated by Export as DXF. – Yves Klett Feb 12 '13 at 12:04

Smells like a bug to me (check e.g. Export to PDF, which works). Scale is only evaluated when rendered... anyway, this works for me (without changing the triangulation thing):
array1 = fingersT;

As for the triangulation, not much you can do in DXF. Perhaps use PDF or EPS and import that (or try other available Export vector formats. Or export Line primitives and convert those in AutoCAD to a polygon. Alternatively, roll your own DXF export, which may or may not be overkill.