HOW TO
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.
Code:
'-- 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)
end
end
'-- 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)
end
if (theGChoice = "Fill")then
theGSymbol = Symbol.make(#SYMBOL_FILL)
end
end
'-- Assign the specified symbol to each polygon in the
'-- list of selected graphics.
for each pg in theGlist
pg.SetSymbol(theGSymbol)
end
'-- 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)
end
end
'-- 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))
pt.updatelegend
elseif (theSChoice = "Fill")then
pt.setlegend (legend.make(#SYMBOL_FILL))
pt.updatelegend
end
end
end
'-- Force the View to redraw.
v.invalidate
'-- End of Script
Article ID:000002583
Get help from ArcGIS experts
Download the Esri Support App