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

#### arch3d

• Sr. Member
• Posts: 276
##### 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

• Hero Member
• Posts: 3324
##### 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

#### Dragan

• Hero Member
• Posts: 1356
##### 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

• Sr. Member
• Posts: 276
##### 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

• Hero Member
• Posts: 3324
##### 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

#### arch3d

• Sr. Member
• Posts: 276
##### 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