Question on FeatureclassToFeatureclass tool..

711
2
09-27-2010 12:46 PM
JoshV
by
Occasional Contributor
In my attached script, I simply let the user choose which layer from table of contents they want to do a SelectbyAttributes and then do a FeatureclasstoFeatureclass so they can have a shapefile of the query results.  My problem is that one of the required parameters for FeatureclasstoFeatureclass requires a Name for the output shapefile.  So how can I get which layer the user chose as the Name of the output shapefile??  If I can't do this through my model and I export my model to python, how can I accomplish this through python instead?

Many thanks..
0 Kudos
2 Replies
GerryGabrisch
Occasional Contributor III
Convert the path string to a list, and extract out the last items which is the feature class name.
Something like this in Python...


TheShapefile = "C:/Temp/myshapefile.shp"
ThePathAsAList = TheShapefile.split("/")
TheFileName = ThePathAsAList.pop()
print TheFileName

Then use TheFileName to reconstruct a new string that is the full path to the newly created data.
0 Kudos
JoshV
by
Occasional Contributor
Hi Gerry-

Attached is my python script.  Could you give me an idea of where to put your code and what basic changes I need to implement?
0 Kudos