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

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

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
pietro_72_
Full Member
Posts: 81
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: 9037
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: 81
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: 81
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 Programming, Script Programming and Contributing”