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

    How I can get only varies values of the coordinate

    Scheduled Pinned Locked Moved PYTHON Development
    5 Posts 0 Posters 552 Views
    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.
    • H Offline
      Helper
      last edited by

      On 22/03/2016 at 06:24, xxxxxxxx wrote:

      https://yadi.sk/i/Umu2SLLxqG4bB
      In the example of the output (the console) output coordinates X and Y independently of whether they change or not.

      How to make the output (the console) shows only varies values of the coordinates?
      For example, if the cube to move along the X axis, the output only to the X
      To move along the Y axis, in the console only changing the values of the coordinates of Y (x is no longer needed, since it does not change)

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 22/03/2016 at 06:47, xxxxxxxx wrote:

        Not really SDK related, right? Check this (very recent) thread to find out how to figure if a
        value changed between frames/execution passes.

        Best,
        Niklas

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 22/03/2016 at 23:57, xxxxxxxx wrote:

          it does not work
          https://yadi.sk/i/2YmF2lqHqQPjJ

          NiklasR, please example

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            On 23/03/2016 at 02:34, xxxxxxxx wrote:

            Hello and welcome,

            could you please copy your code directly into your posts and don't use screenshots? This would make it much easier for everyone to take at look at your code.

            As Niklas pointed out you have to compare the current value with the previous value if you want to check if a value has changed. I would suggest to use some User Data for this (as shown in the linked thread).

            If you want to use a variable within your Python code you must read the error message. To access a global variable in a local scope you have to use the keyword "global". See "What are the rules for local and global variables in Python?" and "Use of "global" keyword in Python".

            best wishes,
            Sebastian

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              On 23/03/2016 at 03:11, xxxxxxxx wrote:

              All it works
              I needed to add the line
              global x0
              global z0
              )))
              I did not know that
              thank you

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