Mosplines - Iterate Width



  • Hi,

    I wonder if there is a way to manipulate the width of a mospline independently for each spline.

    As example: I have six splines merged together. Every spline has it's own radius, from 1 to 6. I have the iteration done in Xpresso so I print in console - 1,2,3,4,5,6. I would like to send this data into a Mosplines and iterate their size.

    Is possible to do that?

    Cheers


  • Global Moderator

    Hello,

    I'm afraid, I did not understand your setup or what you are trying to achieve. Maybe you can post some screenshot along some more detailed explanation?

    Please also consider setting tags to your threads, see Read Before Posting.
    I also changed your thread into a question, see Q&A New Functionality.

    Thanks,
    Andreas



  • @a_block Hi, thanks for your reply.

    I am going to explain it further, I have this little setup:

    At the first frame particles spawn inside a plane surface, each one with different radius are correctly placed so no one intersect each other.

    0_1539898684970_01_Initial State.PNG
    Particles move alone the Y axis, depending on their radius. Smaller radius will travel more distance.

    0_1539899099922_final Lenght (Y axis).PNG

    This distance is traced and converted into splines.

    0_1539899201975_tracer-splines.PNG

    This splines are linked into a MoSpline. (with width 12)

    0_1539899264977_splines_INTO_Mosplines.PNG

    I have the particle radius values and index number.

    0_1539899319560_radius values.PNG

    I want to send this values to the MoSpline Object and change the width with my radius values (or range-mapped depending on the needs)

    0_1539899428829_MoSplines_Width.PNG

    I see there is no special node for MoSplines in Xpresso, so I wonder if there is a way to access and manipulate this value with Python.

    Cheers


  • Global Moderator

    Hi,

    thanks for providing us with additional details.
    There's not a direct way to achieve this as the MoSpline only has one width parameter and it's not possible to split this for segments of the input spline.

    But if you unfold the width parameter (the small black triangle at the beginning) you are being offered a Formula parameter. By this you can achieve it, even if the way seems a bit twisted.
    With the Formula you can do something like this:
    if (segment == 0; 0.5; if (segment == 1; 1.0; 0.0))
    The syntax is if (cond; cond is true value; cond is false value). In my example above it will set the radius to 0.5 if segment index is zero and then in the "else branch" there's another nested if clause, setting the radius to 1.0 for segment index equal 1 and for all other segments it sets the radius to 0.0. By nesting more and more if clauses you can basically achieve, what you want. And you could use either Xpresso or a Python Tag to concatenate the formula string as needed.

    Not the most straight forward solution. But it should do the trick.

    I have moved this thread to Cinema 4D Development category.

    Cheers,
    Andreas



  • Hi Andreas,

    really appreciate the help. I understand the formula, but Do I need to write one by one each segment?

    I am not sure about how to concatenate the formula string via Xpresso.

    I am trying to share my c4d scene but it seem that uploads are disable.

    Cheers