I am trying to build some tools using Toolbox and Python for users who are in the ArcMap environment, in an ArcMap session. So the first thing I want to to is get a list of the feature classes and/or layers in the current "Data Frame", pass them into the Toolbox as a parameter, so that the user can then pick one (or more) of them and then begin doing stuff like comparing attributes between 2 feature classes and so forth.
But the problem or challenge is that a "Workspace" is a file folder or a Geodatabase or similar and NOT a "Data Frame". And this is not handy, because to the user, the "Data Frame" is, in fact a storage place for the things they wish to do geoprocessing against.
Does anyone have any ideas for developing a framework for using the Map Document, instead of traditional "Workspaces", as a place to assemble various feature classes, tables, etc. from various domains, file folders, file geodatabases, etc.?
Conceptually, I need to do something like this:
<SPAN class="kn">import</SPAN> <SPAN class="nn">arcpy</SPAN><BR /><SPAN class="n">mxd</SPAN> <SPAN class="o">=</SPAN> <SPAN class="n">arcpy</SPAN><SPAN class="o">.</SPAN><SPAN class="n">mapping</SPAN><SPAN class="o">.</SPAN><SPAN class="n">MapDocument</SPAN><SPAN class="p"></SPAN>
arcpy.env.workspace = mxd
And this, so I can start doing things like creating lists and other sorts of things, but in the context of the map as the current workspace.