C# Scripting doesn't execute Math.Sqrt or Math.Pow

Hi All,

i’m currently developing a C# script for spherical harmonics projection. I don’t know why but some base function i can’t visualize.

I isolated the mistake to:

Could it be a problem with Math.Sqrt or Math.Pow?

Kind regards
ProblemCScripting.gh (8.2 KB)

@Weber_Simon - it looks like you are using Rhino 7. Is this correct?

– Dale

Yes thats correct

Hi @Weber_Simon,

Rather than this:

if (M == 0 & L == 2)

You might to this:

if (M == 0 && L == 2)

– Dale

Hi Dale,

I tried it but it with && still doesn’t work. I instead insolated the following to an own c# script:

It gives me a null.

It might be with the different decimals.




Most likely due to performing the calculation with an integer, which truncates the result to 0.
Try with 5.0 and 16.0 instead.

Thanks for that. Now it works