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
    • Register
    • Login

    Instance Object Link is not working

    Cinema 4D SDK
    python
    3
    3
    452
    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.
    • aghiad322A
      aghiad322
      last edited by

      instaproblem.png
      i'm trying to link an object in the instance's reference object but it's not working

      1 Reply Last reply Reply Quote 0
      • i_mazlovI
        i_mazlov
        last edited by

        Hello @aghiad322,

        Welcome to the Plugin Café forum and the Cinema 4D development community, it is great to have you with us!

        Getting Started

        Before creating your next postings, we would recommend making yourself accustomed with our Forum and Support Guidelines, as they line out details about the Maxon SDK Group support procedures. Of special importance are:

        • Support Procedures: Scope of Support: Lines out the things we will do and what we will not do.
        • Support Procedures: Confidential Data: Most questions should be accompanied by code but code cannot always be shared publicly. This section explains how to share code confidentially with Maxon.
        • Forum Structure and Features: Lines out how the forum works.
        • Structure of a Question: Lines out how to ask a good technical question. It is not mandatory to follow this exactly, but you follow the idea of keeping things short and mentioning your primary question in a clear manner.

        About your First Question

        There's a great example script that reveals how to work with instance object.

        Regarding your exact scenario, you have to insert the referenced object to the document as well. You can check the following code snippet:

        import c4d
        
        doc: c4d.documents.BaseDocument  # The active document
        
        def main() -> None:
            objCube = c4d.BaseList2D(5159)
        
            objInstance = c4d.InstanceObject()
            objInstance.SetReferenceObject(objCube)
            # objInstance = c4d.BaseList2D(5126)
            # objInstance[c4d.INSTANCEOBJECT_LINK] = objCube
        
            doc.InsertObject(objInstance)
            doc.InsertObject(objCube)
        
        if __name__ == '__main__':
            main()
        

        Note, commented out you find an equivalent way to create and setup up instance object.

        Cheers,
        Ilia

        MAXON SDK Specialist
        developers.maxon.net

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

          Hello @aghiad322,

          without further questions or postings, we will consider this topic as solved by Monday 05/06/2023 and flag it accordingly.

          Thank you for your understanding,
          Maxime.

          MAXON SDK Specialist

          Development Blog, MAXON Registered Developer

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