How to convert int number in blendContinuity in C# GH component?

Hello everyone,

After a couple of years of GH-ing I decided to start using C# for scripting as I believe it could open up new design opportunities - in my current application I want to blend 2 curves like I would in Rhino - I would love to use G3 curvature. - well too bad it is not available just yet

Still I have a question, and sorry if it is a a rookie question :slight_smile: :
Using that function : Curve.CreateBlendCurve Method (Curve, Curve, BlendContinuity, Double, Double) How do you convert your integer into a blendContinuity - thingy ? (you can see my barabarious try in the second screenshot… did not work !)

here is the script if need be :
Blend G3 test Csharp.gh (6.3 KB)

Thank you for reading

Enumerations can simply being “casted” as they act as an alias for a given integer number.

BlendContinuity a = (BlendContinuity) b
int b =(int) a.

Enums can also be created using other value types, such as short or byte. Then you need to cast to respective types.

Hello Tom tomtom.

Not sure to completely follow you here. As you mention that it can be directy “casted” I gave it a try - see my screen shot below where I highlighted how I try to pass the continuity integer to the script. it did not work, probably a syntax error, but I am not sure to understand what I am doing wrong - here is my error message

“The type or namespace name ‘Blendcontinuity’ could not be found (are you missing a using directive or an assembly reference?)” (line 47)

Second yellow box, please type:

BlendContinuity bc = (BlendContinuity) continuity.

1 Like

Thanks ! One last question if I may :slight_smile:

Now it seems that my b curve cannot be sent out into a (my output) I tried to add (Curve) before my final a (line 56) but did not work either, I wrote : b = (curve) a;

a = b

not the other way around… :slight_smile:

1 Like

Of course !
Thank you very much, Yepee my fisrt code !