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

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
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: 5332
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 Developers and Contributors”