2

In ArcMap 10.1 from the python window I am attempting to rotate a symbol for a point. After I run my code I can look at the symbol properties and the rotation expression is set on the symbol, however the symbol in the data frame is not rotated.

screenshot of layer properties window

What am I missing to get the points in the data frame to show the point rotated?

(also worth noting, if I click on "OK" in the expression builder and rotate windows, then click "apply" in the layer properties window, then "OK" the symbols are then displayed in the data frame properly)

import snippets101 as snippets
snippets.GetStandaloneModules()
snippets.GetDesktopModules()
import comtypes.gen.esriCarto as esriCarto
import comtypes.gen.esriFramework as esriFramework
import comtypes.gen.esriArcMapUI as esriArcMapUI
import comtypes.gen.stdole as stdole
import comtypes.gen.esriDisplay as esriDisplay
from snippets101 import CType
from snippets101 import NewObj

pApp = snippets.GetCurrentApp()
pMxDoc = CType(pApp.Document, esriArcMapUI.IMxDocument)
pMap = pMxDoc.FocusMap
pAV = CType(pMap, esriCarto.IActiveView)

pFeatureLayer = CType(pMxDoc.FocusMap.Layer(0), esriCarto.IFeatureLayer)
pGeoFeatureLayer = CType(pFeatureLayer, esriCarto.IGeoFeatureLayer)
pRotationRenderer = CType(pGeoFeatureLayer.Renderer,esriCarto.IRotationRenderer2)
pRotationRenderer.SetSymbolRotation3DFlags = (4)
pRotationRenderer.SetSymbolRotation3DExpressions('','','[SDO_ORIENTATION] * -1')
pRotationRenderer.SymbolRotation3DRotationTypeZ = 0
pAV.refresh()

2 Answers 2

1

I was not setting the SymbolRotation3DFlags properly.

pRotationRenderer.SetSymbolRotation3DFlags = (4)

should have been:

pRotationRenderer.SetSymbolRotation3DFlags(0,0,4)
0

You didn't set (applied) renderer property for IGeoFeatureLayer Interface.

pGeoFeatureLayer.Renderer = pRotationRenderer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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