HOW TO

Add a North Arrow to a layout using Avenue

Last Published: April 25, 2020

Summary

This article contains a script that adds a North Arrow to a layout.

Procedure



  1. Open a new script window.

    A. Activate the Project window.
    B. Click the Scripts icon.
    C. Click New.

  2. Paste the following code into the new script window:

    Code:
    theDoc = av.GetActiveDoc
    theODB = odb.open("$AVHOME\etc\north.def".asfilename)
    theODBNEW = theODB.Get(0)

    '-- Define Northarrow to grab
    theArrowObj = theODBNEW.Get(0)

    '-- r must be a rectangle on the View or Layout
    '-- r is the rectangle on the View/Layout where the northarrow will be drawn
    '-- The setarrow request adds the specified
    '-- arrow to the defined rectangle area
    r = theDoc.getDisplay.returnvisextent

    if (r <> nil) then
    gn = NorthArrow.Make(r)
    gn.setarrow(theArrowobj)
    gn.SetDisplay(theDoc.GetDisplay)
    theDoc.GetGraphics.UnselectAll
    gn.SetSelected(TRUE)
    theDoc.GetGraphics.AddName(gn)
    av.GetProject.SetModified(true)
    end

  3. Attach the script to a button on the Layout GUI.

    A. Compile the script.
    B. Switch to the Project window.
    C. Select Customize from the Project menu.
    D. On the Customize dialog, select Layout under Type dropdown.
    E. Select Buttons under Category.
    F. Click the New button.
    G. Double-click the Click property in the Customize dialog box.
    H. Enter the name of the script in the Script Manager and click Select.
    I. Close the Customize dialog box.

    For more information, see 'Customize dialog box' in ArcView Help.

  4. Open the layout and click the new button.

Article ID:000003972

Software:
  • Legacy Products

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options