2

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

  • are you in data view? this does not work in layout view. You will also need to do a full refresh either manually or programatically. Your code should do what the default tool does minus the refresh... @Petr's answer below is the correct way to do this – Jakub Sisak GeoGraphics Jan 17 '12 at 3:48
2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.