English

How To: Create a neatline for a layout using Avenue

Summary

This script is one method you can use to create a neatline for a layout.

Procedure

  1. Open a new script window.

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

  2. Copy this code into the script window:

    Code:
    '-- Script Layout.GraphicNeatline

    '-- This script creates a double neatline based on
    '-- page margins and user settings

    theLayout = av.GetActiveDoc
    theDisplay = theLayout.GetDisplay

    theGraphics = theLayout.GetGraphics

    thePageExtent=theDisplay.ReturnPageExtent
    theMarginExt=theDisplay.ReturnMarginextent
    dialoglabels1={"Neatline 1: Scale", "Neatline 1: Width (pts)",
    "Neatline 2: Scale", "Neatline 2: Width (pts)"}
    defaults1={"0.95","1.5","0.90","0.75"}
    inputlist1=msgbox.multiinput("Select the parameters for your
    neatline.","Neatline",
    dialoglabels1,defaults1)

    if (inputlist1.count=0) then
    exit
    end

    if (inputlist1.count<>4) then
    msgbox.error("You must fill in all values in the settings.","Error")
    exit
    end

    offset1=inputlist1.get(0).asnumber
    offset2=inputlist1.get(2).asnumber
    width1=inputlist1.get(1).asnumber
    width2=inputlist1.get(3).asnumber

    neat1rect=theMarginExt.clone.Scale(offset1)
    neat2rect=theMarginExt.clone.Scale(offset2)

    aSymbol = RasterFill.Make
    aSymbol.setstyle(#RASTERFILL_STYLE_EMPTY)
    aSymbol.SetOLColor(Color.GetBlack)

    gneat1 = GraphicShape.Make(neat1rect)
    gneat1.SetSymbol(aSymbol)
    gneat1.getSymbol.setOLwidth(width1)

    gneat2 = GraphicShape.Make(neat2rect)
    gneat2.setSymbol(asymbol.clone)
    gneat2.getSymbol.setOLwidth(width2)

    theGraphicGroup=GraphicGroup.Make
    theGraphicGroup.add(gneat1)
    theGraphicGroup.add(gneat2)

    oldselected=theGraphics.getselected.clone

    theGraphics.Add(theGraphicGroup)

    theGraphics.Unselectall
    theGraphicGroup.Setselected(TRUE)
    theGraphics.MoveSelectedToBack
    theGraphicGroup.setselected(FALSE)

    for each agraphic in oldselected
    agraphic.setselected(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. Make the layout active.
  5. Click the new button to run the script.