Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Revit Family 'Tool Palette'

6 REPLIES 6
Reply
Message 1 of 7
gwunz
4063 Views, 6 Replies

Revit Family 'Tool Palette'

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,

6 REPLIES 6
Message 2 of 7
adam.nagy
in reply to: gwunz

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



Adam Nagy
Autodesk Platform Services
Message 3 of 7
cmckeown
in reply to: gwunz

Message 4 of 7
adam.nagy
in reply to: gwunz

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 Nagy
Autodesk Platform Services
Message 5 of 7
gwunz
in reply to: cmckeown

cmckeown,

 

Yes, something like that. 

 

Message 6 of 7
gwunz
in reply to: adam.nagy

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. 

Message 7 of 7
gwunz
in reply to: gwunz

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.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community