[GIS] Convert Features to Graphics

arcgis-10.0arcobjectsconvertfeatures

I want to convert selected features to graphics and keep the featuere symbology. I was thinking I could just call the UID command below, however it seems to not be working?

  Dim pUID As New UID
    Dim pCmdItem As ICommandItem
    ' Use the GUID of the Save command
    pUID.Value = "esriArcMapUI.FeaturesToGraphicsCommand"
    pUID.SubType = 3
    pCmdItem = My.ArcMap.Application.Document.CommandBars.Find(pUID)
    pCmdItem.Execute()

Why does this command not work?

This code does the conversion, however it does not return the feature symbology to the graphic. What is the best method to perform this conversion while keeping the feature symbology in the new graphic?

Thanks

Best Answer

The convert to graphics command relies on the feature renderer. See IFeatureRenderer.SymbolByFeature.

This means you will need to create the appropriate element instances (marker element, line element etc.) based on the geometry type, but the symbol will be provided by the renderer for every feature.