Archicad C++ API
About Archicad add-on development using the C++ API.

How to handle a mouse click in the Floor plan window?

Anonymous
Not applicable
Hello,

Is there a way to handle mouse click events from the ArchiCAD Floor plan window in an Add-on? I need to know the exact cursor coordinates when user clicks somewhere on a selected element in the Floor plan window.

Is it possible? Thank you!
8 REPLIES 8
Ralph Wessel
Mentor
EzPresso wrote:
Is there a way to handle mouse click events from the ArchiCAD Floor plan window in an Add-on? I need to know the exact cursor coordinates when user clicks somewhere on a selected element in the Floor plan window. Is it possible?
Is your add-on prompting the user to click on an element first, i.e. is the add-on active when you want to capture the clicked point? Or do you want to respond to the user selecting an element at any time?
Ralph Wessel BArch
Software Engineer Speckle Systems
Anonymous
Not applicable
Dear Ralph, thank you for asking!

My add-on is active, it implements the ACAPI_Notify_CatchSelectionChange callback function. I need to determine the exact coordinates where the user has clicked on my library part based element which he/she selected first.

I need to implement regular ArchiCAD behavior, as with standard elements like slabs or hatches. In ArchiCAD you need to select slab first, so the editable points appear on the edges. Then you click one of the points to edit it and so.

I would like to implement the same behavior with my library part based objects. The user clicks an object first to select it. Then he clicks on some part of this object and my add-on needs to determine what part he has clicked to run the appropriate edit functionality.
Ralph Wessel
Mentor
EzPresso wrote:
The user clicks an object first to select it. Then he clicks on some part of this object and my add-on needs to determine what part he has clicked to run the appropriate edit functionality.
OK - if I understand you correctly, your add-on traps a change in selection and then you want to prompt the user to click on a point on the selected object. Have you looked at using ACAPI_Interface with APIIo_GetPointID to prompt the user to click on a point?
Ralph Wessel BArch
Software Engineer Speckle Systems
Anonymous
Not applicable
No, this way the user will not be able to modify my objects using standard ArchiCAD tools, use libpart hotspots and so. I don't want to prompt the user to click on a point. I need to determine if the user clicks somewhere on my libpart object while this object is selected. And I need to do it in the background.

May you imagine a 3m x 3m hatch element with an orientation vector?
When I select this hatch element there are 6 black hotspots appear: 4 in element's corners and 2 in orientation vector's start and end points. If I click one of the orientation vector's hotspots then, I can drag this hotspot to another place.

So the behavior I would like to achieve.

Thank you for trying to help me!
Ralph Wessel
Mentor
EzPresso wrote:
May you imagine a 3m x 3m hatch element with an orientation vector?
When I select this hatch element there are 6 black hotspots appear: 4 in element's corners and 2 in orientation vector's start and end points. If I click one of the orientation vector's hotspots then, I can drag this hotspot to another place.
Wouldn't it be easier to do this with GDL? A wide variety of hotspot actions can be defined in the script.
Ralph Wessel BArch
Software Engineer Speckle Systems
Anonymous
Not applicable
Yes in some cases. No if, for instance, I need to edit radius of an arc.
Ralph Wessel
Mentor
EzPresso wrote:
Yes in some cases. No if, for instance, I need to edit radius of an arc.
Wouldn't that be a case of stretching a length, where the base hotspot is the centre of the arc and the moving part is on the circumference?
Ralph Wessel BArch
Software Engineer Speckle Systems
Anonymous
Not applicable
Yes, that's the case.