Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

share|improve this question
    
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 Jan 17 '12 at 3:48
add comment

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
    
thank you for the link! –  artwork21 Jan 24 '12 at 14:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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