Problem with getting styles id from styles collection (CPython3)

I have a problem with getting ObjectId of styles in Civil3D. I wrote python script exactly like “Developer’s Guide” suggest for C#, runed it using IronPython engine, and I get ObjectId of any style. Now Im tried to run this on Cpython engine and I cant get any objects form styles collections. Thats means i can only get styles id by IronPython engine?
That simply script gets ObjectId in IronPython, and gets error on Cypthon:

What is the error?

I don’t know what your program’s intentions are. I only know that PVSOIC cannot be directly regarded as a Python list. You must modify it as follows:

PVSOIC = CivilApplication.ActiveDocument.Styles.ProfileViewStyles
OUT = list(PVSOIC)[0]

The type of PVSOIC is Autodesk.Civil.DatabaseServices.Styles.ProfileViewStyleCollection

another method
PVSOIC = CivilApplication.ActiveDocument.Styles.ProfileViewStyles.get_Item(0)

1 Like