public class MyPlugin: Rhino.PlugIns.PlugIn
{
public MyPlugin()
{
Instance = this;
RhinoApp.Idle += OnIdle;
}
private void OnIdle(object sender, EventArgs e)
{
RhinoApp.Idle -= OnIdle;
DoSomething();
}
public static MyPlugin Instance
{
get;
private set;
}
public override PlugInLoadTime LoadTime
{
get { return PlugInLoadTime.AtStartup;}
}
DoSomething()
{
//to do what I want
}
}
Rhino will run the function DoSomething() after Rhino open, now I want to change my code to c++,
but I can not find function whicth same effect as this code, which friend can help me?
Hi @ dale:
Get it, think you.
In the sample, I must run the “_SampleIdleProcessor” command, but I want run it when rhino startup.
I means I just want to run some function, turn the event on v…v at rhino startup, in c# it easy to implement, I just need set “RhinoApp.Idle += OnIdle”, and add the “public override PlugInLoadTime LoadTime” function, now I need the same effect in c++.
I have found add the function above cant load plugin at rhino startup,but rhino still print nothing when I do like:
int myfunction(int x, int y)
{
int z = x + y;
return z;
}
BOOL CJewellyForRhinoPlugIn::OnLoadPlugIn()
{
int z = myfunction(1, 2);
RhinoApp().Print(L"%d\n",z);
return CRhinoUtilityPlugIn::OnLoadPlugIn();
}