Field Precision title

2D mesh generation with DXF import

Most people who want information on Mesh ask about the transfer of information from 2D CAD programs. We support import through DXF (Drawing Exchange Format) files. We picked DXF for three reasons: 1) the format is relatively neutral and supported by all CAD programs, 2) information is recorded as text and 3) there is a moderate amount of documentation available on the Internet. That said, DXF is one of the worst file formats ever created. Over the years new features were simply tacked on, so a file is a rat's nest of badly organized information. If you don't believe this, open a file in a text editor and take a look.

Mesh does well at wading through the superfluous information in DXF files to pick out points, lines and arcs. Nonetheless, it would be impossible for the program to take a typical DXF drawing and recognize the relevant information without some help from you. In a recent consulting job, I had to start from a complex AutoCAD assembly drawing to model an accelerator cavity. With the memory fresh in my mind, I thought it would be useful to share the experience.

The induction cavity drawing contained a wealth of information (magnetic coils, leads, electrodes, bolt holes, labels, spacers, power leads...). First, I did a general cleanup, eliminating items like dimensions and cross-hatching. I also applied a translation to all remaining vectors so that the axis of the cylindrical structure was at r = 0.0" and set the point z = 0.0 at the center of the acceleration gap.

To track particle orbits, I would need solutions for both the accelerating electric field and the focusing magnetic field. Therefore, I made two copies of the clean drawing. The electric field model involved only a small subset of the solution volume near the acceleration gap, so I could erase most of the vectors. I eliminated remaining vectors that did not lie on the surface of the upstream and downstream electrodes or the vacuum insulator. The upstream electrode had some tiny indentations. I eliminated the internal vectors and connected the surface with lines. I took care to use the endpoint snap mode so that that new vectors connected exactly with the ends of the old ones. Without this precaution, Mesh might not be able to identify a closed set of vectors to define a filled region. The insulator had some annoying features (such as a thin layer of epoxy where it was glued to the electrode) that I removed. I also found that one of the components of a polyline was a spline. I replaced it with an arc. The end result was a simple drawing with a minimal set of vectors along the critical surfaces. I eliminated and trimmed vectors in the magnetic drawing, leaving boxes that represented the cross sections of induction cores and drive coils. There was also a shaped ferrite in the acceleration region to damp beam-induced transverse modes.

I will use the electric field model to illustrate the translation task. I ran the program, clicked on command Create script/DXF import and chose the electric-field drawing. If I had prepared the drawing perfectly, the displayed set of vectors would replicate the drawing. When there are small errors, it is easy to fixed them within the drawing editor. The initial vectors were shown in gray because they were loaded into the Layout region. I had to copy them to active regions to appear in the Mesh file. The first step was to draw a rectangle that included the entire volume. The four vectors were placed in Region 1 by default. In the EStat solution, this region was associated with vacuum. Next I clicked on Insert/Start next region. Region 2 represented transformer oil. (When setting up an electrostatic solution, remember that you should always add dielectric regions first and electrodes last.) To create the oil region, I use Select and Deselect commands to highlight the set of vectors along the outline. I then used Copy selection and Transfer selection to current region to replicate the vectors in Region 2. I then used the Settings/Region properties command to call up a dialog. I assigned the name XFORMOIL to Region 2 and checked the Filled box. Because the oil and insulator share a boundary, I locked Region 2 and made it invisible. I then applied the same sequence of operations to define the insulator as Region 3. Finally, I added the electrodes. To conclude, I checked the validity of filled regions with the Toggle fill display command and set approximate element sizes in the Foundation menu.

Of course the operations did not go as smoothly as the previous paragraphs imply, but the new organization of Mesh drawing editor helps considerably and I feel that the process will be easy the next time I do it.

LINKS