ITOOSOFT Forum

Author Topic: XSplineMatID and XSectionLength (+ more) are returning wrong values in RailClone  (Read 194 times)

ES-GBG

  • Newbie
  • *
  • Posts: 1
I have a Linear Generator that should run only on Spline Material ID3.
Along with that, 2 Linear Generators run on ID1 and 2 Linear Generators on ID2.

But when I evaluate the attributes, the values make no sense (see attached screenshot).

print XSectionNextLength; = returns 4 (should be 9, instead it shows 8/2)
print XSectionLength; = returns 4 (should be 3, instead it shows 8/2)
print XSectionPrevLength; = returns 0 (should be 8 )
print XSplineLength; = returns 8 (should be 3)
print XSplineNextMatID; = returns 2 (should be 1)
print XSplineMatID; = returns 2 (should be 3)
print XSplinePrevMatID; = returns 1 (should be 2)

---

And if I move vertices so that the ID2 segment changes length from 8 meters to 7 meters,
the following values change, as if RailClone is reading the wrong section altogether.

print XSectionNextLength; = returns 3.5 (should be 9, instead it shows 7/2)
print XSectionLength; = returns 3.5 (should be 3, instead it shows 7/2)
print XSplineLength; = returns 7 (should be 3)

---

If I disable the generators on ID1 and ID2 I get this output, with more correct values. Splitting the generators to separated RC-objects is not an option though:

print XSectionNextLength; = returns 0 (ehh?)
print XSectionLength; = returns 3 (correct!)
print XSectionPrevLength; = returns 0 (ehh?)
print XSplineLength; = returns 3 (correct!)
print XSplineNextMatID; = returns 1 (correct i guess?)
print XSplineMatID; = returns 3 (correct!)
print XSplinePrevMatID; = returns 1 (should be 2?)

---

This is not an edge case – it’s basic logic. If a generator is running on ID3, then XSplineMatID under all circumstances must return 3. No excuses. Same with section lengths: they must reflect the actual geometry, not random values from neighboring IDs.

I’ve spent 10–15 hours trying to troubleshoot this and it makes no sense.

Is this a known bug and when can we expect a fix?

Michal Karmazín

  • ITOOSOFT
  • Hero Member
  • *****
  • Posts: 3105
Hi,

When the Limits > Material ID feature is used, it changes how the object is built and how the base spline is interpreted. Instead of relying on this feature, I’d recommend a slightly different style setup using either the Conditional or Selector Operator to choose a Segment based on the Material ID. This way, the calculation runs across all spline sections and produces predictable results. Please find attached a sample scene demonstrating this approach. I hope it helps.

Best regadrs,