bdsmolla Posted August 11, 2012 Report Share Posted August 11, 2012 I think, this will be good idea to share python codes to learn and get support from the members. Under this post we can do that. Can anyone help to delete subtype field from a feature class (FC)? Like one FC may have a subtype field with 5 (five) predefined subtypes. How to read and list those five subtype values and remove from the subtype list dynamically and finally delete the field. Just now thought about this. Will work on this to get solution. Please share your views and post how you learnt Python for customizing ArcGIS Desktop and Server. Quote Link to comment Share on other sites More sharing options...
marcus.carvalho Posted August 11, 2012 Report Share Posted August 11, 2012 I need!!! Quote Link to comment Share on other sites More sharing options...
bdsmolla Posted August 16, 2012 Author Report Share Posted August 16, 2012 (edited) In 10.0 the solution is very difficult. First you will be require to identify which field is defined as subtype. To find that field you can use: -------------------- urFC = r'C:\Temp\DemoData.gdb\VegA' fcDescr = arcpy.Describe(urFC) stFld = fcDescr.subtypeFieldName print stFld ------------------- If you run above code in Python Window of ArcGIS Desktop and if the VegA feature class of DemoData.gdb having subtype field will return the field name. You can not directly delete subtype field, before that you are require to delete its codes and values from the list. For that, you need to know how many subtype values defined into the Feature Class. In 10.0, I didn't find any function to list the codes and values, in 10.1 under arcpy.da (data access module there is a function which can be used) for details, visit the link: http://resources.arcgis.com/en/help/main/10.1/index.html#//018w00000021000000 Finally, make the list of codes which may like: ---------------------- stList = ["1", "2", "3", "4", "5"] arcpy.RemoveSubtype_management(urFC, stList) arcpy.DeleteField_management(urFC, stFld) ---------------------- If you find any problem, let me know Edited August 16, 2012 by bdsmolla Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.