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

    Access to the coordinate manager.

    Cinema 4D SDK
    2023 python windows
    2
    3
    598
    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 SmetK

      Hello everyone, I want to make a script that will align an object with wronged axes using the "Align Workplane to Selection" command. But the problem is that I don't understand how to access the coordinate manager so that I can use it to reset all values in world coordinate mode. Tell me, how can I achieve this? Screenshot example:

      Untitled-1.jpg

      ferdinandF 1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand @SmetK
        last edited by ferdinand

        Hello @SmetK,

        thank you for reaching out to us. We never expose GUIs (managers) in our APIs but instead the logic behind them. So, for example, we do not expose the Object Manager, but GeListNode and with it methods like GetUp, InsertAfter, or Remove which encapsulate the core functionalities of the Object Manager of arranging objects and tags.

        The same applies to your question, the Coordinate Manager is simply not exposed as it is just GUI fluff for more fundamental functionalities. There are some convenience methods like BaseObject.GetAbsPos, BaseObject.GetAbsScale, and BaseObject.GetAbsRot which in a certain sense mimic what the Coordinate Manager does. But under the hood everything is transform (matrix) based and you should operate with transforms too, everything else just tends to be a pain in the ***. You can have a look at our Matrix Manual in case you need an introduction.

        What comes on to top of that, is the fact that the axis of an object is not the separately manipulate able entity in the API as it is in the app. There is no function to "move" an axis because in the API and object has no axis, it has a global and local transform (matrix) which not only determines the transform of the object but also its points. We have the code example operation_transfer_axis_s26.py which exemplifies this at the example of moving "the axis" from one object to another. There are also countless topics on this subject on the forum here.

        Last but not least: Writing a script which does what your screenshot implies, bringing problem into the state of aligned will be very hard without further user inputs. You could compute the bounding box for problem and with that its frame to then compute the delta between that frame and the world frame to "unrotate" the object. But that would just give you an object whose bounding box is somehow aligned with the world frame, your suite case could still be upside down. Also, not all bounding boxes must align with what humans would consider the "natural sides" of a geometry.

        Deciding what is up/down, front/back, and left/right in a model, to compute the orientation which humans consider correct, is a very hard if not unsolvable problem without user inputs. Sometimes we can make simplifications (all my inputs are suite cases and I do not care if they are upside down), but in general the problem is very, very, very hard. Since this is a math/algorithmic problem, it is also out of scope of support, so I cannot help you too much here.

        When there are questions regrading our API, please feel free to ask 🙂

        Cheers,
        Ferdinand

        MAXON SDK Specialist
        developers.maxon.net

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

          @ferdinand Thank you very much for the expanded object.

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