Assign pen symbols to polygon outlines using Avenue

Last Published: April 25, 2020


You can use Avenue to assign pen symbols (dashed or dotted lines) to polygon outlines, while retaining the polygon feature type.

If you don't want to retain the polygon feature type, you may convert selected polygons to polylines using the cvtplypl.ave sample script located under Help Topics> mple > Scripts > View:ConvertPolygonToPolyline.


  1. Open a New Script window.

    A. Activate the Project window.
    B. Click the Scripts icon.
    C. Click New.

  2. Copy and paste the following code into the window:

    '-- Script View.AssignLineSymbolToPoly
    '-- Description: Assigns a line symbol to polygon shapes.
    '-- Requires: A selected a polygon graphic and/or
    '-- an active polygon theme.
    '-- Run the script and select a symbol type.
    '-- Bring up the Symbol Palette and select the desired symbol.
    '-- To reverse the process, re-run the script and select
    '-- another symbol type.
    '-- Note: When pen symbols are applied to polygons, the
    '-- polygon turns completely transparent, and the legend of
    '-- the polygon theme will behave as if it were a line theme

    '-- Get the current View document
    v = av.getactivedoc

    '-- Return a list of selected graphics
    theGraphics = v.GetGraphics.GetSelected

    '-- Make an empty graphic list and add only polygon
    '-- graphics from the selected set
    theGList = GraphicList.Make
    for each g in theGraphics
    if (g.getshape.getdimension = 2) then
    theGList.Add (g)

    '-- If any polygon graphics are selected, prompt user to
    '-- specify a symbol type
    if (theGlist.count > 0) then
    theGChoice = (MsgBox.ChoiceAsString ({"Pen","Fill"},
    "Select a Symbol Type for the Selected Polygon Graphics.",
    "Symbol Type: Graphics"))

    if (theGChoice = "Pen")then
    theGSymbol = Symbol.make(#SYMBOL_PEN)

    if (theGChoice = "Fill")then
    theGSymbol = Symbol.make(#SYMBOL_FILL)

    '-- Assign the specified symbol to each polygon in the
    '-- list of selected graphics.
    for each pg in theGlist

    '-- Return a list of Active themes
    theThemes = v.GetActiveThemes

    '-- Make an empty list and add only polygon themes
    '-- from the set of active themes in the View
    thePThemes = list.make
    for each t in theThemes
    if (t.getftab.findfield("shape").gettype = #FIELD_SHAPEPOLY) then
    thePThemes.add (t)

    '-- If any polygon themes are active, prompt for a symbol type.
    if (thePThemes.count > 0) then
    theSChoice = (MsgBox.ChoiceAsString ({"Skip","Pen","Fill"},
    "Select a Legend Type For the Active Polygon Themes.",
    "Symbol Type: Themes"))

    '-- Loop through the list of active polygon themes and
    '-- apply the user's selection.
    for each pt in thePThemes
    if (theSChoice = "Skip")then

    elseif (theSChoice = "Pen")then
    pt.setlegend (legend.make(#SYMBOL_PEN))

    elseif (theSChoice = "Fill")then
    pt.setlegend (legend.make(#SYMBOL_FILL))


    '-- Force the View to redraw.

    '-- End of Script

  3. Attach the script to a button on the view GUI.

    A. Compile the script.
    B. Switch to the Project window.
    C. Select Customize from the Project menu.
    D. On the Customize dialog box, click the Type dropdown arrow and click View.
    E. Select Buttons under Category.
    F. Click the New button.
    G. Double-click the Click property in the Customize dialog box.
    H. Type the name of the script in the Script Manager and click Select.
    I. Close the Customize dialog box.

    For more information, see "Customize dialog box" in ArcView Help.

  4. Switch back to the view and make the polygon graphic or polygon theme active.
  5. Click the button to run the script.

Article ID:000002583

  • Legacy Products

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options