HOW TO
Code:
'--- Program: View.EllipseTool
'
'--- Purpose: Create an ellipse in a view as a graphic
'--- or adds an ellipse to and editable theme.
'
'-----------------------------------------
'Arguments: none
'Globals : none
'Returns : none
'-----------------------------------------
'Notes : Add another tool to the Add Graphic
' toolbar. Invoke this script as the
' APPLY event. Use the standard system
' script View.PolyToolUpdate as the
' UPDATE script.
'-----------------------------------------
theView = av.GetActiveDoc
r = theView.ReturnUserRect
o = Oval.Make(Point.Make(r.GetLeft, r.GetBottom), r.ReturnSize)
theTheme = theView.GetEditableTheme
if (r.IsNull) then
return nil
else
if (theTheme <> nil) then
p = o.AsPolygon
thePrj = theView.GetProjection
if (thePrj.IsNull.Not) then
p = p.ReturnUnprojected(thePrj)
end
theTheme.getFTab.BeginTransaction
theField = theTheme.GetFTab.FindField("Shape")
rec = theTheme.GetFTab.AddRecord
theTheme.GetFTab.SetValue(theField, rec, p)
theTheme.GetFTab.EndTransaction
theTheme.GetFTab.GetSelection.ClearAll
theTheme.GetFTab.GetSelection.Set(rec)
theTheme.GetFTab.UpdateSelection
else
gr = GraphicShape.Make(o)
theView.GetGraphics.UnselectAll
gr.SetSelected(TRUE)
theView.GetGraphics.Add(gr)
end
av.GetProject.SetModified(true)
end
'--- End of Script
Article ID:000001471
Get help from ArcGIS experts
Download the Esri Support App