Itoo Software Forum

Author Topic: getting the last generated segment  (Read 544 times)


  • Jr. Member
  • **
  • Posts: 93
getting the last generated segment
« on: November 08, 2019, 01:37:13 PM »
Rootquestion: Is there an 'easy' way to get the last generated segment ?

The thing is that I am trying to make are blinds, where I have a slat wired to y evenly, but I want the slat to exist of a start and middle and an end.
I know I can probably solve this with RC4 where I can just wire a linearS1 start/default/end RC into the y evenly of the array2s,
but for the sake of argument (in getting the last segment) I figured to still ask how-to.

I managed with

Code: [Select]
return if((SegmentXCounter==1),1,
*input1 being the width

But that only works if the segments are equally sized and even then it doesn't always work,
since at certain  XSplineLength lengths it still returns 2.

Is there a better / easier way to get the last segment ?


  • Administrator
  • Hero Member
  • *****
  • Posts: 4209
    • iToo Software
Re: getting the last generated segment
« Reply #1 on: November 11, 2019, 09:36:26 AM »
No, i'm afraid there is not a simple way to detect the last segment in the "Default" sequence.

Your approximation is correct, but as you noticed it works only for fixed size segments, and doesn't work with all combinations.
You would try a variation of this technique, using XSectionPosition (normalized position in the spline section) and XSectionLength (length of the current spline section), instead XSplineLength.

Remember that a "section" is the spline between two Start/End/Corner/Evenly/Marker Segments. Basically, where Default segments are inserted.

Carlos Quintero
iToo Software


  • Jr. Member
  • **
  • Posts: 93
Re: getting the last generated segment
« Reply #2 on: November 13, 2019, 03:19:47 PM »
to bad.

Guess we have a wishlist item for future versions of railclone.
I can imagine being able to target (get) the last created segment could be useful.

Thanks anyway, guess I'll have to upgrade to RC4  ( which is on the table anyways, so YAY! ;) )