Guide to Using DWG and Other Formats
Guide to Using DWG and Other Formats
Guide to Using DWG and Other Formats
|
When you save a file to a different format, the file's contents may need to match specific design requirements. Often, these requirements specify element attributes such as levels, symbology, fonts, or cell names. The Remap capability lets you explicitly map element attributes to different values when you save the file to a different format. Remapping is available when you save the file with the Batch Converter or File > Save As.
Remapping can be used for several purposes:
File format conversion. Since V8 files support more levels, longer cell names, and more font options than V7 files, you must use remapping, when saving a V8 file to a V7 (MicroStation/J) file. Similarly, MicroStation V8 supports more sophisticated line styles than AutoCAD, so some remapping may be needed when saving V8 DGN files to DWG.
Drawing standards enforcement. When V7, V8, or DWG files are initially received from an outside organization, or when files are to be provided to another organization, there is often a need to change the levels or symbology of elements in the design file.
Bulk processing. The Batch Converter lets you set up a batch job that you can use repeatedly. Using remapping with the Batch Converter lets you quickly consolidate levels, change fonts, and change cell names.
A remapping table is used to specify the remapping of element attribute values in one file format (for example, DGN) to values in another file format. This table is saved as a CSV (comma separated value) file that is created by a macro embedded in a spreadsheet application.
You can create and edit the CSV file from the Remap tab on the Save As Options dialog box. The remapping operation is applied to the elements just before saving them to the new output format specified by the Batch Converter utility or File >Save As.
A few other remap operations are sometimes applied while files are read into MicroStation. For example, when V7 files are read into the current MicroStation version, the read operation applies the level mapping specified by the CSV file pointed to by the MS_V7TOV8_CSVNAME configuration variable. Similarly, when files in AutoCAD 2002 or later DWG or DXF format are read into the current MicroStation version, the software remaps the AutoCAD line weights into MicroStation element line weights. These remappings are not controlled by this remapping table, which applies only when files are being saved. |
The text box on each worksheet contains information about entering data. See also Understanding the Remapping CSV Format. |
To modify the CSV file, click Edit CSV Remapping File. |
When you use the Create CSV Remapping File icon, MicroStation copies the Microsoft Excel spreadsheet "remaptemplate.xls" file to the file root name you specify, with the extension .XLS. The actual remapping CSV (comma separated value) file is created by a macro embedded in the spreadsheet. When you save the spreadsheet, the macro automatically creates the CSV file in the same directory as the spreadsheet file, with the same root file name but with the extension .CSV. For the CSV file creation to work, the macros must be enabled in the spreadsheet. Make sure that the Macro Virus Protection check box is off (in Excel, pick Tools > Options, General tab), or click on Enable Macros in the dialog box that appears when the file is opened.
The remapping spreadsheet contains several worksheets that let you build the remapping table in the CSV file. Most worksheets in the spreadsheet correspond to different mapping options: Levels, Colors, Weights, Line Styles, Fonts, and Cell Names. The Instructions worksheet provides help for using the spreadsheet. The System worksheet is used by the macro; you should not edit it.
The same remapping file can be used for saving files in V7 format, AutoCAD DWG or DXF format, or MicroStation V8 format. Therefore, you can create a single mapping table that can be used for a particular project regardless of the type of output files desired.
On some systems, you may need to use the File > Save and File > Close commands before you can exit Excel (File > Exit). This problem is caused by a timing issue with the way macros are executed when exiting Excel. The symptom of this problem is that the CSV file that you created has a size of 0 bytes. If you experience this, go back into the spreadsheet, change something, then save the spreadsheet before exiting. |
The basic remapping operation lets you change an element parameter to another value in the output file. However, in some situations you might not want every element with a given source value changed to the same target value. For example, you may want to move all text on Level 23 to the Annotation level, but leave the lines on Level 23 alone. You might want to change only the elements with weight 7 from color 3 to color 4, or you might want to change all elements with weight other than 2 from color 3 to color 4.
In the remapping spreadsheet, each mapping table (worksheet) has a required column (primary key) for the element parameter that is being changed. In addition, most mapping tables have optional columns for the other parameters that can be used to qualify elements that match the primary key. For example, in the Levels mapping table, the required primary key column is Level, and the optional qualifier columns are Color, Weight, LineStyle, Class, ElementType, and Cell. Similarly, for Font remapping, there are five qualifiers: Level, Color, Weight, Class, and Cell. The optional qualifier columns are hidden unless the Show Optional Columns setting is turned on.
Following are some guidelines for using the qualifier columns in the mapping tables:
If a row contains an entry in any of the qualifier columns, then the element parameter must match that entry or it will not be remapped.
There can be only one entry in a qualifier for each row. The spreadsheet can have as many rows as needed, with all entries the same except for a particular qualifier. For example, to change the color of all weight 5 and weight 7 elements from color 3 to color 4, use two rows: one with weight qualifier 5, and one with weight qualifier 7.
Color |
Weight |
DWGOutput Color |
---|---|---|
3 |
5 |
4 |
3 |
7 |
4 |
If a row contains an entry that starts with the character ~, then the element parameter must not match the remainder of that entry or it will not be remapped. For example, to change the color of all weight 7 elements with color 3 to color 4, the Weight column would have the entry 7. To change all elements with a weight other than 2 from color 3 to color 4, the Weight column would have the entry ~2.
If the Level qualifier is specified as %match in the Color, Weight, or LineStyle mapping tables, then the source parameter is set to the output parameter only if it matches the corresponding ByLevel attribute of the element's level. This is most useful for setting symbology to ByLevel. For example, assume that the Color Mapping Table includes the values below.
Color |
Level |
V8OutputColor |
---|---|---|
2 |
%match |
%bylevel |
In this case, all Color 2 elements that are on the levels that have 2 for their ByLevel color will have their colors set to ByLevel when saving to a V8 file.
For a second example, assume that the Color Mapping Table includes the values below.
Color |
Level |
V8OutputColor |
---|---|---|
%unmapped |
%match |
%bylevel |
In this example, remapping takes every element for which the color matches its level's ByLevel color, and changes its color to ByLevel. The same principles apply for the Weight and LineStyle Mapping tables. See Color Section for more details on how %unmapped and %bylevel affect the column values.
If the value in the Color, Weight, or LineStyle qualifier column is enclosed in square brackets, remapping interprets it as an effective value. For example, if the value in the Color qualifier column is [2], then the remapping applies if either the element color is 2, or the element has its color set to ByLevel, and the ByLevel color of its level is set to 2.
The Class column can either contain integer class values, or the entries Primary, Construction, or Dimension, which are class values of 0, 2, and 3, respectively.
To determine the appropriate values for the ElementType column, select an element of the type that you want to remap, and use the Element Information tool in MicroStation. The appropriate integer value appears to the right of the type name in the tree view in the left hand pane. For example, the type of Line elements is 3.
The Cell column can be used to specify that the remapping applies only to elements that are components of cells with names matching the entry in the column. The Cell column entry can contain the asterisk character, *, which matches any zero or more characters in that position, or a question mark character ? to match any one character in that position. For example, if the Cell column contains bac*, then the remapping row applies only to elements that are components of a cell with a name that starts with bac. The cell name matching algorithm is not case sensitive.
Generally, the macro provided in the spreadsheet takes care of creating the remapping CSV file from the information that you provide. However, if you do not have Microsoft Excel, you can still create a remapping CSV file using the information provided in this section.
The sections in the remapping CSV file are delimited by lines that start with %section as the first column, followed by the section name in the next column. The case of section and the section name are not important. For example the line: %section,Levels marks the start of the Levels section. The end of a section is either the start of the next section or the end of the file. The first line after the start of a section must have the column names, separated by commas. The column names required in a section are defined in the descriptions of each section below.
The Levels section of the CSV file starts with the line:
%section, Levels
It contains the following columns:
Column |
Contents |
---|---|
Level |
The name or number of the source level to remap. The icon in the Level column provides an easy way to populate that column with the levels that are in the current MicroStation file. When you click on that icon, an Excel macro contacts MicroStation, retrieves the current levels, and inserts those that are not already in the table at the top of the table. MicroStation must be running and have an active design file for this operation to succeed. To specify a level number, use the % character before the number. For example, enter %12 to specify level 12. Note: Some versions of Excel immediately change entries of the form %n to n%. If this happens, enter %%n (for example, %%12) instead. You can see the level numbers in the Number column of the Level Display and Level Manager dialog boxes. Level numbers are most useful when converting V7 files where they correspond directly to the traditional 1-63 levels. |
Color Weight LineStyle Class ElementType Cell |
Optional. Qualifiers that refine the elements for which the remapping is performed. |
V7OutputLevel |
The number of the level when saved to a V7 file. |
V8OutputLevel |
The name of the level when saved to a V8 file. |
DWGOutputLayer |
The name of the layer when saved to a DWG or DXF file. |
Required |
If the value in this column is 1, then the output level is always created in the output file, even if there are no elements on it. |
Description |
The level description. |
Number |
The level number. |
OverrideColor |
The level symbology override color for this level. |
OverrideWeight |
The level symbology override weight for this level. |
OverrideStyle |
The level symbology override line style for this level. |
OverrideStyleScale |
The scale for the OverrideStyle for this level. |
OverrideStyleOriginWidth |
The starting width of the OverrideStyle for this level. |
OverrideStyleEndWidth |
The ending width of the OverrideStyle for this level. |
ByLevelColor |
The ByLevel color for this level. |
ByLevelWeight |
The ByLevel weight for this level. |
ByLevelStyle |
The ByLevel line style for this level. |
ByLevelStyleScale |
The scale for the ByLevelStyle for this level. |
ByLevelStyleOriginWidth |
The starting width of the ByLevelStyle for this level. |
ByLevelStyleEndWidth |
The ending width of the ByLevelStyle for this level. |
ElementAccess |
If the value of this column is 1, disallows modification of elements on this level. |
GlobalDisplay |
The global display flag for this level. |
Plot |
The plot flag for this level. |
The Level section has the following characteristics:
For each element, MicroStation finds the entry in the level map that matches that level, and uses the output level in V7OutputLevel, V8OutputLevel, or DWGOutputLayer, depending on the target format. If an elementīs level does not appear in the Level column, the level is unchanged, except if the target format is V7.
When saving to V7, if the level is not found, the level number is used. If that level number is greater than 63, the level is assigned to level number modulo 63. For example, an element on level number 140 would be assigned to level 14 in the V7 output file. (To calculate this, divide 140 by 63. The remainder (14) is used for the level number.)
If the Destination column corresponding to the target of a Save As operation is missing, or that column does not have an entry for a particular row, the default mapping described above applies. Similarly, if there is no Level column or no Level remapping section, the default mapping is applied for the whole file.
The elements for which the remapping in a particular row applies can be qualified using the optional Color, Weight, LineStyle, Class, ElementType, and Cell columns (see Using remapping qualifiers). While editing the remapping spreadsheet, those columns are displayed when Show Optional Columns is turned on. To distinguish them from the required columns, they are shown with a different background color.
The columns that are shaded grey control the properties of the levels specified as output levels in the V8OutputLevel and DWGOutputLayer columns. They have no effect when saving to V7 format.
The 17 rightmost columns are the columns created when doing exporting a level table from the Level Manager. You could use the Level Manager to create the desired levels, export using Level Manager, and then cut and paste the information from that spreadsheet.
The Colors section of the CSV file starts with the line:
%section,Colors
It contains the following columns:
Column |
Contents |
---|---|
Color |
The color to remap. |
Level Weight LineStyle Class ElementType Cell |
Optional. Qualifiers that refine the elements for which the remapping is performed. |
V7OutputColor |
The color when saved to a V7 file. |
V8OutputColor |
The color when saved to a V8 file. |
DWGOutputColor |
The color when saved to a DWG or DXF file. |
The Colors section has the following characteristics:
When MicroStation saves files to DWG format, by default it maps the color indices in the DGN color table to the closest color in the (fixed) AutoCAD color table. If the DWGOutputColor entry is a color in the fileīs color table, you can enter the number of the color in the DWGOutputColor column. If a fixed index in the AutoCAD color table is desired (for instance, if you do not want the color matching to be applied), enter the AutoCAD color number with the suffix ac, as in the following example:
%SECTION,Colors %SECTION,Colors
Color,DWGOutputColor
14,62ac
If the value in the Color column is enclosed in square brackets, it is interpreted as effective color. For example, if the value in the Color column is [2], then the remapping applies if either the element color is 2, or the element has its color set to ByLevel, and the ByLevel color of its level is set to 2.
If the keyword %unmapped appears in the Color column, then every element with a color that does not otherwise appear in the Color column is mapped to the destination specified in the %unmapped row. If there is more than one %unmapped row in the section with the same values for the qualifiers columns, the last one is used.
If the keyword %bylevel appears in the V8OutputColor or DwgOutputColor column, then every element that has the color indicated is changed to be ByLevel. The V7 file format does not support ByLevel, so that keyword is invalid in the V7OutputColor column.
The elements for which the remapping in a particular row applies can be qualified using the optional Level, Weight, LineStyle, Class, ElementType, and Cell columns (see Using remapping qualifiers). While editing the remapping spreadsheet, those columns are displayed when the Show Optional Columns check box is checked. To distinguish them from the required columns, they are shown with a different background color.
The line Weights section of the CSV file starts with the line:
%section,Weights
It contains the following columns:
Column |
Contents |
---|---|
Weight |
The line weight to remap. |
Level Color LineStyle Class ElementType Cell |
Optional. Qualifiers that refine the elements for which the remapping is performed. |
V7OutputWeight |
The line weight when saved to V7 file. |
V8OutputWeight |
The line weight when saved to V8 file. |
DWGOutputWeight |
The line weight when saved to DWG or DXF file. |
The Weights section has the following characteristics:
If the value in the Weight column is enclosed in square brackets, it is interpreted as effective weight. For example, if the value in the Weight column is [4], then the remapping applies if either the element weight is 4, or the element has its weight set to ByLevel, and the ByLevel weight of its level is set to 4.
If the keyword %unmapped appears in the Weight column, then every element that has a weight that does not otherwise appear in the Weight column is mapped to the destination specified in the %unmapped row. If there is more than one %unmapped row in the section with the same values for the qualifier columns, the last one is used.
If the keyword %bylevel appears in the V8OutputWeight or DwgOutputWeight column, then every element that has the weight indicated is changed to be ByLevel. The V7 file format does not support ByLevel, so that keyword is invalid in the V7OutputWeight column.
Prior to AutoCAD 2000, the DWG format did not have a way to store line weights. Some users established plotting line weights by setting element colors based on their desired line weights. If the output format is DWG or DXF, either a DWGOutputWeight or a DWGOutputColor column, (or both) can be included. The remapping operation will set the output line color based on the source weight if the DWGOutputColor is present; it will set the output line weight based on the source weight if the DWGOutputWeight column is present and the DWG version selected supports line weight. If a DWGOutputColor column is included in the weight mapping section, make sure that there is no DWGOutputColor column in the color mapping section, or the results are unpredictable.
When the target is AutoCAD 2000 or later, you can map directly to AutoCAD line weights rather than through MicroStationīs default linear formula for setting AutoCAD line weights from MicroStation line weights, by entering values in the DWGOutputWeight in mm. For example:
%SECTION,Weights
Weight,DWGOutputWeight
1,0.15mm
The mm is required whenever the value should be interpreted as mm rather than pixels.
The elements for which the remapping in a particular row applies can be qualified using the optional Level, Color, Style, Class, ElementType, and Cell columns (see Using remapping qualifiers). While editing the remapping spreadsheet, those columns are displayed when the Show Optional Columns check box is checked. To distinguish them from the required columns, they are shown with a different background color.
The LineStyles section of the CSV file starts with the line:
%section,LineStyles
It contains the following columns:
Column |
Contents |
---|---|
LineStyle |
The name or number of the source line style to remap. |
Level Color Weight Class ElementType Cell |
Optional. Qualifiers that refine the elements for which the remapping is performed. |
V7OutputLineStyle |
The name or number of the line style when saved to a V7 file. |
V7OutputScale |
The scale factor for the line style when saved to a V7 file. If the entry is blank, 1.0 is used. |
V8OutputLineStyle |
The name or number of the line style when saved to a V8 file. |
V8OutputScale |
The scale factor for the line style when saved to a V8 file. If the entry is blank, 1.0 is used. |
DWGOutputLineStyle |
The name of the line style when saved to a DWG or DXF file. |
DWGOutputScale |
The scale factor for the line style when saved to a DWG file. If the entry is blank, 1.0 is used. |
DWGOutputLineStyleFile |
If the output line style is defined in an AutoCAD line style file, this entry is the “.lin” file that contains the line style. The default is “acad.lin.” MicroStation attempts to find the file in the “support” directory of an AutoCAD installation on the system, or you can specify a full file path. |
The LineStyles section has the following characteristics:
If the value in the LineStyle column is enclosed in square brackets, it is interpreted as effective line style. For example, if the value in the LineStyle column is [3], then the remapping applies if either the element line style is 3, or the element has its line style set to ByLevel, and the ByLevel line style of its level is set to 3.
The keyword %drop can appear in any of the OutputLineStyle columns. When it does, any element with the corresponding LineStyle is drawn as multiple elements that represent the appearance of the source element. This does not apply to predefined line styles 0 through 7.
If the keyword %unmapped appears in the LineStyle column, then every element that has a line style that does not otherwise appear in the LineStyle column is mapped to the destination specified in the %unmapped row. If there is more than one %unmapped row in the section, the last one is used.
If the keyword %bylevel appears in the V8OutputLineStyle or DwgOutputLineStyle column, then every element that has the line style indicated is changed to ByLevel. The V7 file format does not support ByLevel, so that keyword is invalid in the V7OutputColor column.
The elements for which the remapping in a particular row applies can be qualified using the optional Level, Color, Weight, Class, ElementType, and Cell columns (see Using remapping qualifiers). While editing the remapping spreadsheet, those columns are displayed when the Show Optional Columns check box is checked. To distinguish them from the required columns, they are shown with a different background color.
The Fonts section of the CSV file starts with the line:
%section,Fonts
It contains the following columns:
Column |
Contents |
---|---|
Font |
The name or number of the source font to remap. The icon in the Font column provides an easy way to populate that column with the Fonts that are available in MicroStation. When you click on that icon, an Excel macro contacts MicroStation, retrieves the current fonts and inserts those that are not already in the table at the top of the table. MicroStation must be running and have an active design file for this operation to succeed. |
Level Color Weight Class ElementType Cell |
Optional. Qualifiers that refine the elements for which the remapping is performed. |
FontType |
The font type. This column can be blank, or contain one of the values USTN, SHX or TT for MicroStation, AutoCAD SHX, or true type fonts, respectively. If the entry is blank for a particular row, the remapper finds the first font with the name specified in the Font column. If there is more than one font with the same name but different type (for example, a Courier true type font and a Courier SHX font) then two rows are required in the table to map them both. |
V7OutputFont |
The name or number of the font when saved to a V7 file. The destination font must be a USTN font. Otherwise text elements with the Font will not be remapped if the source font is a USTN font, or will be mapped to Font 0 if the source font is a true type or SHX font. |
V8OutputFont |
The name of the font when saved to a V8 file. |
V8OutputFontType |
The type of the font. This can be blank, or one of the values USTN, SHX, or TT. If left blank, the remapper finds the first font with the name specified. |
DWGOutputFont |
The name of the font when saved to DWG or DXF file. |
DWGOutputFontType |
This must be one of the values SHX orTT. |
OutputWidthFactor |
If this column is not blank, then the width of every remapped text or tag element is multiplied by the factor specified. The factor must be greater than 0. |
OutputHeightFactor |
If this column is not blank, then the height of every remapped text or tag element is multiplied by the factor specified. The factor must be greater than 0. |
Cell names can be remapped only when saving to the MicroStation V7 format. This is needed because prior to V8, MicroStation had a six-character limit for cell names. The Cell Names section of the CSV file starts with the line
%section,CellNames
It contains the following columns:
Column |
Contents |
---|---|
CellName |
The cell name to remap. |
V7OutputCellName |
The cell name when saved to a V7 file. The names in the V7OutputCellName column must be no longer than six characters, and can contain only the letters A through Z, the numerals 0 through 9, and the characters ., $, _. |