Spline with closed and open segments



  • Hi,

    the API of the SplineObject seems to suggest, one could have a spline with the open and closed segments (as one can set the closed flag on a per segment basis in SplineObject.SetSegment()). But I simply can't get it to work.

    Basically I'm doing something like the following, always ending up with all open segments:

    import c4d
    
    def main():
        spline = c4d.SplineObject(6, c4d.SPLINETYPE_LINEAR)
        spline.ResizeObject(7, 2)
        spline.SetPoint(0, c4d.Vector(0.0, 0.0, 100.0))
        spline.SetPoint(1, c4d.Vector(100.0, 0.0, 100.0))
        spline.SetPoint(2, c4d.Vector(100.0, 100.0, 100.0))
        spline.SetSegment(0, 3, True)
        spline.SetPoint(3, c4d.Vector(0.0, 0.0, 200.0))
        spline.SetPoint(4, c4d.Vector(100.0, 0.0, 200.0))
        spline.SetPoint(5, c4d.Vector(100.0, 100.0, 200.0))
        spline.SetSegment(1, 3, False)
        spline.Message(c4d.MSG_UPDATE)
        doc.InsertObject(spline)
        c4d.EventAdd()
    
    if __name__=='__main__':
        main()
    

    Playing around with the Spline Pen, I'm somewhat afraid, this feature of the API is not working at all, as the Pen starts working with two spline objects as soon as a segment of the other "openess" gets involved.

    Not urgent at all, I can work with the obvious workaround of multiple splines.
    While writing this, I took a look at the C++ API and now, I'm pretty sure, I can answer the question myself already. In C++ such option does not seem to exist. Strangely so, this additional "closed" parameter in Python is not even optional.

    So, it's maybe more a request for a documentation fix than a real question.

    Cheers,
    Andreas



  • hello Andreas ^^

    As Sebastian pointed to me there's this structure on c++ so we are not sure if it's a documentation issue, something that have never been used or simply a bug.

    I have to dive into the code to have a look and probably send an email.

    I'll be back with information as soon as i have them. (with the release it can take a bit more time than usual)

    Hope you everything is running fine on your side man :)

    Cheers,
    Manuel



  • Thanks, Manuel!
    Indeed I overlooked the C++ Segment struct.
    Take your time.
    Here everything's fine :)



  • hi,
    sorry for the delay of this answer ...

    Well, as you understood, you can't have a spline with open and closed segments. It's global for the entire spline, either all closed or all opened.

    The parameter is there, in the structure. It's sometimes used internally instead of the spline parameter.

    Cheers,
    Manuel



  • Thanks, Manuel, for looking into it.
    Maybe worth a note in the docs? It is a bit confusing, isn't it?
    Cheers to the entire team,
    Andreas