Hello!
I have an Input parameter called "Construction Slope" of type "Slope" that I would always like to be negative. As i did not find the possibility to restrict end user to inputing only negative value I tried to change the sign of the slope to negative if it is positive by using an "IF" expression (when used as a "Geometry Property" for a new link):
IF(ConstructionSlope<=0,ConstructionSlope,(-1)*ConstructionSlope)
However this expression produces an error: "Compiler error(s) encountered processing expression <...> Cannot infer a common type because more than one type is possible". If i remove multiplication by -1 then the error is gone (and the whole expression becomes meaningless as well of course). See even attached image. Any ideas about how to fix this one would be apprecciated!
BR,
Viktors
Solved! Go to Solution.
Solved by fcernst. Go to Solution.
Solved by viktors.zilinskis. Go to Solution.
I found a workaround actually:
IF(ConstructionSlope<=0,1*ConstructionSlope,(-1)*ConstructionSlope)
Seems like if a slope variable is multiplied by a number then i becomes something else (another type of variable). So if I multiply even the first argument by 1, the problem is gone (both arguments become of the same type as both of them are multiplied by a number). I am not sure my explanation is quite correct but it seems to work at least.
-math.abs(ConstructionSlope)
I find multiplying by 1 better as it doesn't tweak positive/negative unlike math.abs(ConstructionSlope)
Thank you for this post !
I was having headaches today