ITOOSOFT Forum

Author Topic: combining sequence and random segments  (Read 215 times)

tzaar

  • Newbie
  • *
  • Posts: 8
combining sequence and random segments
« on: July 07, 2025, 12:01:54 pm »
Hi!

Is it possible to start with a specific sequence of segments on a spline, and then have the rest of it be random segments? For as long as the spline goes on?
I'm using evenly to distribute my segments on a linear generator.

Michal Karmazín

  • ITOOSOFT
  • Hero Member
  • *****
  • Posts: 3035
Re: combining sequence and random segments
« Reply #1 on: July 07, 2025, 12:27:25 pm »
Hi,

Yes, absolutely - there are several ways to achieve the desired setup. Probably the simplest approach is to use a Compose Operator in Sequence mode connected to the Start input of the generator, and a Randomize Operator wired to the Default input. I hope that helps.

Best regards,

tzaar

  • Newbie
  • *
  • Posts: 8
Re: combining sequence and random segments
« Reply #2 on: July 08, 2025, 11:36:50 am »
Yes, it work. Thank you! But when I use start or default I cannot cancel out the local rotation like you helped me with in my previous post. They just seem to follow the spline in default mode, but in evenly they do. Any new work around to get all the segments (products) facing the same direction? Or how to get the sequence + random working with evenly?

It's not the end of the work if it doesn't I just have to make up a really long sequence my self then.

Michal Karmazín

  • ITOOSOFT
  • Hero Member
  • *****
  • Posts: 3035
Re: combining sequence and random segments
« Reply #3 on: July 08, 2025, 11:49:29 am »
The previously mentioned style setup should work for these inputs as well - just make sure that the Transform Operator with Z Fixed Rotation is correctly wired between them. You can easily copy the operator by dragging it while holding the Shift key. If you run into any issues, feel free to send us your scene and we’ll be happy to take a look.

Best regards,

tzaar

  • Newbie
  • *
  • Posts: 8
Re: combining sequence and random segments
« Reply #4 on: July 08, 2025, 05:14:11 pm »
Gave it some more tries now and it seems that my test scene with just boxes and teapots for segments and a squiggly test spline was hard for RC.

Sharp turns in relation to the segment size seems to produce situations where the rotations "flips out". But just a bit of curvature makes it not completely aligned to the same orientation.
It's maybe mathematically correct, but not the expected result from a user perspective (the same global rotation for every segment). Good news is that with a long smooth spline, results seem better so far, and this is more similar to my actual use case. Will try with my acctual production scene and get back with my result.

Attached a screenshot and also my scene if anyone wants to have a look :)


tzaar

  • Newbie
  • *
  • Posts: 8
Re: combining sequence and random segments
« Reply #5 on: July 08, 2025, 05:14:48 pm »
missed the screenshot

Michal Karmazín

  • ITOOSOFT
  • Hero Member
  • *****
  • Posts: 3035
Re: combining sequence and random segments
« Reply #6 on: Today at 08:42:45 am »
If equal spacing is acceptable, using the Evenly input should help avoid this type of misalignment. Please find attached a modified version of your scene that demonstrates this possible style setup. I hope you find it helpful.

Best regards,

tzaar

  • Newbie
  • *
  • Posts: 8
Re: combining sequence and random segments
« Reply #7 on: Today at 10:18:50 am »
Evently is what I want. I though I'd have to do with default and a padding because I couldn't get it (sequence->random) working. Not sure what your conditional was doing really? It switches when it's on a specifik segment number?

But I've now landed in a final setup that looks like this. It has a manual part of it where one has to tweak the percentage along spline of the conditional to decide wether it uses the sequence or the random. That's fine in my case now. Thought there was a sneaky way of doing it completely automatically. There might be? If one can check how many segments there are in the sequence and then in the conditional (or some other math or scripting node thing that I haven't mastered) check for that amount and then switch to random.

Cheers and thanks for the help!

Michal Karmazín

  • ITOOSOFT
  • Hero Member
  • *****
  • Posts: 3035
Re: combining sequence and random segments
« Reply #8 on: Today at 10:42:34 am »
You're welcome. You can use the Segment > X Counter rule of the Conditional Operator to match the number of items placed by the Sequence Operator before the Randomize Operator takes over. In this case, set the condition to Less than 8. Please find attached a revised version of your scene demonstrating this setup.

Best regards,

tzaar

  • Newbie
  • *
  • Posts: 8
Re: combining sequence and random segments
« Reply #9 on: Today at 11:46:01 am »
Ok that's brilliant! I was a bit tired and though "segment" refered to segment as in the sub-object on a spline. But of course "Segment X" is the number of segments railclone has created on that spline :D