From 58394573eef780c97b8bc6cae427897046cb8673 Mon Sep 17 00:00:00 2001 From: Isak Naslund Date: Mon, 23 Jan 2023 12:04:09 +0100 Subject: [PATCH] Add concrete dispatching over as dynamic Fix for now. Previous code should, and was, working, but stopped. Changing to explicit type checking and casting to make code work for now --- Robot_Adapter/CRUD/Create/Loads/Loads.cs | 25 +++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/Robot_Adapter/CRUD/Create/Loads/Loads.cs b/Robot_Adapter/CRUD/Create/Loads/Loads.cs index c3a17b1a..933b933f 100644 --- a/Robot_Adapter/CRUD/Create/Loads/Loads.cs +++ b/Robot_Adapter/CRUD/Create/Loads/Loads.cs @@ -27,6 +27,7 @@ using BH.Engine.Structure; using System.Linq; using RobotOM; +using BH.oM.Structure.Elements; namespace BH.Adapter.Robot { @@ -61,7 +62,29 @@ private bool CreateCollection(IEnumerable loads) private bool ICheckLoad(ILoad load) { - return CheckLoad(load as dynamic); + //Dynamic dispatching should be working, and was working up to a point where it all of a sudden stopped. + //SHould try commenting out this line of code, and/or make a bigger investigation as to why dynamic dispatching is causing an issue in Robot toolkit + //Code further down as a fix for now + + //return CheckLoad(load as dynamic); + + //This _should_ not be needed. as dynamic call above _should_ work and _was_ working. + if(load is IElementLoad) + return CheckLoad(load as IElementLoad); + if(load is IElementLoad) + return CheckLoad(load as IElementLoad); + if(load is IElementLoad) + return CheckLoad(load as IElementLoad); + if(load is IElementLoad) + return CheckLoad(load as IElementLoad); + if (load is IElementLoad) + return CheckLoad(load as IElementLoad); + if (load is IElementLoad) + return CheckLoad(load as IElementLoad); + if(load is IElementLoad) + return CheckLoad(load as IElementLoad); + + return CheckLoad(load); } /***************************************************/