Grasshopper

algorithmic modeling for Rhino

Hi,

 

I use external references for a calculation software (Dlubal Rstab) and for feedback reasons (if the calculation is finished) I need to handle an "event".

 

My try of using this code

"Dim WithEvents IStr As dlubal.RSTAB6.Structure"

does result in th error-message

"WithEvents is not valid on a local variable declaration"

 

Could somebody please explain where or how to dim an event?

 

The reason behind it is, that I get the Windows-error "server busy" because the calculation software needs some minutes to solve the scenario. Since I don't want to skip these messages each time by pressing the "any key" on keyboard, I need grasshopper/windows to wait for the other software.

 

Thanks,

Thorsten

Views: 2009

Replies to This Discussion

The way i accomplish the same problem - waiting for an external program to finish while not causing grasshopper to hang while waiting for the program to finish processing - is to run the program in a back ground thread within your custom component. I dont have the code on me but I believe once the thread has expired I checked the canvas to see if there was a point where there is no current activity - i.e the canvas solution has finished - and then i expire the custom component that started the background thread to the external program by passing any data calculated from the external program as output data to the custom solution. I do remember it was very very tricky. I should be getting back to some coding this week and ill try and see exactly what I did and post something.

Dale Fugier (or similar) exposed a routine to RhinoScript for me a few years back, I've been meaning to ask him to expose it to dotNet library as I haven't found it there.

 

For the time being, I use this code, it should also help you.  I also revert the value at the end of the routine.  Maybe David can advise if it's possible to do this in the dotNET sdk.

 

Cheers,

 

Jon

 

 

object obj;

RhinoScript4.IRhinoScript rs = null;

obj = RhUtil.RhinoApp().GetRhinoScriptInterface();

rs = (RhinoScript4.IRhinoScript)obj;

 

if (rs != null)

rs.DisplayOleAlerts(false);

 

Jon,

You can find this function in RhinoCommon at

Rhino.Runtime.HostUtils.DisplayOleAlerts(bool)

Great news, thanks for letting me know Steve.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service