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

    Error in Python node outputs

    Scheduled Pinned Locked Moved Bugs
    2 Posts 0 Posters 479 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 15/02/2015 at 00:05, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R12 
      Platform:      
      Language(s) :      XPRESSO  ;

      ---------
      Hi,
        I run this code in a Python node in Xpresso and i want it to output 1 enable object(bool), 1 Dimension vector and 1 Position vector for each of 3 components called "Base Struttura", "Base Chaise-longue Destra". "Base Chaise-longue Sinistra". In the Xpressso window it looks like this:

      Here instead is the code insite that central Python node
      --------------------------------------------------------------------------------------------
      import c4d
      #Welcome to the world of Python

      def main() :
          #Dichiarazione Nodi di Uscita
          global BS, BS_Dimensione, BS_Posizione
          global CLDx, CLDx_Dimensione, CLDx_Posizione
          global CLSx, CLSx_Dimensione, CLSx_Posizione

      #Assegnazione valori di default
          DafaultBool = False
          DefaultVector = c4d.Vector(0, 0, 0)
          
          BS = DafaultBool
          BS_Dimensione = DefaultVector
          BS_Posizione = DefaultVector

      CLDx = DafaultBool
          CLDx_Dimensione = DefaultVector
          CLDx_Posizione = DefaultVector

      CLSx = DafaultBool
          CLSx_Dimensione = DefaultVector
          CLSx_Posizione = DefaultVector

      #Dimensioni Y (Altezza)
          BS_Dimensione.y = Altezza_Base
          CLDx_Dimensione.y = Altezza_Base
          CLSx_Dimensione.y = Altezza_Base
          #Dimensioni Z (Profondità)
          if Schienale:
              BS_Dimensione.z = Struttura_Profondita - Schienale_Spessore
              CLDx_Dimensione.z = Struttura_Profondita - Schienale_Spessore + ChDx_Sporgenza
              CLSx_Dimensione.z = Struttura_Profondita - Schienale_Spessore + ChSx_Sporgenza
          else:
              BS_Dimensione.z = Struttura_Profondita
              CLDx_Dimensione.z = Struttura_Profondita + ChDx_Sporgenza
              CLSx_Dimensione.z = Struttura_Profondita + ChSx_Sporgenza

      CLSx_Posizione = DefaultVector
          #Suddivisione Casi
          if Segmenti == 1:
              if ChDx:
                  BS = False
                  CLDx = True
                  CLSx = False
              elif ChSx:
                  BS = False
                  CLDx = False
                  CLSx = True
              else:
                  BS = True
                  CLDx = False
                  CLSx = False
          elif Segmenti == 2:
              CLDx = True
          else:
              CLSx = True
      -------------------------------------------------------
      The values of some of this variables at the moment are:
      - Altezza_Base = 22
      - Struttura_Profondita = 90
      - Schienale_Spessore = 8
      - ChDx_Sporgenza = 50
      - ChSx_Sporgenza = 100

      So the output values should be
      - Base Struttura.Position = (0,0,0)
      - Base Chaise-longue Destra.Position = (0,0,0)
      - Base Chaise-longue Sinistra.Position = (0,0,0)

      - Base Struttura.Dimension = (0,22,82)
      - Base Chaise-longue Destra.Dimension = (0,22,132)
      - Base Chaise-longue Sinistra.Dimension = (0,22,182)

      But instead all 6 of these vectors come out as (0,22,182) the value of "CLSx_Dimensione" vector in the code. The fact is that is the last line in which i give a vlue to a vector an therefor (somehow) that' becomes the output calue of any vector coming out of the node. I even to give value to "CLDx_Dimensione" for last to prove my theory and it confirmed it (al the outputs were (0,22,132)).
      I don't know why this node behaves like this, maybe i'm missing something (i'm relatively new to both Xpresso and python).

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

        On 17/02/2015 at 06:17, xxxxxxxx wrote:

        Hello,

        I cannot confirm such behavior. Are there any error messages in the console? Can you provide a more simple example that reproduces the described behavior or a complete scene file?

        Please be aware that SDK support can only handle requests for the latest version of Cinema 4D and it's SDKs and cannot provide much support for outdated versions.

        Best wishes,
        Sebastian

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