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 ?
Get the x, y-coordinates of the Point entity in ECMA Script?
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
-
- Registered Member
- Posts: 1
- Joined: Wed Apr 19, 2017 8:13 am
Re: Get the x, y-coordinates of the Point entity in ECMA Script?
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);
}
}