GetDescription for Document Modelling Settings



  • Hi there!
    I need to get c4d.DESC_NAME of choosen modelling settings parameter.
    Here is a how it works for C4DAtom:

    cube = doc.SearchObject('Cube')
    description = cube.GetDescription(c4d.DESCFLAGS_DESC_0)       # Get the description of the cube object
    for bc, paramid, groupid in description:                    # Iterate over the parameters of the description
       print (bc[c4d.DESC_NAME], bc[c4d.DESC_IDENT],paramid ,groupid) 
    

    Also there is a Document Snap settings:

    for bc in c4d.modules.snap.GetSnapSettings(doc):
        print bc
    

    The result is:

    (440000121, 1)
    (440000120, 31.0)
    (440000138, 0)
    (431000002, 1.5707963267948966)
    (431000020, 1)
    (431000005, 1)
    (440000131, 2.0)
    (440000133, 0.08726646259971647)
    (440000132, 0.05)
    (440000134, 0.01)
    (440000115, <c4d.BaseContainer object at 0x00000299A17F5690>)
    (431000000, <c4d.BaseContainer object at 0x00000299A17F5F90>)
    (431000001, <c4d.BaseContainer object at 0x00000299A17F5F60>)
    (440000117, <c4d.BaseContainer object at 0x00000299A17F5750>)
    (440000129, <c4d.BaseContainer object at 0x00000299A17F5AE0>)
    (1007, 1)
    (1008, 1)
    (1011, 1)
    

    There is a way to recive Description "container" for Modelling Settings?
    Thanks!



  • Hi @mikeudin this can be done with the next code:

    import c4d
    
    def GetModelingNode():
        ID_SNAP_SCENEHOOK = 440000111
        snapSceneHook = doc.FindSceneHook(ID_SNAP_SCENEHOOK)
        
        for branch in snapSceneHook.GetBranchInfo(c4d.GETBRANCHINFO_NONE):
            if branch["name"] == "MdSH":
                if branch["head"] is not None:
                    return branch["head"].GetFirst()
                
        raise RuntimeError("Unable to find the Modeling Node")
    
    def main():
    
        mod = GetModelingNode()
        
        for bc, paramid, groupid in mod.GetDescription(c4d.DESCFLAGS_DESC_0):
           print (bc[c4d.DESC_NAME], bc[c4d.DESC_IDENT],paramid ,groupid) 
    
    # Execute main()
    if __name__=='__main__':
        main()
    

    Cheers,
    Maxime.



  • Great! Thank very much @m_adam!😎👍


Log in to reply