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

    BaseObject.SetModelingAxis(self, m) Not Working

    Cinema 4D SDK
    python sdk
    4
    5
    876
    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.
    • W
      wooh
      last edited by

      Hi, is there any example about BaseObject.SetModelingAxis(self, m)? I just wanna move and rotate the model's axis via script, and here is my script in python tag3ca30230-bbf0-470d-9a1c-317c9332481c-image.png

      1 Reply Last reply Reply Quote 0
      • CairynC
        Cairyn
        last edited by

        The Tool settings must set the Axis to Free (under Modeling Axis), so the change of the modeling axis has any visible effect.
        If you do that, you will see that the tag affects the modeling axis... go to Polygon Mode, Axis Mode, move the modeling axis, and it snaps back to the origin.

        The more interesting question would be why you'd want to change the tool setting in a tag? What's the purpose?

        (Also, please include the full scene, not just a screenshot, so the Maxon people don't have to re-type everything...)

        1 Reply Last reply Reply Quote 0
        • ManuelM
          Manuel
          last edited by Manuel

          Hello,

          as @Cairyn said the function SetModelingAxis purpose is to change the modeling axis for some modeling tools only. (Move, Rotate, Scale...?) To see the effect of that function, you must define the axis to free first.

          But, maybe you were expecting this function to move the axis of the object itself. There is no function to do so. You can only move the object axis itself. That will also move the points of the object. Then, you need to move all the points of the object to the original place.

          In this thread, you will find @ferdinand explaining how this works and how to move back the points at their original position.

          I would also point to our matrix manual to understand how they are used.

          If you just want to move the object, you can use SetMg, SetRelPos, SetAbsPos, SetFrozenPos. There are also functions to define Relative, Absolute or Frozen rotation. SetRelRot..etc

          # Define an object's position using matrices.
          def main() -> None:
              m = c4d.Matrix()
              m.off = c4d.Vector(120, 0, 0)
              op.SetMg(m)
              c4d.EventAdd()
          

          Cheers,
          Manuel

          MAXON SDK Specialist

          MAXON Registered Developer

          1 Reply Last reply Reply Quote 0
          • W
            WDP
            last edited by

            Thanks for the script but I just want the axes to change to 0,0,0 and the object to keep the original orientation.

            1 Reply Last reply Reply Quote 0
            • ManuelM
              Manuel
              last edited by

              Hi,

              We do not provide "on demande" script. We are here to share the knowledge and help you to find the information you need, but you must learn how to code and learn how some principales works.

              I provided you a thread where Ferdinand is explaining how it works to move an object to another position. We have a new example in our github repository that will help you to understand how it is done.

              In your case, there is no function that is doing that. You must move the object's axis at the position (0, 0, 0) and move the points at the place they were. It is a two steps operation.

              Cheers,
              Manuel

              MAXON SDK Specialist

              MAXON Registered Developer

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