QCAD API get coordinates and MergeDrawings.js

Use this forum to ask questions about how to do things in QCAD.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
sperez
Junior Member
Posts: 11
Joined: Thu Apr 25, 2019 4:41 pm

QCAD API get coordinates and MergeDrawings.js

Post by sperez » Thu Apr 25, 2019 4:47 pm

Is it possible to know the coordinates of the bounds of a dwg and the center of it ? We have a big city cad map splitted on a lot of mini-maps and we want to know via a script the center and the bounds in coordinates of this maps

And a second question : Is it possible to get access to the source code in a pro version of MergeDrawings.js in order to know how to join these files in one file in my own script.

Thanks in advance

Santiago Pérez

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

Re: QCAD API get coordinates and MergeDrawings.js

Post by andrew » Thu Apr 25, 2019 6:51 pm

Yes, that's possible.

Code: Select all

// the bounding box of a drawing document (doc):
var bbox = doc.getBoundingBox();

// center of bounding box:
var center = bbox.getCenter();
Sources for MergeDrawings:

https://github.com/qcad/qcad/tree/maste ... geDrawings

sperez
Junior Member
Posts: 11
Joined: Thu Apr 25, 2019 4:41 pm

Re: QCAD API get coordinates and MergeDrawings.js

Post by sperez » Tue May 07, 2019 9:44 am

Thanks a lot . It works perfectly.

Post Reply

Return to “QCAD 'How Do I' Questions”