Page 1 of 1

Getting minimum / maximum coordinates or bounding box

Posted: Mon Apr 24, 2017 8:41 am
by andrew
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?

Re: Getting minimum / maximum coordinates or bounding box

Posted: Mon Apr 24, 2017 8:42 am
by andrew
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);