RhinoCommon - raise any event?


#1

Hi All,

I don’t have much experience with RhinoCommon, but wondering, more theoretically for now, if it is possible to raise any event (for example, view change) from code without the event actually occuring?

Thank you,

–jarek


#2

Generally speaking (I don’t know how events are designed in C++) you should be able to frankly call the event method, if it is accessible from where you would want to call it (public or whatever access level needed). If the event has parameters you might have to send nulls or some fake value, but depending on the usecase that might be OK.

// Rolf


(Menno Deij - van Rijswijk) #3

No, this is generally* not possible in C#. Only the object that emits an event can raise it.

* unless you use Reflection, see for example https://stackoverflow.com/questions/198543/how-do-i-raise-an-event-via-reflection-in-net-c


#4

Well, I guess I’m spoiled from my Delphi background with low level method pointers, thinking that languages being closer to the metal than C# is more “general” than JIT compiled languages with garbage collectors.

It appears that ol’ method pointers got fancier in C# being made type safe and guarded. But I assumed the question was about C++, not C#?

// Rolf


(Menno Deij - van Rijswijk) #5

C++ has no events and the OP mentioned RhinoCommon. My guess is C# :slightly_smiling_face:


#6

Well, I have never tried C++ with Rhino so I have no idea what the API for C++ is called.

// Rolf


#7

I think they just call it the Rhino SDK.


#8

Hi All, thanks for the answers.
@menno - I can’t make much of the Reflection code sample. Do you think it would be achievable with Python+RhinoCommon?

–jarek


(Dale Fugier) #9

@Jarek,

Rhino events are only raised by Rhino. That is, you cannot raise a layer table event, for example. However, if you modify a layer, which will cause Rhino to raise a layer table event.

Hope this helps.

– Dale


#10

hi Dale,

thanks, so I cannot just raise any even “at will” from the running script, unless the even actually took place, correct?
I was trying to find a way to make 3rd party plugin respond to view or model changes during script runtime. The plugin’s view updates must be triggered by some events, but it will never update during script runtime. I was looking into this to see if an even can be “forced” to trigger update of the view via trying various events.

thank you,

–jarek


(Dale Fugier) #11

Correct

– D