SOLVED Get port id of xpresso node

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]

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

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

@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?

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

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