Getting minimum / maximum coordinates or bounding box

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
User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Getting minimum / maximum coordinates or bounding box

Post by andrew » Mon Apr 24, 2017 8:41 am

From a QCAD user:
How can I find out the bottom / left or minimum coordinate and the top / right or maximum coordinate of a drawing document?

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

Re: Getting minimum / maximum coordinates or bounding box

Post by andrew » Mon Apr 24, 2017 8:42 am

You can get the bounding box (bottom/left and top/right coordinates) of a loaded drawing document as follows (document is of type RDocument):

Code: Select all

var bbox = document.getBoundingBox();
The returned object is of type RBox:

Code: Select all

var bottomLeft = bbox.getMinimum();
var topRight = bbox.getMaximum();
Where bottomLeft and topRight are of type RVector:

Code: Select all

qDebug("minimum x: ", bottomLeft.x);
qDebug("minimum y: ", bottomLeft.y);

qDebug("maximum x: ", topRight.x);
qDebug("maximum y: ", topRight.y);

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”