Get the x, y-coordinates of the Point entity in ECMA Script?

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
laxmanporeddy
Registered Member
Posts: 1
Joined: Wed Apr 19, 2017 8:13 am

Get the x, y-coordinates of the Point entity in ECMA Script?

Post by laxmanporeddy » Fri Apr 21, 2017 11:31 am

Question : How can I get the x, y-coordinates of the Point entity in ECMA Script?
I have placed DGN file in one location. In scripting file, I have written code to read that file and created RDocument object.
now I would like to get the x, y-coordinates of the Point entity .
Can you please provide some code snippets how to get coordinates in script ?

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

Re: Get the x, y-coordinates of the Point entity in ECMA Script?

Post by andrew » Fri Apr 21, 2017 2:16 pm

Code: Select all

var doc = new RDocument(...);
...
var entityIds = doc.queryAllEntities();
for (var i = 0; i < entityIds.length; ++i) {
    var entityId = entityIds[i];
    var entity = doc.queryEntity(entityId);
    if (isPointEntity(entity)) {
        qDebug("Point found at coordinate" + entity.getPosition().x + ", " + entity.getPosition().y);
    }
}
You can search the QCAD sources for some of the functions above to find more / other code examples.

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”