Itoo Software Forum

Author Topic: Generator offset limited by min-max  (Read 153 times)

arch3d

  • Full Member
  • ***
  • Posts: 111
    • arch3d.pl
Generator offset limited by min-max
« on: January 22, 2021, 06:32:40 AM »
Hello,
Sorry for bother you again,
This time I would like to define Z-Offset for Generator. For minimum (scene units)->0%, for maximum (in scene units as well) ->100%

Thanks

« Last Edit: January 22, 2021, 06:38:37 AM by arch3d »

Rokas

  • iToo Software
  • Hero Member
  • *****
  • Posts: 2917
    • iToo
Re: Generator offset limited by min-max
« Reply #1 on: January 22, 2021, 07:41:02 AM »
Hi

I don't understand what You want to do, anyway You can't plug varying value to Z offset. As far as I understand, it is calculated/evaluated only once.
You need to use segments z offset.
Rokas
iToo Software

Dragan

  • Hero Member
  • *****
  • Posts: 636
Re: Generator offset limited by min-max
« Reply #2 on: January 22, 2021, 07:44:32 AM »
If you want to limit input range between 0 > 100%  then only one input is enough.

Return
If(input1>100,100,
if(input1<0,0,input1));

If you want to limit input range between min > max as your example then:

Return
If(input3>input2,input2,
if(input3<input1,input1,input3));

« Last Edit: January 22, 2021, 08:35:02 AM by Dragan »

arch3d

  • Full Member
  • ***
  • Posts: 111
    • arch3d.pl
Re: Generator offset limited by min-max
« Reply #3 on: January 22, 2021, 10:45:38 AM »
Rokas i hope screen will explain what i was trynig to do.
Dragan thank you -  it works well if i have same units. This time i was trying to do convertion min in cm->0%, max in cm->100%.

Rokas

  • iToo Software
  • Hero Member
  • *****
  • Posts: 2917
    • iToo
Re: Generator offset limited by min-max
« Reply #4 on: January 22, 2021, 10:56:42 AM »
I am not sure i understand. If I do, then You want to use this expression:
return (Input2-Input1)*Input3/100+Input1;
Rokas
iToo Software

arch3d

  • Full Member
  • ***
  • Posts: 111
    • arch3d.pl
Re: Generator offset limited by min-max
« Reply #5 on: January 22, 2021, 11:04:58 AM »
Perfect!
I was looking for this piece of code:)

Thank you