Using arcpy to automate delete drawing objects / graphic elements

820
3
02-08-2014 03:15 PM
AnthonyCheesman1
Occasional Contributor II
Hi

I'm looking for a way to automate the deletion of drawing / graphic objects in data (not page layout) view.

I've investigate using the GraphicElement object - but this does not seem to recognise any features drawn in data view (ie if I use ListLayoutElements on objects drawn in data view, nothing is returned, but it will return objects drawn in page layout view).

If I can find some way to identify the elements in data view, I should be able to use the delete() method to get rid of them.

Any bright sparks have any ideas?
Tags (2)
0 Kudos
3 Replies
JeffBarrette
Esri Regular Contributor
Arcpy.mapping only allows you to clone/delete graphic elements on a layout.  I believe the only other way to accomplish what you need is with ArcObjects.

Jeff
0 Kudos
TimBarnes
Occasional Contributor III
If the purpose of this tool is to 'clean' documents of un-needed graphics, perhaps an alternative approach may work? (i.e. use arcpy.mapping to copy all the layers to a new temporary document, saving it, closing the original document and re-naming the new document to the old documents name. This would effectively get rid of the graphics but keep the layers?
0 Kudos
AnthonyCheesman1
Occasional Contributor II
Jeff, Tim, thanks for the replies.

Tim - that is a very good solution and I'll investigate that. I'll need to put some thought into it as the script needs to be executed from inside the mxd, but if I can get over that hurdle, we could be in business.
0 Kudos