Itoo Software Forum

Author Topic: Expression for changing Selector Index depending on Spline neighbour ID's  (Read 1992 times)

brovar64

  • Newbie
  • *
  • Posts: 5
Hello,

I have a problem here (Digits are ID's):




So I have 3 scenarios:

1: When ID2 and ID3 are alongside
2: When ID3 is alone
3: When ID2 is alone

The problem is, that when ID2 and ID3 touch each other- I want them not to show their Start and End elements. (The screenshot below explains it better  :) )



Any thoughts on how to solve it? Thanks.

Michal Karmazín

  • iToo Software
  • Hero Member
  • *****
  • Posts: 2996
Hi,

Using the Selector Operator driven by an expression should help to "pick" the correct part (XSplineMatID for corners returns the ID of the segment BEFORE the corner and XSplineNextMatID ID of the segment AFTER the corner.):

return if (XSplineMatID==2 && XSplineNextMatID==3, 1, 2)));

I hope that helps.

Best regards,

brovar64

  • Newbie
  • *
  • Posts: 5
Sorry, it seems like I am not able to comprehend the logic of the XSplineNextMatID, or perhaps I am making some mistake. Here is a simplified example of what I had posted earlier (attached max file, saved in max2021)






Based on my understanding, the start and end elements should be NULL, not sphere (btw Selector node is in Index mode) :-X

Michal Karmazín

  • iToo Software
  • Hero Member
  • *****
  • Posts: 2996
Hi,

Thanks for your swift reply. The workflow mentioned previously is meant to be used within the Corner Input only. To enhance possibilities for similar scenarios we added in the latest RailClone Pro 6.0.6 beta 'XSplinePrevMatID' and 'YSplinePrevMatID' attributes to expressions.

I hope that helps.

Best regards,

brovar64

  • Newbie
  • *
  • Posts: 5
Ah, now everything has fallen into place, thank you!