ARCVIEW 2.1 ALTERNATIVE SCALEBAR TOOL INSTALLING THE SCALEBAR TOOL IN THE DEFAULT PROJECT You can download default.apr from my Web page (see end of this file) or follow these instructions: 1) Open default.apr, located in the $HOME directory (usually C:\temp) 2) Create a new script, named Layout.Scalebar, with the following text: '====================================================================== 'Layout.Scalebar 'Create scalebar from given Viewframe and point of origin '**** Get user point and Layout units theLayout = av.GetActiveDoc p = theLayout.GetDisplay.ReturnUserPoint L_units = theLayout.GetDisplay.GetUnits '**** Get ViewFrame properties theViewFrame = theLayout.GetGraphics.GetSelected.Get(0) theView = theViewFrame.GetView V_units = theView.GetDisplay.GetUnits if (V_units.AsString.Contains("UNKNOWN")) then Msgbox.warning("View must have defined units","Invalid View") exit end V_scale = theViewFrame.ReturnScale '**** Create dialog box to set properties S_units = V_units.AsString.AsTokens("_").Get(2).LCase S_interval = Units.Convert(V_scale,L_units,V_units) labels = {"Units:", "Interval Size:", "Intervals:", "Left Divisions:"} defaults = {S_units, S_interval.AsString, "2", "2"} parmlist = MsgBox.MultiInput("Enter Desired Parameters:", "Scale Bar Parameters", labels, defaults) if (parmlist.Count = 0) then exit end temp = "#UNITS_LINEAR_"+parmlist.Get(0).Ucase S_units = temp.AsEnum S_interval = parmlist.Get(1).AsNumber S_intervals = parmlist.Get(2).AsNumber S_divisions = parmlist.Get(3).AsNumber '**** Calculate bounds temp = S_interval / V_scale I_size = Units.Convert(temp,S_units,L_units) S_size = ( I_size * S_intervals ) if (S_divisions > 0) then S_size = S_size + I_size end X2 = p.GetX + S_size Y2 = p.GetY + I_size '**** Create scalebar and set parameters r = Rect.MakeXY(p.GetX,p.GetY,X2,Y2) sf = ScalebarFrame.Make(r) sf.SetDisplay(theLayout.GetDisplay) theLayout.GetGraphics.UnselectAll sf.SetSelected(TRUE) sf.SetViewFrame(theViewFrame) sf.SetUnits(S_units) sf.SetInterval(S_interval) sf.SetIntervals(S_intervals) sf.SetDivisions(S_divisions) sf.SetStyle(#SCALEBARFRAME_STYLE_ALTFILLED) theLayout.GetGraphics.AddName(sf) av.GetProject.SetModified(true) '====================================================================== 3) Create a new script, named Layout.ScaleBarUpdate, with the following text: '====================================================================== 'Layout.ScalebarUpdate 'Enable if ViewFrame is selected theLayout = av.GetActiveDoc SELF.SetEnabled((theLayout.GetGraphics.GetSelected.Count = 1) AND (theLayout.GetGraphics.GetSelected.Get(0).Is(ViewFrame))) '====================================================================== 4) Compile and close both scripts 5) Double click the tool bar, choose "Layout" and "Tools", and create a new tool 6) Double click "Apply" and select Layout.Scalebar 7) Double click "Update" and select Layout.ScalebarUpdate 8) Double click "Cursor" and select Cursors.CrossHair 9) Double click "Help" and enter Create Scalebar 10) Double click "Icon" and select FrameScalebar 11) Close the Customizer and save the project 12) Exit ArcView and you're ready to go! INSTALLING THE SCALEBAR TOOL IN A SPECIFIC PROJECT 1) Open the desired project 2) Follow steps 2-11 above ======================================================================= USING THE SCALEBAR TOOL 1) Select the View Frame for which you want the scalebar 2) Pick the scalebar tool 3) Point to the desired location of the lower left corner of the scalebar and click once. 4) Enter units, interval size, number of intervals, and number of left divisions (see the Help topic: "Scale bar frame tool" for more information). The default values are as follows: Units: View units Interval Size: 1 Layout unit Number of Intervals: 2 Number of Left Divisions: 2 The default style is "Split filled bar scale". This may be changed by double clicking the scalebar after it's created. The text font and size may be altered via the palette (Ctrl-P). Enjoy! ======================================================================= Mark Cederholm plp@pierssen.com http://www.pierssen.com/PC/arcinfo.htm http://www.pierssen.com/arcview/arcview.htm