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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    How to resize a rectangular spline to fit text using Python?

    Cinema 4D SDK
    2023 windows python
    2
    4
    591
    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 everyone, what code or function can help me achieve this task? As the text changed, the rectangular spline changed its size according to the bounding box.

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

        Hi @SmetK ,

        Please check out our Support Procedures, namely the "Asking Questions" category. Without a proper context there're too many unknowns to meaningfully proceed with the answer. Is it a parametric spline or an arbitrary one? Are you considering bounding box in a local or in a global space? Please share your scene setup as well as the code snippet that fails to achieve your goal.

        From the first glance it looks like you're interested in GetRad() function for retrieving the bounding box size and the c4d.PRIM_RECTANGLE_WIDTH parameter to set in your spline object, for example in the following way:

        newWidth: float = 100
        op[c4d.PRIM_RECTANGLE_WIDTH] = newWidth
        c4d.EventAdd()
        

        Cheers,
        Ilia

        MAXON SDK Specialist
        developers.maxon.net

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

          @i_mazlov Hi, thanks for the reply! My situation is like in the screenshot. I have a parametric spline and text that the spline should fit to. I guess I'm interested in local coordinates, although global ones would be useful. There is no code. I just saw how they do it through xpresso, but it looks complicated.

          277fd662-5f2d-4c12-906d-a1eda47d4d85-image.png

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

            @i_mazlov I tried the GetRad() method. This is exactly what I need, thanks!

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