I am attempting to create the equivalent of an Autocad Tool Palette in Revit for Families.
I can get a command to work that will compile a list of families and the command will open a Windows Form. However, what I want to do is be able to pull a family from the Windows Form into revit. I need it to check for existance of the family before insert. I think I understand how to check this.
What I think I need is to use the Idling event so that I can drag from the windows form into revit, have it do a check for existance and insert accordingly. I have come across many examples of how to use the idling event in C# and I have attempted to pick these apart and analyze, but have not had success in converting over to usable VB.net Code. In particular, here is the line that is giving me issues:
m_revitApp.Idling += NewEventHandler(OfIdlingEventArgs)(OnIdling)
I am getting an error that states:
Public Event Idling(sender As Object, e As Autodesk.Revit.UI.Events.IdlingEventArgs)' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.
I guess ultimately what I am attempting to do is execute my custom command from my windows form. I assume I need to make use of the idling event. Any ideas how I can use the idling event to envoke my custom command from the windows form? or is there a better method?
Thanks,
Hi,
In case of VB.NET you need to use AddHandler to subscribe to an event.
If you just search for "AddHandler Revit Idling" then you'll find sample codes for this.
I hope this helps.
Cheers,
Adam Nagy
Autodesk Developer Network
you mean something link this? http://revitfb.blogspot.com.au/p/tutorial-videos.html
I meant something like this: http://spiderinnet.typepad.com/blog/2011/07/revit-api-and-vbnet-uiapplication-event-implementation-i...
Where the code has this:
AddHandler uiApp.Idling, AddressOf UIAppEventHandlers1.UIAppEvent_Idling_Handler
adam,
yes, I had seen this before but just could not get it to work. but your suggestion of the Addhandler word did it for me. Thanks so much.
My next question is that am I headed in the right direction with the idling event for what I am trying to accomplish? Or is there a better method? I realize registering with the idling event can cause slightly slower performance.