About Mouse Click Event

About Mouse Click Event

Anonymous
Not applicable
3,180 Views
8 Replies
Message 1 of 9

About Mouse Click Event

Anonymous
Not applicable

I am thinking about some Revit API such that I can select a lamp, and using "double click" or "right click" with mouse to do something.

 

Is there some function can be used for the application above?

 

Thanks !

0 Likes
3,181 Views
8 Replies
Replies (8)
Message 2 of 9

jeremytammik
Autodesk
Autodesk

Dear Wyfeng,

 

The Revit API does not provide any specific support for this whatsoever.

 

Also, I am not sure whether it will help you users if you modify the behaviour of the standard Revit user interface. I would suggest always working with the system, not against it.

 

There is nothing to stop you from using the Windows and .NET API to determine the single and double clicks and doing what you like with them.

 

However, always be aware that you need to be inside a valid Revit API context to make calls to the Revit API.

 

If you use the Windows API to determine a mouse click, you will not be in a valid Revit API context; you will basically be in a modeless context and driving Revit from outside if you wish to access the API:

 

http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.28

 

It is possible to determine what element is under the mouse cursor, once you have access to Revit API functionality:

 

http://thebuildingcoder.typepad.com/blog/2012/10/uiview-windows-coordinates-referenceintersector-and...

 

Good luck playing with this!

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 9

jeremytammik
Autodesk
Autodesk

Cleaned up and published my answer:

 

http://thebuildingcoder.typepad.com/blog/2015/07/clicks-dmu-surfaces-firerating-feedback-vacation.ht...

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 4 of 9

cfutchaZFHEP
Explorer
Explorer

Is there an actual namespace or class in the Revit UI API that handles basic Revit events like mouse click, orbit, zoom, pan, etc...?

0 Likes
Message 5 of 9

jeremytammik
Autodesk
Autodesk

I suggest you read the getting started material, since it also describes the available documentation and resources:

 

https://thebuildingcoder.typepad.com/blog/about-the-author.html#2

 

The Revit API documentation provides a list of all namespaces, classes, methods and properties:

 

https://www.revitapidocs.com

 

The functionality you request is partially handled by the Autodesk.Revit.UI.Selection namespace:

 

https://www.revitapidocs.com/2020/11785869-cc9e-03fc-97db-767a59af10a1.htm

 

As hinted at above, it does not provide much in the way of what you are asking for.

 

Probably, most of what you mean is not supported at all by the Revit API.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 6 of 9

cfutchaZFHEP
Explorer
Explorer

Hi Jeremy,

Thank you very much for your response. I took a look at the links that you sent and it seems the Revit API provides limited access to those basic events. Is there any other way to be able to edit them than through the Revit API?

0 Likes
Message 7 of 9

jeremytammik
Autodesk
Autodesk

Thank you for your appreciation.

 

Yes, absolutely.

 

Please read the previous answers above.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 8 of 9

cfutchaZFHEP
Explorer
Explorer

Maybe there is something I’m missing here but it seems that all the links that you provided above refer only to the Revit API

0 Likes
Message 9 of 9

jeremytammik
Autodesk
Autodesk

Ha, ha, ha.

 

Are you aware that this discussion forum s dedicated exclusively to the Revit API?

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes