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

    Get port id of xpresso node

    Cinema 4D SDK
    python s24
    3
    6
    1.1k
    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.
    • ROMANR
      ROMAN
      last edited by ferdinand

      Dear community!

      I want to create length port for spline node but I can’t find correct command for it.
      How to get id of port in form like this
      c4d.GV_PORT_OUTPUT, [c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_X]

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

        Hello @ROMAN,

        thank you for reaching out to us. Please remember to add the required information to your posting as stated in the Forum Guidelines: Tagging. It is getting a bit out of hand in the last time that people skip that information. If we do not need it, we sometimes do not bring up the issue, but it is always formally required.

        Symbol IDs can be found either in our SDK Documentation, .e.g., Spline Operator, or by using a grep-like tool to search the description resources of Cinema 4D (I personally really like Agent Ransanck). This will then uncover that the information is contained in the file gvspline.res which has the content:

        CONTAINER GVspline
        {
            NAME GVspline;
            INCLUDE GVbase;
        
            GROUP ID_GVPROPERTIES
            {
                LONG GV_SPLINE_MODE { CYCLE { GV_SPLINE_OPERATOR_MODE_GLOBAL; GV_SPLINE_OPERATOR_MODE_LOCAL; } }
                BOOL GV_SPLINE_USE_NATURAL { }
                BOOL GV_SPLINE_ALL_SEGMENTS { }
            }
        
            GROUP ID_GVPORTS
            {
                GVGENERALOBJECT GV_SPLINE_INPUT_OBJECT { INPORT; STATICPORT; CREATEPORT; }
                REAL GV_SPLINE_INPUT_POINT { INPORT; STATICPORT; CREATEPORT; UNIT PERCENT; MIN 0; MAX 100; }
                LONG GV_SPLINE_INPUT_SEGMENT { INPORT; MIN 0; }
        
                VECTOR GV_SPLINE_OUTPUT_POSITION { OUTPORT; CREATEPORT; }
                VECTOR GV_SPLINE_OUTPUT_TANGENT { OUTPORT; }
                REAL GV_SPLINE_OUTPUT_LENGTH { OUTPORT; }
                BOOL GV_SPLINE_OUTPUT_IS_CLOSED { OUTPORT; }
                LONG GV_SPLINE_OUTPUT_SEGMENTS { OUTPORT; }
            }
        }
        

        I personally prefer the latter, but don't tell @m_adam he worked hard on the symbol parsing for the documentation ;). Adding a spline length output port can be done therefore like this:

        port = Spline.AddPort(c4d.GV_PORT_OUTPUT, c4d.GV_SPLINE_OUTPUT_LENGTH, c4d.GV_PORT_FLAG_IS_VISIBLE, True)
        

        b25d8988-627d-4974-bc11-999a1de148d5-image.png

        There are also other ways to identify graph view ports, I went over them here, you only need to read the part # added by Ferdinand. And finally, there was a bug in GvNode.AddPort which made it impossible to use (in most cases) prior to R23 in the Python SDK. There are unfortunately no ways around that bug in versions before R23.

        Cheers,
        Ferdinand

        MAXON SDK Specialist
        developers.maxon.net

        ROMANR 1 Reply Last reply Reply Quote 1
        • ROMANR
          ROMAN @ferdinand
          last edited by

          @ferdinand Thank you a lot for your help! I'm really sorry for organization of my post. Could you point out on my mistakes in tagging?

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

            Hello @Roman,

            your posting is missing information about the programming and OS environment(s), as well as the user version(s) of Cinema 4D. The procedures are all described in our Forum Guidlelines under the section Forum Structure and Features: Tagging.

            We have to enforce these rules as that information is at least partially always relevant for answering questions. E.g., in your case due to the fact that GvNode.AddPort behaves differently prior to R23 and that you want to use Python. Often some of that information can be decuced by us, but it makes answering question then harder, as one then has often to describe multiple scenarios, as one can never be certain. In the worst case scenario we will give the user incorrect information, simply because we assume some condition which is not true.

            There is however no need to be sorry, nor do you have to do it retoactively. I have allready added the tag Python and S24 to your post. But please follow these rules in future postings.

            Cheers,
            Ferdinand

            MAXON SDK Specialist
            developers.maxon.net

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

              Hello @ROMAN,

              without further questions or replies, we will consider this topic as solved by Monday, the 30th and flag it accordingly.

              Thank you for your understanding,
              Ferdinand

              MAXON SDK Specialist
              developers.maxon.net

              1 Reply Last reply Reply Quote 0
              • kbarK
                kbar
                last edited by

                Was just searching for something related and came across this post and thought I would also point out my site that also displays all the data from the resource files.

                https://plugins4d.com/Description/Nodes

                Here is the page for GVSpline: https://plugins4d.com/Description/Node?containerName=GVspline

                It is similar to the documentation now supplied in the official maxon docs.

                https://www.gamelogicdesign.com
                https://www.plugins4d.com

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