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

    Use buttons in tags. Rope tag.

    Cinema 4D SDK
    windows python 2024
    2
    3
    509
    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.
    • S
      SmetK
      last edited by

      Hello again, everyone. I still can't figure out how I can use a button in a tag using python. I need to select two points and fix them in a tag. Can you tell me the correct solution? Use Python Generator.
      35750090-da24-48fe-86a6-a7e1353c7aa6-image.png

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

        Hi @SmetK,
        Please make sure you have made yourself familiar with our Support Procedures, especially the "How to Ask Question" part:

        Repeatable: Your claims or problem should be repeatable for us. In most cases this means posting executable code which demonstrates your problem

        Currently I can only guess the exact context you're asking this question in. Please note that attaching the project scene file that illustrates your setup is not prohibited, rather just the opposite - is highly appreciated.
        Regarding your question. If you were in the Python Script context with a normal spline + Rope tag, you could simulate pressing the Fix button in a normal way by sending c4d.MSG_DESCRIPTION_COMMAND (e.g. in a way Maxime showed here: Update button) :
        4cae0d67-7684-4669-ae98-6dcb490a1343-image.png

        import c4d
        def main() -> None:
            opSpline: c4d.PointObject = op
            if op is None:
                return print('No object found')
            ropeTag = opSpline.GetTag(c4d.Trope)
            if ropeTag is None:
                return print('No rope tag found')
         
            bs = opSpline.GetPointS()
            bs.Select(0)
         
            data: dict = { 'id': c4d.HAIR_SDYNAMICS_PBD_SET_FIXED }
            ropeTag.Message(c4d.MSG_DESCRIPTION_COMMAND, data)
         
        if __name__ == '__main__':
            main()
        

        However, assuming you'd like to have Rope tag on the Python generator, this doesn't seem to be possible. The aforementioned buttons only make effect, when the Rope tag is applied to the spline object (c4d.Ospline), otherwise nothing happens. You could potentially send the message to the Ospline cache object inside main() of the Python Generator, but this still wouldn't work as the Rope tag of the cache object is different from the one on the Python generator, and copying it is not allowed due to threaded nature of the python generator.

        Cheers,
        Ilia

        MAXON SDK Specialist
        developers.maxon.net

        S 1 Reply Last reply Reply Quote 0
        • S
          SmetK @i_mazlov
          last edited by

          @i_mazlov Thank you for your reply. That was very helpful!

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