harrymckenzie

Interactive User screen input by Rectangle or Point

Discussion created by harrymckenzie on Nov 29, 2012
How do I re-write the below code to work in ArGIS 10.1? Do I use Python and if so what would the code look like?
Does Python allow user interactive screen input to select objects the way Avenue does?
Below is a typical Avenue script that will flip the direction of a line for correct address routing of a road centerline:

theView = av.GetActiveDoc
theDisplay = theView.GetDisplay
theTheme = theView.GetActiveThemes.Get(0)
theRectangle = theView.ReturnUserRect

'Select a line by User screen selection - either a Rectangle or Point
If (theRectangle.IsNull) then
thePoint = theView.GetDisplay.ReturnUserPoint
theTheme.SelectByPoint(thePoint,#VTAB_SELTYPE_NEW)
else
theTheme.SelectByRect(theRectangle,#VTAB_SELTYPE_NEW)
end

theFTab = theTheme.GetFTab
field1 = theFTab.FindField("Shape")

for each rec in theFTab.GetSelection
aline = theFTab.ReturnValue(field1,rec)

'SET THE FLIPPED LINE TO A VARIABLE
newline = aline.flip

'SET THE SHAPE FIELD'S VALUE TO NEWLINE
theFTab.SetValue(field1, rec, newline)
end

theFTab.GetSelection.ClearAll

'INVALIDATE THE VIEW
theView.invalidate
theDisplay.Flush


Thanks in advance!

Outcomes