English

How To: Create elliptical shapes

Procedure

Summary

Ellipses are not a part of the default graphic drawing tool options. It is possible, however, to use Avenue to create elliptical shapes.

Procedure

This script shows how to create elliptical shapes.

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