'GENERALIZE LINE 'CONVERTS A POLYLINE SHAPEFILE TO A GENERALIZED POINT SHAPEFILE ACCORDING TO THE USER'S SPECIFICATIONS 'LOADING SCRIPTS ' 1. Double-click on an empty area on the bar containing all buttons, The "Customize" dialog appears ' 2. In the "Type" pull-down, select "View" ' 3. In the "Category" pull-down, select "Buttons", The display right below the pull down changes to show an array of buttons ' 4. Slide the scrollbar (below the button display) to the right and select the last button by clicking on it, Now click on "New" ' 5. A new blank button appears. Double-click on the blank area to the right of the entry "Click" (just below the button display) ' 6. The "Script Manager" Dialog appears, Click on "New", Enter any name in the input box that appears (prefix it with "Z_" so that it goes in the last) ' 7. A new blank script document (With the name just specified) appears. Delete whatever is on it... ' 8. Either copy-paste this ENTIRE script on the document, or, click on the button with the open-folder icon (tooltip reads "Load text file") and navigate to this file ' 9. Either done, click on the button with the tick-mark icon ("compile"). If spatial analyst is not loaded, there will be some error message, Load it ' 10. After the script is compiled (the tick-mark buton should be grayed out), close the script window and return to the view ' 11. Click on the new button to run the script TheView=av.GetActiveDoc TheTheme=TheView.GetActiveThemes.Get(0) TheFtab=TheTheme.GetFtab PointList={} ThePline=TheFtab.ReturnValue(TheFtab.FindField("Shape"),0) Achoice=msgbox.YesNo("Click on Yes to use MULTIPOINT method No for ALONG","",TRUE) if (Achoice) then 'USE METHOD MULTIPOINT Val=msgbox.input("","Enter generalization factor","").AsNumber Newline=ThePline.ReturnDensified(Val) NewMultipoint=NewLine.AsMultiPoint PointList=NewMultipoint.AsList elseif (Achoice.Not) then 'USE METHOD ALONG i=msgbox.input("","Enter step size percentage","").AsNumber cnt=0 while (cnt<=100) newPt=ThePline.Along(cnt) PointList.Add(newPt) cnt=cnt+i end end FN=FileDialog.Put("FileName".AsFileName,"*.shp","Specify save location" ) NewFtab=Ftab.MakeNew(aFN,Point) NewFtab.SetEditable(TRUE) NewField=Field.Make("ID",#FIELD_DECIMAL,8,0) XField =Field.Make("X",#FIELD_DECIMAL,8,4) YField =Field.Make("Y",#FIELD_DECIMAL,8,4) NewFtab.AddFields({NewField,XField,YField}) ctr=0 for each pt in PointList ctr=ctr+1 rec=NewFtab.AddRecord Newftab.SetValue(NewFtab.FindField("Shape"),rec,pt) Newftab.SetValue(NewField,rec,ctr) Newftab.SetValue(XField,rec,pt.GetX) Newftab.SetValue(YField,rec,pt.GetY) end NewFtab.SetEditable(FALSE) TheView.AddTheme(Ftheme.Make(Newftab))