BHoM / Grasshopper_UI

Tools for Grasshopper
GNU Lesser General Public License v3.0
16 stars 5 forks source link

Move the logic inside `GH_IBHoMGeometry.CastFrom()` to a new `IFromRhino(object obj)` method in Rhinoceros_Toolkit #544

Closed alelom closed 3 years ago

alelom commented 3 years ago

Broken rules:

While testing the Rhinoceros_Toolkit, I realised we cannot do this currently: image

This is because Rhino does not has a parent class for all of its geometries (the highest abstraction it has is GeometryBase but e.g. a Point is not a GeometryBase). Effectively, the highest parent class to Rhino's geometries is System.Object.

However, we can do this: image

This is because we have this logic: https://github.com/BHoM/Grasshopper_Toolkit/blob/97068c716ce0690fd0f1057e1ac6898a47039fc5/Grasshopper_Engine/Objects/Types/GH_IBHoMGeometry.cs#L200-L231

which needed in order to make the Grasshopper Goos work.

However (after a discussion with @al-fisher and @IsakNaslundBh) we realized that the logic should belong to a IFromRhino(object obj) method in Rhinoceros_Toolkit, because this is really a "Convert" logic belonging to Rhino, not Grasshopper. The Grasshopper GH_IBHoMGeometry.CastFrom() method should call Rhino's IFromRhino(object obj).

Suggestions to restore compliance:

Move the logic inside GH_IBHoMGeometry.CastFrom() to a new IFromRhino(object obj) method in Rhinoceros_Toolkit.

adecler commented 3 years ago

@alelom , can you make sure you assign or tag me for issues related to UI ? Makes my life a bit easier when keeping track of what is going on 😄