MicroStation CONNECT Edition Help

Raster Line Style Example

In this example, you will create a simple stroke that will be used as a sketchy line style. The main advantage to this workflow is that you can also create a vector based point symbol which can be used when raster line styles are not supported such as printing to PDF or in older versions of MicroStation.

Setting Up the Design File

  1. Using the seed file 3D Imperial Design.dgn, create a DGN file, named my_stroke.dgn.
  2. Open the Design File Settings dialog ( File > Settings > File > Design File Settings ).
  3. In the Working Units section, set the following:
    • Format - MU
    • Master Unit - Inches
    • Sub Unit - Inches
    • Accuracy - 0.1234
  4. In the Grid section of Design File Settings dialog, set following:
    • Grid Master - 0.1250
    • Grid Reference - 8
  5. Click OK.
  6. Change the background color to white using the following steps:
    1. Open the Color Table dialog ( File > Settings > File > Color Table ).
    2. Double-click the "B" at the bottom-right corner of the color table.
    3. In the Modify Color dialog that opens, enter 255 in the Red, Green, and Blue fields.
      Observe that White color is selected.
    4. Click OK.
    5. In the Color Table dialog, click Attach.
  7. In the File tab, click Save Settings.

Creating a Stroke Pattern

To have a baseline and a known scale for our raster, let us assume the brush stroke will be about 4 inches or 100 mm long and about ½ inch or 12 mm wide at its widest point.

You can first draw a couple of guide lines to help in creating a shape that can be rasterized (rendered) using the following steps:
  1. Set the view window in Top view.
  2. Start the Place Line tool (Drawing > Home > Placement > Place Line).
  3. Press <Enter> to open the key-in window.
  4. In the Key-in window, enter XY=0 and press <Enter>.

    The first end of the line is placed at origin.

  5. In the Place Line tool settings window, enter 4 in the Length field and 0 in the Angle field.
  6. Enter a data point to place the line.
  7. Now start the Move/Copy Parallel tool ( Drawing > Home > Manipulate ).
  8. In the tool settings window, make the following settings:
    • Method - Element
    • Mode - Miter
    • Distance - 0.5
    • Make Copy - On
  9. Select the line element and enter data point above the line to place copy of the line at a distance of 0.5 inches.
Now let us draw the stroke pattern.
  1. Start the B-spline by Points tool (Drawing > Home > Placement > Create Curves split button).
  2. Make the following settings in the tool settings window:
    • Method - Control Points
    • Input By - Points (AccuDraw)
    • Closure - Closed
    • Order - 4
    • Fill Type - Opaque
  3. Place a closed B-spline using five control points, something like shown below. You can place them roughly first and manipulate the handles later to get the desired shape.
  4. From the View Control toolbar, select View Attributes, and from the View Attributes dialog that opens, turn on the Fill toggle.

    The shape is created.

Rasterizing the Shapes

Now, let us create a raster version of the shape by rendering it with Vue.
  1. First resize the view such that the shape just fits in the view as shown below. This will eliminate the need for having to crop the raster later.
  2. Open the Vue Rendering dialog (Visualization > Home > Rendering > Render Scene) make the following settings:
    • Render Mode - Ray Tracing
    • Light Setup - Afternoon
    • Atmosphere Setup - None
    • Render Setup - Exterior Better
    • Set X Resolution to 512.
  3. In the Vue Rendering dialog, click the Render button.
  4. Once the render is complete, move the Brightness slider all the way to the left so that stroke appears nice and dark.
  5. Click the Save Image to File icon.
  6. In the Vue Rendering dialog, select Save Image to file and set file type to PNG and name the image my_stroke.png.
  7. Click Save.

Creating Line Style Resource File

Now let us create a line style resource file in which you will have the custom line style.
  1. Open the Line Style Editor dialog ( Drawing > Home > Attributes > Line Style > Manage ).
  2. In the Line Style Editor dialog, select File > New to open the Create Line Style Library dialog.
  3. In the Create Line Style Library dialog, navigate to the folder where you want to save the custom line styles and name the file My_LineStyles.rsc.
  4. Click Save.
  5. In the Line Style Editor dialog, select File > Save to save the newly created resource file.
This resource file should be read by MicroStation. For that, you will have to point the MS_SYMBRSC configuration variable to the location of your newly created resource file using the following steps.
  1. Open the Configuration Variables dialog ( File > Settings > Configuration > Configuration Variables ).
  2. Select the Symbology category and from the configuration variable list, double-click the MS_SYMBRSC configuration variable.
  3. In the Edit Configuration Variable dialog, add the path of your new .rsc file.
    Tip: If you want to have several resource files being read from this location, then instead of adding the specific file name you can add it like a wildcard using *.rsc. For example, C:\Users\<user.name>\Documents\LineStyles\*.rsc.
  4. Click OK to close the Edit Configuration Variable dialog and again click OK to close the Configuration Variables dialog.
  5. In the Alert window that pops-up, click Yes.
  6. Click Save Settings in the Quick Access Toolbar and exit and restart MicroStation.

Creating New Line Style

Now let us create the raster based line style.
  1. Open my_stroke.dgn.
  2. Open the Line Style Editor dialog ( Drawing > Home > Attributes > Line Style > Manage ).
  3. Select File > Open to open the Open Line Style Library dialog.
  4. Select the My_LineStyles.rsc that you created earlier and click Open.
  5. Select Edit > Create > Name.

    A new line style is created.

  6. Select Edit > Create > Raster to open the Select Raster Line Style File dialog.
  7. Navigate to the location where you saved the my_stroke.png file and double-click on the file to open it.
  8. In the Line Style Editor dialog, make the following settings:
    • Monochrome - On
    • Source - Alpha
    • Width - On and set to 0.5
      Tip: When creating line styles, it is a good idea to use same names for line styles and components so that you know what components are used in each line style.
  9. Select Edit > Create > Compound.
  10. In the field below Components, change the description from new compound component to Sketchy Brush and press <Enter>.
  11. Select Edit > Create > Name.
  12. In the field below the Name list box, rename Unnamed to Sketchy Brush and press <Enter>.

    Observe that the name in the list box also changes to Sketchy Brush.

  13. Now select the Compound Sketchy Brush and click the Insert button to open the Select Component dialog.
  14. In the Select Component dialog, scroll the list box and select the Raster my_stroke.png and click OK.
    The Raster stroke appears in the Sub-Components section of the Line Style Editor dialog.
Next, you need to create a stroke pattern:
  1. Select Edit > Create > Stroke Pattern.
  2. In the field below Components, change the description from new stroke component to Sketchy Brush and press <Enter>.
  3. Click Add and make the following settings in the Stroke Pattern section:
    • Length - Fixed and enter 4 in the adjacent field.
    • Width - None
    • Stroke Type - Dash
    • Start - 0
    • Invert at - None
    • End - 0
    • Corners - Bypass
    • Dash Caps - Closed
      Note: The length is in Master Units and will be used in many different design files with varying units for scaling purposes. In this example, we are assuming a baseline in inches so this would be 4 inches and scaled accordingly. To make the scaling based on real world units, the line styles can be imported into a DGN and saved as a DGNLib.
    • In the Line Style Editor, select File > Save to save the line style.

Optimizing Geometry for Point Symbol

The raster line style components include the rendered raster and a point symbol. You will have to create a point symbol using the geometry just created. To make the point symbol more efficient and faster to display, let us change the closed B-spline to mesh and then into a complex shape where area fill can be used.
  1. Select the Mesh from Element tool ( Modeling > Mesh > Create ).
  2. Select the stroke pattern element that you created.
  3. Enter a data point.

    Since we want the point symbol to appear solid and a mesh element does not have area fill option, you need to drop the mesh and create a complex shape.

  4. Start the Drop Element tool (Drawing > Home > Groups > Drop split button).
  5. In the Drop Element tool settings window, turn on the Solids check box and select To Surfaces from the adjacent drop-down list.
  6. Select the element.
    Hover your cursor on the element and observe in the tooltip that the element is now of the type Shape.
  7. Right-click on the element and select Properties.
  8. In the Properties dialog, select the drop-down adjacent to the Fill property and from color table that pops-up, turn off No Fill and select color 0.

Creating Vector based Line Style using Point Symbol

Now that you have created the raster based line style, it is a good idea to add a vector based point symbol so that the line style will display in older versions of MicroStation. Also, the vector based line style can be used when raster line styles are not supported in some cases, such as when creating a PDF. The raster line style will have the advantage of speed and the ability to warp at corners. The vector based line style can be a close approximation but since it cannot warp the way the raster can it will not be identical.
  1. In the Line Style Editor dialog, select Edit > Create > Point.
  2. In the field below Components, change the description from new point component to Sketchy Brush and press <Enter>.
  3. Start the Define Cell Origin tool (Drawing > Home > Placement > Cells split button ).
  4. Define the origin for the point cell at 0,0 where you see the ACS Triad as shown below.
  5. Reset to end the Define Cell Origin command.
  6. Select the complex shape.

    In the Line Style Editor dialog, observe that the Create button at the bottom enables.

  7. Click the Create button.
  8. In the Create Point Symbol dialog that opens, enter Sketchy Brush in the Name field. and click OK.
  9. Now select the Compound Sketchy Brush from the Components list box and click Insert.
  10. In the Select Component dialog, scroll the list box and select the Point Sketchy Brush and click OK.
    The Point symbol is added to the Compound line style and appears in the Sub-Components section of the Line Style Editor dialog.

Associating the Stroke with the Point Symbol

You will need to associate the Point symbol with the Stroke component that you create earlier.
  1. In the Line Style Editor dialog, select Point Sketchy Brush from the Components list box.
  2. Click Base Stroke Pattern.
  3. In the Base Stroke Pattern dialog, select Sketchy Brush and click OK.

    A line black appears below the Base Stroke Pattern button.

  4. Click the line and then click the Select button.
  5. In the Select Point Symbol dialog, select Sketchy Brush is selected and click OK.

    The pattern is previewed in the Line Style Editor dialog.

  6. In the Justify drop-down, select Left.
  7. Select File > Save to save the resource file.

You are now ready with the line style.

Testing the Sketchy Brush Line Style

Let us test our new line style on a hidden line file of a sample model of a Yamaha Road Star created by Patrick Pirtle. The default solid line model looks like as shown below.

Default Solid Line

To test the new line style:
  1. Press <Ctrl+A> to select all the elements in the model.
  2. Open Line Styles dialog ( Drawing > Home > Attributes > Line Style > Settings ).
  3. In the Line Styles dialog, select the Sketchy Brush line style that you created in the above procedures.
  4. In the dialog, turn on the Scale factor check box and in the adjacent field, enter the scale factor 0.1.
  5. Click on the preview of the line style at the bottom of the dialog to activate the line style. The output looks as shown below.

    Sketchy Brush

    Note: For a more hand drawn look, use the Element Selection tool to select by level and change the scale factor. For example, select the Tire level and change the Scale factor to 0.2 and click on preview in the Line Styles settings dialog to activate using the new scale factor. Try making some of the levels have smaller scale factors and some with larger.

Testing the Vector Based Line Style

To test the new line style with the point symbol you created earlier, you will need to turn off the display of the raster line style. This is done by setting the configuration variable MS_NO_RASTER_LINESTYLE.
  1. Open the Configuration Variables dialog.
  2. Click New.
  3. In the New Configuration Variables dialog, type MS_NO_RASTER_LINESTYLE in the Variable field and 1 in the New Value field.
  4. Click OK in the New Configuration Variable dialog and again click OK in the Configuration Variables dialog.
  5. Click Yes in the Alert window that pops-up.
  6. Click the Update View button in the View Control toolbar to observe the vector based line style displayed.

    Vector based

Note: To revert to the raster line style, set MS_NO_RASTER_LINESTYLE to 0.