Chapter 4
DXF2MEN
|
DXF2MEN reads a DXF file and converts it into Mentor’s geometry ASCII file format. The data can then be imported into BoardStation or Fablink.
|
|
Command Line Syntax
DXF2MEN is a command line program. It also reads a configuration file that controls parameters such as layer mapping. If the same parameter can be put on both the command line and in the configuration file, the command line setting has precedence.
|
dxf2men input_file_name options
where
input_file DXF file to translate
options
[-mntr [filename]] Creates a Mentor geom_ascii output with output filename
either derived from the DXF file name input_file_name.asc
or forced to your desired filename if one is specified.
[-view] Force viewing. Creates a gdsx file and launches vu2d viewer.
The vu2d program must be present and activated. This option
is currently ont enabled but will be with the relaease of the
Motif version of VU2D.
[-noview] [default] Does not launch the vu2d program.
[-nohatch] Tells dxf2men to ignore any AutoCAD hatch blocks.
[-hatch] [default] Dxf2men converts each DXF hatch block into a
geometry. Warning - AutoCAD’s hatch is not intelligent
and can create very large files.
[-nodim] DXF2MEN ignores any dimension blocks (known by their
name *d1, *d2 etc...)
[-dim] [Default] Translate each DXF dim block into a geom.
[-lscan [file]] Tells dxf2men to scan the input file for the list of
layers. The layer list is written to the file with suffix
.lyr. This is useful for determining what layers are
defined in a DXF file.
-log filename Forces the log file to the specified name and location.
-cfg: filename Forces dxf2men to read the specified file instead of
defaulting to the name mentor.cfg in the current directory.
[-sscan [file]] Scan for text style info; put output in file[.stl].
[-ltscan [file]] Scan for linetype info; put output in file[.ltp].
[-cfg:file] Use file as the configuration file. If not specified
uses a file called mentor.cfg.
[-units <UnitType>] Where UnitType is one of inch, mil, m, cm, mm, um.
[default] inches. The DXF file has no units information
built into it so it is the designer’s responsibility
to specify the DXF units.
[-grid <value>] Default 0.001. You may wish to increase this value
for files drawn in inches. It is normally satisfactory
for DXF files in units of mm or mils.
Command Line Examples
men2dxf jumbo.dxf -units inch -grid 0.0001
This will translate jumbo.dxf to jumbo.asc assumes DXF is in units of inches and uses a grid resolution of 0.0001 inch.
men2dxf jumbo.dxf -mntr big.asc -units inches -grid 0.0001 -cfg:jumbo.cfg
This will translate jumbo.dxf to big.asc, assuming units of inches with a grid resolution of 0.0001 inch and will read the configuration file jumbo.cfg instead of the default file mentor.cfg.
The mentor.cfg Configuration File
If we were to require that all configurable parameters be read from the command line it would become extremely long. Instead, certain parameters are stored in an ASCII file called by default, mentor.cfg. The dxf2men translator reads this file and determines how to perform certain transformations on the data.
Where to locate mentor.cfg
The dxf2men program first searches the current working directory. If it does not find mentor.cfg there it then searches the exec directory (directory where the dxf2men program was installed.)
Overriding the default name mentor.cfg
If you like, you can use the command line switch -cfg filename to specify a filename other than mentor.cfg to contain your configuration information. This option might be useful if you have several different configurations prepared or if you are running dxf2men from another program and want to be sure where the configuration file is read from.
|
Contents of mentor.cfg
Basic Syntax
parameter
data
data
data
where
parameter - the parameter to be controlled.should be typed in upper
case characters starting in column 1 of the file.
data - arguments or data for the parameter. If a parameter takes
multiple arguments they are each on their own line. A blank line
indicates end of data.
# the pound sign in column 1 indicates a comment
|
Sample Annotated mentor.cfg
# layer mapping AutoCAD to Boardstation
# If a layer is mapped to null it is not translated
# multiple AutoCAD layers can be mapped to a single
# geom layer if so desired.
LAYER
0 zero
SILK SILKSCREEN_1
COMP SIGNAL_1
SOLD SIGNAL_2
PADM PAD
TARGET PAD
DEFPOINTS NULL
DIMS NULL
# The TSTYLE parameter
# maps DXF text fonts (shx) to Boardstation font names
TSTYLE
txt.shx std
simplex.shx std
# units/grid of the AutoCAD file. AutoCAD has no built in units
# so the user should supply them or program will assume inch.
# inch, mil, um, cm, mm
# first data is the inverse of the grid i.e. 0.001 inch = 1000
ACADUNITS
1000
INCH
# units/grid for the geom_file. These need not be the same as the
# autocad units.
MENTORUNITS
1000
INCH
# Autoscale - Automatically scales data to account for difference
# in units. autoscale reads the two units and applies the approriate
# scale factor
AUTOSCALE
YES
# scale - apply a scale factor in addition to the autoscale. This
# scale factor is multipled time autoscale if on.
SCALE_FACTOR
1
# hatch filter
# tells dxf2men not to translate hatch blocks
# default is NO
REMOVE_HATCH
YES
# dimension filter
# tells dxf2men not to translate dimensions
# default is NO
REMOVE_DIM
YES
# CLIP_EXTENTS sets clipping window on data translated
# from dxf to mentor. Data far out of range
# may cause Boardstation to crash while importing
# the geom file.Clipping is applied on the input
# data in input user units.
CLIP_EXTENTS
0,0,24,36
# min_line_width - this parameter sets the minimum
# line width. Many AutoCAD entities have no width -
# lines, arcs, text, circles. When these are translated
# to geom they also have zero width. This may be undesireable-
# so you can set a minimum line width (in input_file units
# before scaling
MIN_LINE_WIDTH
0.002
# arcres
# arcresolution used if polyline arcs need to be fractured.
# default is 9 degrees. Valid range 0.5 to 15 degrees.
ARCRES
9
# arcsag
# max error between arc and approximation. default=0 (don’t
# calculate). Other values are in input file user units.
# use this parameter when fracturing very large radius arcs.
ARCSAG
0
# path control - determines how autocad plines with constant
# width are translated. TRACE - Mapped to path with same width.
# outline - converted to a $$ polygon
PATH
TRACE
|
DXF to Mentor Translation Mapping
DXF Entity geom_ascii Comment
lines $$path User should set deault width
linetype linetype attribute
arc $$arc
circle $$circle User should set default width
donut $$circle Donut is recognized and inner/outer
diameter is converted to circle width
polyline with width $$path If width varies converted to polygon
zero width $$polygon If the zero width closed polyline
closed polyline includes arcs, they are fractured
using the arcres/arcsag parameter
since polygon in geom doesn’t support
arcs in the boundary.
solid $$polygon
text $$text Supports height, width factor, rotation
mirroring and font
dimension $$add_generic_part Cannot be easily translated into
$$add_dim because info is lost.
Built from lines/arcs/text and grouped
into a part.
layer $$layer User defined layer mapping table
block $$create_generic_part All AutoCAD blocks become generic_parts
in BoardStation’s geom file.
block insertion $$add_generic_part Rotation,scaling, mirroring is
supported. If a block is rotated at
an illegal angle or illegal scale
for geom, it is exploded by the
translator.
|
Example: Importing a Microwave Case
A typical reason to import DXF data into Boardstation is to avoid the need to manually draw a complex board outline. High frequency circuits often have fixed connector locations and the package layout is normally constrained by the need to shield various circuit modules from each other and from the outside enviornment. The example shown below, mwcase.dxf, would require several hours to enter into boardstation - if the PCB designer took the measurements manually from a print.
Determining the Layers in a DXF File
You can get dxf2men to show you a list of layers defined in
the DXF file. (Of course, if you have the Ample GUI this is
done automatically.) Use the -lscan command line option to
create a file that contains the list of layer names:
$ dxf2men mwcase.dxf -lscan mwcase.lyr
$ cat mwcase.lyr
35 mm
#
# Colors
#
0:1
1:6
2:6
3:1
4:7
63:1
#
# Layers
#
0:0
1:DIMENSIONS
2:MTG_HOLE
3:CASE
4:BOARD_OUTLINE
#
# Parts
#
mwcase
|
Creating the Configuration File
Use the mentor.cfg provided to create a mwcase.cfg file.
Here are typical values:
LAYER
0 zero
DIMENSIONS dimension
MTG_HOLE drawing_1
CASE drawing_1
BOARD_OUTLINE drawing_1
TSTYLE
txt.shx std
simplex.shx std
romans.shx std
ACADUNITS
1000
INCH
MENTORUNITS
1000
INCH
AUTOSCALE
YES
SCALE
1
REMOVE_HATCH
YES
REMOVE_DIM
NO
CLIP_EXTENTS
0,0,32,22
MIN_LINE_WIDTH
0.005
ARCRES
9
TEXT_WEIGHT
0.005
ARCSAG
0
PATH
TRACE
Run the Translator
Now that you've prepared a valid configuration file, create a geometry file.
dxfwmen mwcase.dxf -mnt mwcase.asc -cfg:mwcase.cfg
Your done!
Top -
MEN2DXF Home Page
|