I use GeometryGym a lot for IFC exports and also rely heavily on GhPython components for modelling/automation.
But when trying to combine these, I get such errors:
TypeError: GeometryGym.Ifc.DatabaseIfc value cannot be converted to GeometryGym.Ifc.DatabaseIfc in method Void .ctor(GeometryGym.Ifc.DatabaseIfc, System.String, GeometryGym.Ifc.IfcValue)
I suspect, that there is a problem with different assemblies (ggRhinoIfc.dll / ggIFC.gha).
What I’ve discovered:
If I rename or remove ggRhinoIFC.dll before Rhino starts, the script can create an IfcPropertySingleValue just fine.
But then, the next problem appears: If I insert the Rhino created Property into the GeometryGym PropertSet - node, it doesn’t recognize it as IFCProperty, but as “Goo”:
Just to provide some insight here. It would seem that the python environment must load rhino plugins as a priority. So the namespace is common to the gg IFC rhino.dll and the grasshopper .gha dll. I’m not sure if there is a way to configure settings to get it to ignore a plugin or dll. I’m considering if it’s possible to have different namespaces but it might not be practical to do so.
Script editor component does not ‘load’ any plugins. However, to provide python 3, it uses a interop library called PythonNet. This library looks at the loaded dotnet assemblies (.dll, .rhp, .gha, etc.) and creates python 3 types for all the dotnet types defined in these assemblies. So if two different dlls define types with identical canonical name the first one wins. We had this problem with Grasshopper 1 and 2 as well since G2 was using the same Grasshopper namespace and whichever loaded first won the type battle.
Is the type GeometryGym.Ifc.DatabaseIfc type defined in both ggRhinoIfc.dll and ggIFC.gha?
Yes, the same source code files are compiled into multiple dlls. As you observe, in ggRhinoIFC.dll and ggIFC.gha It’s even more prevalent than this, as the same code is also compiled into all our other plugins for Structural Analysis applications.
Any suggestions on how this could be resolved? Unfortunately with so many similar but distinct plugins, it’s not really practical to have a single DLL that is referenced by each plugin.