I am sorry about that. Well, maybe GH2 will had different type conversion rules. And they may (or may not) be less impacting on performance. Still, a good Grasshopper developer, develops components with these in mind. (Some ad-hoc exceptions might be OK when performance is paramount).
Let’s see examples…
If you use
No Hint, and internally your class expects a
Rhino.Geometry.Brep object, and your user inputs a closed planar
Rhino.Geometry.Curve, your component will not work. If, on the other hand, you use the right Type Hint (Brep), the Curve will be converted to a Brep before it is passed to the component. Your code will only have to deal with the Brep case.
You are creating something similar to the ‘UnitX vector’ component… If your input ‘F’ has Type Hint set to ‘float’ and your user inputs a curve, its length is computed. This will work in the same way as the native component. If your component does not use Hints, then it’s (slightly, or heavily, depending on how ‘important’ the conversion is) non-standard. Or you will have to check the type of the input, then if it’s a curve compute its length, for a brep compute the area, for an interval compute the span, ect… very boring code.
We fully understand your wish, but Grasshopper works in a specific way and replacing the logic will not work at this point of its release cycle. There’s the option to allow to switch to another default. But which one? not
No Hint by default, because of the examples above. Actually helping users choose the ‘right’ Hint is the best we can do to beginners and for developers alike.
Finally, if you create a lot of ‘your own’ types or really want to go for custom behavior, then
No Hint will make sense for you. In that case, then we may probably add an option for a default. It’s a wish, and it’s possible… and it’s here.
There is also an easy way to fix this if you really hate this default (please: develop with the conversion standards in mind). You can use this “PyN” component (user object with two type hints set to ‘No type hint’). Or create your different default component that you better like (different starting text, different hints, different names…).
Python No Hint.ghuser (2.2 KB)