Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    GetDescription for Document Modelling Settings

    Cinema 4D SDK
    2
    3
    398
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • mikeudinM
      mikeudin
      last edited by

      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!

      Checkout my python tutorials, plugins, scripts, xpresso presets and more
      https://mikeudin.net

      1 Reply Last reply Reply Quote 0
      • M
        m_adam
        last edited by

        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.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        1 Reply Last reply Reply Quote 0
        • mikeudinM
          mikeudin
          last edited by

          Great! Thank very much @m_adam!😎👍

          Checkout my python tutorials, plugins, scripts, xpresso presets and more
          https://mikeudin.net

          1 Reply Last reply Reply Quote 0
          • First post
            Last post