BHoM / Grasshopper_UI

Tools for Grasshopper
GNU Lesser General Public License v3.0
15 stars 4 forks source link

Replace all Param_ScriptVariable with our own solution #543

Closed adecler closed 3 years ago

adecler commented 3 years ago

Description:

This is required to get access to CastFrom(object source) and CastTo<Q>(ref Q target) methods. This will solve the problem of Rhino geometry not being casted back and forth (e.g. CreateCustom & GetProperty components).

Related issues:

This will have to be done for 4.0 instead of 3.3 since this represent a change that can potentially break the components using Param_ScriptVariable.

epignatelli commented 3 years ago

See #540 for more.

I think we never return converted BHoM geometries, we always return BHoM Geometries. When a downstream component requests a different type the casting happens "on the wire", but the output of the component is still a BHoM Geometry. The problem comes from the fact that that the we return a string representation of the BHoM Geometries exactly equal to the gh one, and that is hugely misleading! https://github.com/BHoM/Grasshopper_Toolkit/blob/700b8ef1b3aa3b16993d4eb25a28a4453b6f4397/Grasshopper_Engine/Objects/Types/GH_IBHoMGeometry.cs#L99-L147 Maybe something like this might be clearer.

m_Value?.GetType().ToString() + " as " + GH_Format.FormatArc((Rhino.Geometry.Arc)value)