I’ve noticed that the Script component doesn’t automatically convert python complex
to GH_Complex
when the output type is set to complex
. For example, when solving a quadratic equation:
Δ = b**2 - 4*a*c
x1 = (-b + Δ**0.5) / (2*a)
x2 = (-b - Δ**0.5) / (2*a)
If the result is complex, the component doesn’t work unless I manually convert the Python complex
to GH_Complex
like this:
from Grasshopper.Kernel.Types import Complex
Δ = b**2 - 4*a*c
x1_complex = (-b + Δ**0.5) / (2*a)
x2_complex = (-b - Δ**0.5) / (2*a)
x1 = Complex(x1_complex.real, x1_complex.imag)
x2 = Complex(x2_complex.real, x2_complex.imag)
@eirannejad if you have time, could you take a look and let me know what you think? Thanks!
complex.gh (7.1 KB)