Grasshopper

generative 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

Tags: Dlubal, Rstab, Vb, busy, server, withevent

Views: 389

Reply to This

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.

Hey RubberDuck,

happy new year first!

 

And, this sounds interesting.

Did you have the time to look for the code?

It would be very interesting for me to look into it.

 

Thanks in advance

Thorsten

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.

Hi Steve,

and thank you very much !!

I thought I had to differenciate between Com-linked applikations and other OLE-linked ones like Excel, but this ...displayOleAlerts(false) does work fine.

 

Can't thank you enough,

Thorsten

RSS

Translate

Search Grasshopper

Members

Photos

  • Add Photos
  • View All

© 2012   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service