Solved How to get to the str-value in a UserData Integer Cycle

To get the USERDATA from op we simply use, for instance: op[c4d.ID_USERDATA,7]
this will give us the value from the chosen option index (7) in my USERDATA
Data Type : Integer, Interface : Cycle

To get to the 'str' value which corresponds to this Option I constructed the following code:
op.GetUserDataContainer()[8][c4d.DESC_NAME].GetContainer(c4d.DESC_CYCLE).GetString(op[c4d.ID_USERDATA,7])
🤔
it works but this seems to me like a little overkill (understatement)
Is there a better/ correct way to get to the 'str'-value. Also I have to know the position in the GetUserDataContainer() (in my case [8]) to get to the value.

Hello,

as always, please post questions regarding the Cinema 4D APIs in the "Cinema 4D Development" subforum. Please also use the Q&A system.

Do you mean with 'str' value the label of the option?

GetUserDataContainer() allows to browse through all user data description containers. These contains contain information on the settings of the user data parameters. Information on the cycle interface is stored under c4d.DESC_CYCLE which returns a BaseContainer with the information. This can look like this:

# user data parameter with the ID 1
ID = c4d.DescID(c4d.DescLevel(c4d.ID_USERDATA, c4d.DTYPE_SUBCONTAINER,0), c4d.DescLevel(1))

# get all user data parameter descriptions
for id, bc in op.GetUserDataContainer():
    
    # check for ID 1
    if id == ID:
        
        # print parameter name
        print("Parameter Name: " + bc.GetString(c4d.DESC_NAME))
        
        # get cycle settings
        cycleBC = bc.GetContainer(c4d.DESC_CYCLE)

        # print cycle data
        for element in cycleBC:
            print("Option: " + str(element[0]))
            print("Label: " + str(element[1]))

best wishes,
Sebastian

@s_bach Thanks for your reply, So I guess there is no 'easy' way to get the label value.
I was working in a Python Generator's Object code and so filed my question under Python, my bad.
I'll try to get it right with my next question. 😳
and yes I meant this one:0_1552497629402_UserData.PNG

@stevejlv I found a workaround: the value part in the value;string Cycle option list does not have to be 0,1,2 etc.
So I can give them the exact value as the string part (as long as they are int) and get the value I want the old fashioned way: [c4d.ID_USERDATA,1]