Guide to Using DWG and Other Formats
Guide to Using DWG and Other Formats
Guide to Using DWG and Other Formats

Remapping Data to Other File 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:

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.

To create a remapping CSV file
  1. From the File menu, chooseSave As.

  2. From the Select Format to Save option menu, choose the file format type.

  3. Click the Options button.
    Depending on the file type that you chose, one of the following dialog boxes appears:
    Save As V8 Options
    Save As V7 Options
    Save As DWG/DXF Options

  4. In the Options dialog, select the Remap tab.

  5. Click the Create CSV remapping file icon.
    The remapping file opens as a Microsoft Excel spreadsheet. The spreadsheet contains a worksheet for each type of parameter that can be remapped: levels, colors, weights, line styles, fonts, and cell names. Each of these worksheets corresponds to a section in the CSV file. There is also an Instructions worksheet which contains the most current information on using the spreadsheet.

  6. Select the tab for the appropriate worksheet (for example, Colors).

  7. In the first column of the worksheet (for example, Color), enter the value to be remapped.

  8. In the same row, enter the new value in the appropriate output column (for example, V7OutputColor).

    The text box on each worksheet contains information about entering data. See also Understanding the Remapping CSV Format.


  9. From the spreadsheet File menu, choose Save, then choose Exit.
    The Options dialog box appears.

  10. Turn on the sections in the CSV file to use. For example, to use the Colors remapping defined in the CSV file, turn on Apply Colors.

  11. To close the Save As Options dialog box, click OK.

  12. To close the Save As dialog box, click OK.

To use a remapping CSV file when saving to another format
  1. From the File menu, chooseSave As.

  2. From the Select Format to Save option menu, choose the file format type.

  3. Click the Options button.
    Depending on the file type that you chose, one of the following dialog boxes appears:
    Save As V8 Options
    Save As V7 Options
    Save As DWG/DXF Options

  4. In the Save As Options dialog box, select the Remap tab.

  5. Click Browse for Remapping CSV file, and choose the remapping file to use.

    To modify the CSV file, click Edit CSV Remapping File.


  6. Each option on the Remap tab corresponds to a section of the CSV remapping file. Turn on the remapping options that you want to apply when the DGN file is saved.

  7. To close the Save As Options dialog box, click OK.

  8. To close the Save As dialog box, click OK.

Using the remapping spreadsheet

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.

Using remapping qualifiers

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:

Understanding the remapping CSV format

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.

Levels Section

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:

Colors Section

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:

Weights Section

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:

LineStyles Section

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:

Fonts Section

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 Name Mapping Table

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 ., $, _.