How can I find out the bottom / left or minimum coordinate and the top / right or maximum coordinate of a drawing document?
Getting minimum / maximum coordinates or bounding box
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.
Getting minimum / maximum coordinates or bounding box
From a QCAD user:
Re: Getting minimum / maximum coordinates or bounding box
You can get the bounding box (bottom/left and top/right coordinates) of a loaded drawing document as follows (document is of type RDocument):
The returned object is of type RBox:
Where bottomLeft and topRight are of type RVector:
Code: Select all
var bbox = document.getBoundingBox();
Code: Select all
var bottomLeft = bbox.getMinimum();
var topRight = bbox.getMaximum();
Code: Select all
qDebug("minimum x: ", bottomLeft.x);
qDebug("minimum y: ", bottomLeft.y);
qDebug("maximum x: ", topRight.x);
qDebug("maximum y: ", topRight.y);