Split a polygon using a line from a different theme

Last Published: April 25, 2020


This article provides sample Avenue code that splits a polygon feature using a selected line from a different theme.


  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 window:

    theView = av.GetActiveDoc
    t = theView.GetThemes
    splitTheme = msgbox.choice(t,"","Choose the line theme with the selected line")

    theProjection = theView.GetProjection
    theFtab = splitTheme.GetFTab
    theShapeField = theFtab.FindField("Shape")

    thebit = theFtab.GetSelection

    for each x in thebit
    aShape = theFtab.ReturnValue(theShapeField, x)
    if (theProjection.IsNull) then
    aGraphic = GraphicShape.Make(aShape.ReturnProjected(theProjection))
    aGraphic = GraphicShape.Make(aShape)
    if (aShape.Is(Polygon)) then"You must choose a line theme","Warning")
    theTheme = theView.GetEditableTheme

    if (theTheme <> nil) then
    theField = theTheme.GetFTab.FindField("Shape")
    theType = theField.GetType
    if ((theType = #FIELD_SHAPEPOLY) or (theType = #FIELD_SHAPELINE)) then

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

    A. Compile the script.
    B. Switch to the Project window.
    C. Select Customize from the Project menu.
    D. On the Customize dialog box, click the Type dropdown arrow and click View.
    E. Select Buttons under Category.
    F. Click the New button.
    G. Double-click the Click property in the Customize dialog box.
    H. Type 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 view and make the polyline theme active.
  5. Select the line that will split the polygon.
  6. Make the polygon theme active and select Start Editing from the Theme menu.
  7. Click the new button.
  8. Select Stop Editing from the Theme menu.

Article ID:000003847

  • 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