How to get the id of an entity with a clik and / or with the pointer overlap

Discussion forum for contributors and developers who are using the QCAD ECMAScript development platform or the C++ plugin interface or who are otherwise looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Post Reply
pietro_72_
Full Member
Posts: 77
Joined: Fri Apr 17, 2015 6:40 am
Location: http://creativitainformaticart.altervista.org

How to get the id of an entity with a clik and / or with the pointer overlap

Post by pietro_72_ » Fri Dec 06, 2019 9:48 am

Hi
How can I get the id of a point entity when I click on it with the mouse and / or when I go over it with the mouse pointer

User avatar
andrew
Site Admin
Posts: 6922
Joined: Fri Mar 30, 2007 6:07 am

Re: How to get the id of an entity with a clik and / or with the pointer overlap

Post by andrew » Fri Dec 06, 2019 2:37 pm

If you have the entity, you can use:

Code: Select all

var id = entity->getId();
If you don't have the entity, you can get the one closest to the mouse cursor with:

Code: Select all

this.getEntityId(event, false, true);
Where event is an RInputEvent (mouse move event or mouse click event).

Defined in:

Code: Select all

EAction.prototype.getEntityId = function(event, preview, selectable)

event RInputEvent
preview for previewing purposes
selectable Only return selectable (editable) entities

pietro_72_
Full Member
Posts: 77
Joined: Fri Apr 17, 2015 6:40 am
Location: http://creativitainformaticart.altervista.org

Re: How to get the id of an entity with a clik and / or with the pointer overlap

Post by pietro_72_ » Fri Dec 06, 2019 3:25 pm

Thanks Andrew

pietro_72_
Full Member
Posts: 77
Joined: Fri Apr 17, 2015 6:40 am
Location: http://creativitainformaticart.altervista.org

Re: How to get the id of an entity with a clik and / or with the pointer overlap

Post by pietro_72_ » Fri Dec 13, 2019 8:29 am

I succeeded by also taking cues from Cross.js

Post Reply

Return to “QCAD Developers and Contributors”