Dear all, I hope you can help me.
In the PretconGhAssemblyLoad : GH_AssemblyPriority class I have the following:
as you can see in the override GH_LoadingInstruction PriorityLoad(), I’m using autofac to create a single class to deal with modelling units in Rhino. I chose autofac, thinking that it could be more efficient than having every node in the plugin check the units from the Rhino document.
public class PretconGhAssemblyLoad : GH_AssemblyPriority { public static IContainer Container { get; set; } public override GH_LoadingInstruction PriorityLoad() { if (all_going_well) { var builder = new Autofac.ContainerBuilder(); builder.RegisterType<Cs_Standards>().As<IService>().SingleInstance(); Container = builder.Build(); return GH_LoadingInstruction.Proceed; } else { return GH_LoadingInstruction.Abort; } } }
The idea works fine until I start the plugin when Rhino is in Rhino.Inside.Revit mode because I want to be able to design from Revit too. All the nodes that implement the Load.Container are not being loaded in the plugin.
I get this error for every node implementing the Autofac container.
Object: SeatView (level 1)
{
Exception has been thrown by the target of an invocation.
TargetInvocationException
}Object: SeatView (level 2)
{
Method not found: ‘Boolean System.Diagnostics.DiagnosticListener.IsEnabled()’.
MissingMethodException
}
It seems to me that when the GH plugin is called in RIR mode, it does not follow the traditional route to call the class PretconGhAssemblyLoad : GH_AssemblyPriority as a first step to load the plugin.
If I’m right, what alternatives do I have?
What is the first class called in a GH plugin when the plugin is loaded in RIR mode?
Any help will be very much appreciated.
Thanks in advance.
Carlos.