HOW TO
The following examples show how to add, manipulate, and delete graphic points from a view.
Code:
'-- Change View1 to match your view if necessary.
theView = av.getproject.finddoc("View1")
'-- Change the parameters to a different point if desired.
thePt = Point.Make(0.5,0.5)
theGPt = GraphicShape.Make(thePt)
theSymWin = av.GetSymbolWin
thePal = theSymWin.GetPalette
theMarkerPal = thePal.GetList(#PALETTE_LIST_MARKER)
'-- Change the number if a different symbol is desired.
theNewSymbol = theMarkerPal.Get(10).Clone
theNewSymbol.SetColor(color.getblue)
theNewSymbol.SetSize(36)
theGPt.SetSymbol(theNewSymbol)
theView.GetGraphics.Add(theGPt)
theView.Invalidate
Note:
This script uses index numbers to access symbols. If you clear the palette, or modify it, the script may use the wrong symbol. The Marker Palette organizes symbols from left to right and right to bottom; thus, the first row is 0, 1, 2, the next row is 3, 4, 5, and so forth.
Code:
theView = av.getproject.finddoc("View1")
theGraphicList = theView.GetGraphics
theSymWin = av.GetSymbolWin
thePal = theSymWin.GetPalette
theMarkerPal = thePal.GetList(#PALETTE_LIST_MARKER)
for each g in theGraphicList
'-- Change the number for a different symbol if desired
theNewSymbol = theMarkerPal.Get(15).Clone
theNewSymbol.SetColor(color.getblue)
theNewSymbol.SetSize(36)
g.SetSymbol(theNewSymbol)
end
theView.Invalidate
Code:
theView = av.getproject.finddoc("View1")
theGraphicList = theView.GetGraphics
For Each g in theGraphicList
theGraphicList.RemoveGraphic(g)
End
theView.Invalidate
Note:
The above code will remove all graphic elements from the view. You can modify it to remove only desired graphics.
Article ID:000004176
Get help from ArcGIS experts
Download the Esri Support App