Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    Cannot set layer parameter for capsules in 2024.3.1

    Cinema 4D SDK
    python 2024
    3
    3
    439
    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.
    • R
      robpayne
      last edited by

      In 2024.3.1 python cannot set the layer parameter of a Capsule object. Other object types seem to be unaffected. Console shows the error: “AttributeError: parameter set failed”
      Screenshot 2024-02-23 at 18.21.31.jpeg

      Reproduction:

      • Open Cinema 4D
      • Add new layer in the Layer Manager
      • Add a capsule object to the scene (e.g. Polygon Bevel)
      • Run the script below in the Script Manager to set layer parameter for all objects
      import c4d
      
      def main() -> None:
          
          # Get first layer
          myLayer = doc.GetLayerObjectRoot().GetDown()
          
          # Get objects in scene
          allObjects = doc.GetObjects()
          
          # Set layer attribute for objects in scene
          for i in range(len(allObjects)):
              allObjects[i][c4d.ID_LAYER_LINK] = myLayer
              c4d.EventAdd()
          
      if __name__ == '__main__':
          main()
      

      Result

      • The capsule layer is NOT set
      • Error appears in console in the python tab

      Versions

      • [NOK] 2024.3.1
      • [OK] 2024.2.0

      Tested on:

      • Windows 11 Pro (23H2)
      • OSX Monterey 12.6.3
      ferdinandF 1 Reply Last reply Reply Quote 2
      • ferdinandF
        ferdinand @robpayne
        last edited by

        Very nice bug report, thank you for reading the guidelines. We will have a look on Monday 🙂

        MAXON SDK Specialist
        developers.maxon.net

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

          Hi thanks for the detailed report, I fixed the issue it be available in the next non-hotfix release.

          As a workaround you can do

          dId = c4d.DescID(c4d.ID_LAYER_LINK)
          allObjects[i][dId] = myLayer
          

          Cheers,
          Maxime.

          MAXON SDK Specialist

          Development Blog, MAXON Registered Developer

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