Software

  • NPS Grid Tools: Source Code Documentation
    Visual Basic project

    The extension is all written in Visual Basic 6. All necessary files are included within a visual basic project file directory. Download the source code in a zip file (version 1.1 posted 11/17/2004 302kb). The source code within this project contains many generic routines that are useful for creating other ArcMap tools and almost all of the Visual Basic code can be directly used within Visual Basic for Applications. If you are new to programming in ArcGIS, please see our Migrating to VB in ArcGIS documentation.

    Compiling the project

    NOTE: Before compiling, make sure to uninstall any version of the extension and close any running ArcGIS components. You cannot have the extension installed using the install package and compile the project from VB on the same machine. To compile the project, I suggest using the ESRI Add-in "Compile and Register" under the Add-Ins menu. Selecting the tool will open a window where you select the "component category" for each class within the project. Make sure for each "command" that the "ESRI MX Commands" box is checked. The toolbar clsGridToolBar is a "ESRI MX Command Bars", and the extension clsNPSGridExtension is a "ESRI MX Extension". Also, the clsGridToolBar should be selected as a "Premier Toolbar." Click the Compile button to actually compile the project. If you encounter an error while compiling, use the File -> Make nps_grid.dll menu option to locate the actual error(s). Upon completion, the "Compile and Register" tool will have created the "nps_grid.dll" within the project directory and registered this DLL and its components, i.e. ArcMap will "see" this extension the next time it runs.

    Structure of project

    The code within the project file is grouped into forms (the windows or dialogs used in the extenstion), modules (code to do various general routines), and classes (the command, command bar, and extension classes). Here is a short description of each (additional information about each is included within the comments of each component):

    Forms

    frmGridCombo
    General dialog for selecting from a combo box with option to use selected features in determining extent (duplicates the MsgBox.Choice of Avenue).
    frmGrid
    Main form for setting grid options. Contains code that actually initiates the grid creation process.
    frmMsgReport
    General dialog for displaying a message (duplicates the MsgBox.Report of Avenue). Called by several routines.
    frmResources
    A form to hold the icons used in the extension's toolbar. Referenced by each "command" class.

    Modules

    basDebugger
    Routines to display and save debugging messages in VB and VBA. Very useful for debugging extensions written in VB.
    basMXUtility
    Routines for general tasks within ArcMap. For example, creating blank shapefiles or coverages, determining license type, and manipulating layers.
    basUtility
    Routines for various file and Visual Basic operations. For example, determining if a file exists, getting file attributes, searching arrays, and opening generic documents.
    basWin32API
    Visual Basic front-ends for several Win32API calls. Calls for opening and saving files and reading/writing Window's registry values are included. These are very useful.
    ErrorHandling
    This code is from the ESRI's Error Handler Add-in. It says don't modify it, and I've complied.

    Classes

    clsGridToolBar
    The toolbar for the extension. Note that not all Command classes within the project are currently included within the toolbar.
    clsGridCommand
    Tool to open Grid creation form and set debugging mode for process.
    clsNPSGridExtension
    The extension class. Can be copied to another project and modified to create new ArcMap extensions.


 
POC: Doug Wilder
Last Modified: 09/18/2009