I built a model that extracts selected attributes from my TCAD feature layer using a polygon feature. I am looking for a way to convert this model to a functional tool through python scripting. The requirement is that when the tool is run, it will prompt the user to enter the polygon feature (any polygon feature that is within the TCAD coverage); the tool will also prompt the user to select the needed attributes from the TCAD layer feature.
So far my model is pretty much functioning manually but I would really want it to be more automated.
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# Extracting Property_IMprvtment_Values_By_ContourPoly.py
# Created on: 2018-11-01 14:54:20.00000
# Description: This script will extract selected atrributes from TCAD for any given polygon (in this case I am using a Contour Polygon)
# that is used to intersect the TCAD
# ------------------------
# Import arcpy module
import arcpy
import sys
import os
import datetime
import traceback
# Database Connection
editDB ="C:\Users\EgbuleI\AppData\Roaming\ESRI\Desktop10.5\ArcCatalog\TCAD.sde\TCAD.TC_USER.TCAD_PARCELS"
# Local variables:
TCAD_TC_USER_TCAD_PARCELS__3_ = "TCAD.TC_USER.TCAD_PARCELS"
TCAD_TC_USER_TCAD_PARCELS = TCAD_TC_USER_TCAD_PARCELS__3_
Parcels_on_710f = "C:\\Users\\egbulei\\Documents\\ArcGIS\\Default.gdb\\Parcels_on_710f"
Documents__2_ = "C:\\Users\\egbulei\\Documents"
Contour710ft_data2_dbf = "C:\\Users\\egbulei\\Documents\\Contour710ft data2.dbf"
# Process: Select Layer By Location
arcpy.SelectLayerByLocation_management(TCAD_TC_USER_TCAD_PARCELS__3_, "INTERSECT", Parcels_on_710f, "", "NEW_SELECTION", "NOT_INVERT")
# Process: Table to Table
arcpy.TableToTable_conversion(TCAD_TC_USER_TCAD_PARCELS, Documents__2_, "Contour710ft data2.dbf", "imprv_homesite_val IS NOT NULL AND imprv_homesite_val >0", "PROP_ID \"PROP_ID\" true true false 4 Long 0 10 ,First,#,Database Connections\\TCAD.sde\\TCAD.TC_USER.TCAD_PARCELS,PROP_ID,-1,-1;py_owner_n \"py_owner_name\" true true false 70 Text 0 0 ,First,#,Database Connections\\TCAD.sde\\TCAD.TC_USER.TCAD_PARCELS,py_owner_name,-1,-1;py_owner_i \"py_owner_id\" true true false 4 Long 0 10 ,First,#,Database Connections\\TCAD.sde\\TCAD.TC_USER.TCAD_PARCELS,py_owner_id,-1,-1;py_address \"py_address\" true true false 100 Text 0 0 ,First,#,Database Connections\\TCAD.sde\\TCAD.TC_USER.TCAD_PARCELS,py_address,-1,-1;geo_id \"geo_id\" true true false 15 Text 0 0 ,First,#,Database Connections\\TCAD.sde\\TCAD.TC_USER.TCAD_PARCELS,geo_id,-1,-1;tcad_acres \"tcad_acres\" true true false 8 Double 8 38 ,First,#,Database Connections\\TCAD.sde\\TCAD.TC_USER.TCAD_PARCELS,tcad_acres,-1,-1;GIS_acres \"GIS_acres\" true true false 8 Double 8 38 ,First,#,Database Connections\\TCAD.sde\\TCAD.TC_USER.TCAD_PARCELS,GIS_acres,-1,-1;imprv_home \"imprv_homesite_val\" true true false 4 Long 0 10 ,First,#,Database Connections\\TCAD.sde\\TCAD.TC_USER.TCAD_PARCELS,imprv_homesite_val,-1,-1;land_homes \"land_homesite_val\" true true false 4 Long 0 10 ,First,#,Database Connections\\TCAD.sde\\TCAD.TC_USER.TCAD_PARCELS,land_homesite_val,-1,-1;deed_num \"deed_num\" true true false 50 Text 0 0 ,First,#,Database Connections\\TCAD.sde\\TCAD.TC_USER.TCAD_PARCELS,deed_num,-1,-1;year_built \"year_built\" true true false 2 Short 0 5 ,First,#,Database Connections\\TCAD.sde\\TCAD.TC_USER.TCAD_PARCELS,year_built,-1,-1;Shape_STAr \"Shape_STAr\" false false true 0 Double 0 0 ,First,#,Database Connections\\TCAD.sde\\TCAD.TC_USER.TCAD_PARCELS,Shape.STArea(),-1,-1;Shape_STLe \"Shape_STLe\" false false true 0 Double 0 0 ,First,#,Database Connections\\TCAD.sde\\TCAD.TC_USER.TCAD_PARCELS,Shape.STLength(),-1,-1", "")