I have an object that I would need to write to a json file.
code is mentioned below
Code: Select all
const doc = getDocument();
var layerName = getText()
var entitiesIds = doc.queryLayerEntities(doc.getLayerId(layerName));
const entitiesBBox = []
for (var i = 0; i<entitiesIds.length; ++i) {
const entityId = entitiesIds[i];
const bbox = {}
bbox.id = entityId
const entity = doc.queryEntity(entityId);
const box = entity.getBoundingBox()
bbox.props = {x: box.getMinimum().x, y: box.getMinimum().y, width: box.getWidth(), height: box.getHeight()}
entitiesBBox.push(bbox)
}
I am using windows/linux and on qcad 3.28.1
Thanks,
Arun