celticflute

Python and ISymbolCollectionElement.SharedSymbol syntax

Discussion created by celticflute on Apr 15, 2011
Latest reply on Apr 23, 2011 by mahunter243
I am automating ArcGIS-ArcView 10.0 through comtypes, and I have run into an apparent syntax problem. So my basic question is this: What would be the proper Python syntax for doing ISymbolCollectionElement.SharedSymbol? The .NET syntax usually works for Python, but in this case, given a long integer annoclass and an object pSymbol, the .NET syntax

pSymbolCollectionElement.SharedSymbol(annoclass, pSymbol)

results in

TypeError: object is not callable

The older VB6/VBA syntax

pSymbolCollectionElement.SharedSymbol(annoclass) = pSymbol

understandably raises a Python syntax error, can't assign to a function call. Doing so is not allowed in Python.

So, does anyone have any idea what the Python syntax should be to set the SharedSymbol property?

I am assuming here that the symbol being called for is the ISymbol retrieved from the SymbolCollection of the annotation feature class with the given ID (in my example the same as the annoclass value). That's what I have been passing in anyway. Maybe I have this wrong. Having to pass in both the SymbolID and the symbol seems a bit redundant to me, so maybe I am not understanding what is going on. Thank you for any help you can offer to dig me out of this little rut.

Outcomes