Document Type: TechNote Legacy Document Number: 8240
Document Type: TechNote
Legacy Document Number: 8240
DWG line styles are a subset of MicroStation line styles. Because of this disparity, there are a number of features in MicroStation line styles that do not translate directly to DWG. Some features are lost in the translation, while other line styles will not translate at all.
To get a better understanding, consider an AutoCAD line style specification in a .LIN file. A .LIN file is what in used in AutoCAD to import a line style definition; these files can also be used in MicroStation by choosing File > Import in the line style editor. There are 2 types of line styles that can be represented in a .LIN file. First are dash-dots, which are roughly equivalent to MicroStation Strokes:
*DashDot,Style with dashes and dots ____ . ____ . ____ . ____ . _A,.5,-.2,0,-.2
Example of Dash Dot Linestyle in AutoCAD
The first line provides the name and description, and the second line provides the definition. The A stands for "Alignment" and must be the first character on the line. It is followed by positive numbers to denote dashes and negative numbers to denote gaps. In this example, the style has a (0.5) unit dash followed by a (0.2) unit gap then a dot (0 length dash) followed by another (0.2) unit gap.
A second, more complicated line style type can contain either text from a text style or shapes from an SHX file. Examples are:
*DISTWTR,Distilled Water Line -----DIST-----DIST-----DIST-----DIST-----A,.5,-.2,["DIST",STANDARD,S=.1,X=-0.15,Y=-.05],-.25
Example of Distilled Water Linestyle in AutoCAD
Detail of "DIST" location in linestyle in AutoCAD
*FENCELINE1,Fenceline circle ----0-----0----0-----0----0-----0--
A,0.5,-.2,[CIRC1,ltypeshp.shx,x=-.2,s=-.?],?,?
Example of Fence Linestyle
The dashes and gaps remain the same as for dash-dot patterns. The items inside the brackets [] define either a text string and a text style name as in DISTWTR, or a shape name and a shape file name as in FENCELINE. You can specify the X and Y offsets, the rotation, and the scale for the text or shape. These features are all that is available in a DWG line type; if you can't specify it in this format, then you can't export it to DWG.
In practice, this means that line styles with the following features can not be exported, and therefore will not appear as available line styles in DWG work mode:
Example of Rail Road Linestyle
Example of Diamond Linestyle in MicroStation
Furthermore, DWG only permits cosmetic (as opposed to functional) line styles. Although most line styles fall into this category, some line styles do depend on having specific symbols in specific locations. This is not possible in DWG because all line styles are displayed using a "centering" algorithm. This algorithm does guarantee that there will be dashes on either end of a line, but the location of the symbols is calculated as follows.
First, the maximum number of full iterations of the style are centered on the line segment. For example, consider this line type definition used in a file with inches as working units:
*StyleX,Set of dashes __ _ __ _ __A,2,-0.5,1,-0.5
This line style definition is a total of 4 inches long. If you place a line that is 13 inches long using this style, there are 3 whole iterations with a remainder of 1 inch. The extra 1 inch is added to the starting dash, making it 3 inches long. The starting dash is then split in half, with half at the beginning of the line and half at the end of the line. Now if you stretch that line to be 15 inches, the only thing that changes is the length of starting and ending dashes, which will change from 1.5 inches long to 2.5 inches long.
2 lines placed with "Style X" one at 13" and one at 15"
The most severe consequence of this alignment style is that all MicroStation line styles will appear with this alignment in DWG files. For compatibility, this method of generating the line style was added to MicroStation and is called "Shift: Centered" in MicroStation's Line Style editor. All other shift types will be translated to this style when converting to DWG.
Custom Line Style Editor showing "Shift: Center" option
Because all point symbols in DWG line styles must be represented as shapes in an SHX shape file, the elements in the point symbol are converted to a shape during the translation. The font file is named dgnlstyle.shx and will appear in your DWG fonts directory just like other fonts. If you want the file to appear in another directory, you can use the following configuration variables:
Each symbol in the font file will start with the name of the resource file, up to 10 characters, followed by an underscore and the name of the symbol. For instance, the example line style { Ground Line } resides in lstyle.rsc and contains a point symbol "ground". The resulting symbol is named LSTYLE_GROUND. This convention is used so that symbols can be reused for different line styles and files.
In all MicroStation versions previous to 8.1 the behavior of the line style system was to reject any line style that can not be accurately represented by a .LIN file. If this tighter limitation is desired, it can be achieved by disabling the capability CAPABILITY_ALLOW_NON_SHX_STYLES.
Some line styles won't export due to the limitations in the DWG line style system. When these are encountered, they can be handled several ways. First, the Save As remap facility will allow you to change any line style to any other line style by name. The only caveat to this is that some line styles in .LIN files require a text style to be present in the file. If you plan to use any of these styles, you should ensure that a text style with the correct name appears in the file before remapping.
Another Save As option is to drop any non-exportable line styles to components. Using this facility line styles will appear the same in the DWG file, but the lines will not be modifiable.
Previous to V8, MicroStation did not support the internal storage of linestyle definitions within the design file. When saving a DWG (or a V8 DGN that contains linestyle definitions) to V7, a line style resource file is generated (<filename>_lstyle.rsc). This file is created in the same folder as the design file. The resource file must be placed in a folder as defined by the variable MS_SYMBRSRC in order for the V7 file to read the line style correctly.
MicroStation can resolve custom linestyle definitions from two places.
MicroStation V8 can import line styles from an AutoCAD LIN file as well as from the standard MicroStation RSC file (new in MicroStation V8 2004 Edition). When the line styles are imported they are written directly into the DGN, their definitions are saved internally, within the DGN file itself.
To import a Line style:
Note: The styles will not appear in the Line Style Editor. They will only be visible in linestyle attribute combo boxes and the Custom linestyle List. The style(s) will only be available within the Design file that the style was imported.
MicroStation can also export linestyles that are stored within a design file, to an RSC file (new in MicroStation V8 2004 Edition).
To export a Line style:
Note: The linestyle resource must be placed in a folder as defined by the variable MS_SYMBRSRC and MicroStation will need to be restarted to be able to use the linestyles contained within.
Custom linestyle scale can be controlled 3 ways:
To control custom linestyle scale globally, key in: ACTIVE LINESTYLE SCALE [scale factor] or DWG LTSCALE [scale factor]. This will affect all linestyles within the active file as well as any attached references, by multiplying the global scale factor of the active design file by the element's own custom linestyle scale factor.
This is different than the Scale Factor setting in the Line Styles dialog box, which will set the scale factor for new elements that are placed in the design. This, unlike the global scale factor, is respected through references.
It is also possible to control custom linestyle scales per level Bylevel and Level Overrides through the Styles tab of the Level Properties dialog accessible from the Level Manager Dialog (Levels > Properties). This will override the element scale but will still be multiplied by the Global scale factor.
Custom LineStyle with no scales set
Custom Linestyle with ACTIVE LINESTYLESCALE set to 2 in master file
Custom LineStyle with ACTIVE LINESTYLESCALE set to 0 and Custom linestyle scale set to 2 for the elements in the Active file, and set to 3 for the elements in the Reference file.
You can also control linestyle scales in ByLevel and Level Overrides through the Styles tab of the Level Properties dialog accessible from Level Manager (Levels > Properties).
Deutsch