Introduction

June 29, 2017
Steve DiBartolomeo
Applications Manager


While most users run ASM 500 from the user interface, there are occasions when a user needs to run it from a command line. ASM 500 was not designed to run in this fashion; the GUI does a lot of data prep and organization before it launches the conversion engine; however with sufficient preparation it can be accomplished.

In this article we are going to show how to run the ASM 500 engine, dxf2gbr.exe, with line linking turned on and de-embedding turned on.


The DXF File to Convert

We are working with a multi-layer DXF file of a small board used to mount 100 LED die chips. The manner in which the PCB was drawn requires that line linking is used (since not all regions were drawn using zero width closed polylines) and also de-embedding must be used to get a proper mask ouptut.

A zip file containing the .DXF, .bat, .rsp, .lst and .apt file can be downloaded to follow along with this tutorial.



Let's examine a single layer called CIRCUIT and see why we need linking and de-embedding.


You can see that we were able to highlight a single line that forms part of our area that should be filled. Since we don't have a complete closed polyline defining the area, we need to turn on linking so that that endpoints of the lines and arcs that comprise the boundary are linked together.




De-embedding Required

You will also notice that there are boundaries inside of boundaries - the designer's intent is that these regions are clear (i.e. a polarity reversal). In order to achieve that the ASM 500 engine must analyze all boundaries and determine which boundaries are embedded inside of larger boundaries.

The program then has to redraw the mask boundaries so that the polarity reversal is explicit.

This process we call de-embedding.




Layers to Process

PCBs are generally multi-layered. In this design we have the following layers which need to be converted into masks:

    COPPER BASE - the base or heat sink for the board

    DIELECTRIC LOWER - a dielectric layer insulating the base from the circuit

    CIRCUIT - a metallic layout that connects the LEDs correctly to power and ground

    DIELECTRIC UPPER - basically a solder mask on top of the circuit layer


Drawing Units?

AutoCAD's DXF File format does not contain a setting that indicates the units of the geometric dimensions. In order to produce a correct mask, the units have to be known and passed to ASM 500 by the user. In this example the units are in millimeters.



Ready to Start

Now that we know the layers we need to convert, the units of the data and the options we'll need for each layer, we can construct the required resource files and command line.


In addition to the command line, we'll need to create 3 separate text files.

    Response File - this contains the arguments for the dxf2gbr.exe engine.

    Aperture File - this contains the apertures and Gerber settings for the conversion

    List File - this contains a list of layers to process and the name of the output file to use


The Command Line

This should execute the DXF2GBR.EXE engine and pass it the response file as the first argument followed by a 0. (The zero is a window handle and must be present). It's recommended to use full path names and to quote the arguments with path and file names.

Example

"c:\wcad\asm500\dxf2gbr.exe" "@C:\example\convert.rsp" 0


The Response File

This file contains a single line with the arguments that control the behavior of DXF2GBR.EXE.

Example

The arguments are all on a single line but we show them separately in order to annotate each argument.


"C:\example\LED_PCB_100W.dxf"                   full path and file name of the DXF file to convert

MM                                              Units of the input/output data (INCH or MM)

0.001                                           resolution used for line linking

"@c:\example\convert.lst"                       use this list file to get the layer names to convert

1.0                                             scale factor

-deemb                                          turns on de-embedding behavior

-z                                              ????????

-lnk                                            link lines and arcs to form closed boundaries. If you do not
                                                want linking use -nlnk.

-t1                                             trace mode 1 -normally with this type of conversion we
                                                are not making use of trace mode.

-on11,12                                        turn outline on and alternate between d11 and d12 apertures.
                                                for data to be de-embedded this is standard.

-c:0                                            set compensation = 0 (compensation never worked that well, so
                                                best to insure it is not working by setting to 0.

"-cfg:c:\example\gerber.apt"                    read configuration and aperture data from gerber.apt



The Aperture File

This file contains the apertures defined in the Gerber data as well as some additional parameters.

Example


APTUNITS mm                    units for this aperture file
FORMAT 4.4                     Gerber data format
SUPPRESS LEADING               suppress leading zeros
ABSOLUTE on                    Gerber about coordinates will be absolute
SUPPRESS CR                    suppress carriage return in Gerber output
GBR_END M02                    use M02 at end of Gerber file

LINK on                        Turn Line Linking On
CIRCULAR OFF                   turn circular interpolation off - mandatory for de-embedding
TEXT D10                       use D10 to draw text
LINE d10                       use D10 to draw any "free" lines
MSCALE 1.0                     ?????
ARCRES 9                       Set Arc resolution to 9 degrees
ARCSAG 0.0                     Set ArcSag to 0 (disabled)
FONT C:\wcad\asm500\txt.shx    define a primary font file (for text)
FONTDIR C:\wcad\asm500\        define a font directory
REMOVE_DIM off
REMOVE_HATCH on                ignore hatching
DEEMB 1                        turns on de-embedding type 1 (no cut lines)

D10 0.1 d Round 0.1 0.1        a round aperture at D10 
D11 0.0 d Round POEX           a POEX (outline) aperture
D12 0.0 d Round POEX           a POEX (outline) aperture



The List File

This file contains one or more lines. Each line specifies a DXF layer name followed by the Gerber file name we wish to produce. Both should be quoted in case of spaces.

In our example, here is what our list file looks like:

"COPPER BASE"         "C:\example\COPPER_BASE.GBR"
"DIELECTRIC LOWER"    "C:\example\DIELECTRIC LOWER.GBR"
"CIRCUIT"             "C:\example\CIRCUIT.GBR"
"DIELECTRIC UPPER"    "C:\example\DIELECTRIC UPPER.GBR"


The Output

Now that all our resource files are created we can run the command:

"c:\wcad\asm500\dxf2gbr.exe" "@C:\example\convert.rsp" 0

The program will start up (a command window will open along with a small dialog box that shows the layers being processed) and the following files will be produced:

LED_PCB_100W.log        - a log file of the program run.
CIRCUIT.GBR             - the Gerber file for the layer CIRCUIT
COPPER_BASE.GBR         - the Gerber file for the layer COPPER_BASE
DIELECTRIC_LOWER.GBR    - the Gerber file for the layer DIELECTRIC_LOWER
DIELECTRIC_UPPER        - the Gerber file for the layer DIELECTRIC_UPPER

Converting from RS274D to RS274X

The direct output of dxf2gbr.exe is Gerber in the RS274D format. This is an older format that requires an associated aperture list. We really want to produce RS274X where all the Gerber file parameters are included in the header of the file.

We achieve this by using a small utility program called 274hdr.exe

"C:\WCAD\ASM500\274hdr.exe" "c:\example\CIRCUIT.GBR" "-cfg:c:\example\gerber.apt" -s:1.000
"C:\WCAD\ASM500\274hdr.exe" "c:\example\CIRCUIT.GBR" "-cfg:c:\example\gerber.apt" -s:1.000
"C:\WCAD\ASM500\274hdr.exe" "c:\example\CIRCUIT.GBR" "-cfg:c:\example\gerber.apt" -s:1.000
"C:\WCAD\ASM500\274hdr.exe" "c:\example\CIRCUIT.GBR" "-cfg:c:\example\gerber.apt" -s:1.000

This opens the specified Gerber file, reads the gerber.apt we created to find the Gerber parameters and apertures and then rewrites the file as a 274X one.

Before running 274hdr.exe

G75*
G54D10*
X645430Y384260D02*
X630430D01*
X600430Y334260D02*
X585430D01*
X600430Y534260D02*
X585430D01*
X555430Y334260D02*
X540430D01*
X555430Y534260D02*
X540430D01*
X510430Y334260D02*
X495430D01*
X510430Y534260D02*
X495430D01*
X465430Y334260D02*

After running 274hrd.exe

%IPPOS*%
%FSLAX44Y44*%
%MOMM*%
%ADD10C,0.001*%
%LNCIRCUIT*%
%LPD*%
G75*
G54D10*
X645430Y384260D02*
X630430D01*
X600430Y334260D02*
X585430D01*
X600430Y534260D02*
X585430D01*
X555430Y334260D02*
X540430D01*
X555430Y534260D02*
X540430D01*
X510430Y334260D02*
X495430D01*
X510430Y534260D02*
X495430D01*
X465430Y334260D02*

PAGE 2 - what the Gerber Files look like ...






ARTWORK CONVERSION SOFTWARE, INC.                  Company Profile
417 Ingalls St.,     Santa Cruz, CA 95060         Tel (831) 426-6163     Fax 426-2824               email: info@artwork.com