Itoo Software Forum

Author Topic: Scale down to fit segment but not scale up  (Read 3956 times)

junglejuz

  • Newbie
  • *
  • Posts: 17
Scale down to fit segment but not scale up
« on: March 17, 2025, 03:12:10 PM »
I'm using a linear 1s generator with many many different geometry segments of differing lengths. The splines are made up of many different spline segments of equal length. I want the geometry segments to scale down in length (along spline axis) to fit within the spline segments if they are too long, but not scale up if they are too short (so basically clipped at 1) Using the default rule the "Scale" mode scales them regardless of whether they are larger or smaller. So does "Adaptive". Does this require scripting? If so, might someone help me achieve this please?
« Last Edit: March 17, 2025, 04:05:50 PM by junglejuz »

Michal Karmazín

  • iToo Software
  • Hero Member
  • *****
  • Posts: 2925
Re: Scale down to fit segment but not scale up
« Reply #1 on: March 17, 2025, 04:17:43 PM »
Hi,

You can check if the size of the used segment is larger than the spline section using the 'if' condition within the Arithmetic operator (return if(Input1 > XSectionLength, XSectionLength, Input1);). If it is, you can override its size to match it within the Transform Operator. Please find attached a sample scene (250317_XSectionLengthCheck_ITOOSOFT.max). I hope this helps.

Best regards,

junglejuz

  • Newbie
  • *
  • Posts: 17
Re: Scale down to fit segment but not scale up
« Reply #2 on: March 18, 2025, 06:30:05 AM »
Thanks so much for responding with this Michael. I probably should have mentioned that there will be more than one object segment per spline segment. So I need it to scale the last one back. Your setup works only on the first object on the spline segment. Basically I'm trying to fill an entire library of bookshelves with clusters of books, so ideally Railclone should only place a second object per spline segment if more than say 70-75% of that object could fit on that segment. This would help avoid some needing to be scaled back too much and also create some variation with not all shelves being completely full. Here's a link to a stripped back version of my setup.

https://drive.google.com/file/d/1P2W1i8tiLfuX7DUvlsh-bsZ_3wsDF2Th/view?usp=sharing

I really appreciate your help.
« Last Edit: March 18, 2025, 06:55:50 AM by junglejuz »

Michal Karmazín

  • iToo Software
  • Hero Member
  • *****
  • Posts: 2925
Re: Scale down to fit segment but not scale up
« Reply #3 on: March 18, 2025, 09:37:59 AM »
In such a case, using the 'Scale final X seg.' macro would be the recommended way.

Best regards,