English

How To: Make a stipple fill pattern for symbolizing a polygon theme or graphic

Summary

You can make a stipple fill pattern from an icon format, such as a .bmp file. The following steps and sample code show how to do this.

Procedure

  1. Open a view and create the polygon graphic that you want to fill with a raster pattern.
  2. Open a New Layout and set the page size to 1-inch by 1-inch for testing.
  3. Add the view to the layout as a ViewFrame.
  4. Export the layout to a .bmp file.
  5. Copy and paste the following code into a New Script window.

    Code:
    '--- Stipple Pattern Making Script

    '-- Edit this variable to contain the pathname to your .bmp file
    theIcon = Icon.Make("cd:\data\illinois.bmp".AsFileName)

    '-- MsgBox.Info(theIcon.GetClass.GetClassName, "icon")
    theStipple = Stipple.Make(theIcon)

    '-- If you're curious...
    theStippleWidth = theStipple.GetWidth
    theStippleHeight = theStipple.GetHeight
    'MsgBox.Info(theStippleWidth.AsString ++ theStippleHeight.AsString, "stipple")

    '-- Make the RasterFill and set its charasteristics
    theRasterFill = RasterFill.Make
    theRasterFill.SetStipple(theStipple)
    theRasterFill.SetStyle (#RASTERFILL_STYLE_STIPPLE) 'There's also OPAQUESTIPPLE
    theRasterFill.SetColor(Color.GetCyan)

    '-- Comment out one of the following blocks of code depending
    '-- on whether you want to symbolize a graphic or a polygon theme

    '-- Symbolize an existing graphic in the View
    theView = av.GetActiveDoc
    theViewGraphicsList = theView.GetGraphics
    theSingleGraphicInTheView = theViewGraphicsList.Get(0)
    theSingleGraphicInTheView.SetSymbol(theRasterFill)
    theView.Invalidate

    '-- Or, update a polygon Legend
    theView = av.GetActiveDoc
    theTheme = theView.GetThemes.Get(0) 'Uses the first theme in the TOC
    theLegend = theTheme.GetLegend
    theSyms = theLegend.GetSymbols
    theSyms.Set(0, theRasterFill) 'Assumes Single Symbol
    theTheme.UpdateLegend

    '--- End of Script

  6. Compile and run script off the view document.