while (i.hasNext()) {
DXFBlock b = (DXFBlock) i.next();
Iterator<DXFEntity> ie = b.getDXFEntitiesIterator();
while (ie.hasNext()) {
DXFEntity entity = (DXFEntity) ie.next();
//set to gray
entity.setColor(9);
}
}
DXFEntity left = null;
DXFEntity top = null;
DXFEntity right = null;
DXFEntity bottom = null;
Bounds b = doc.getBounds();
double x = b.getMinimumX() + (b.getWidth() / 2);
double y = b.getMinimumY() + (b.getHeight() / 2);
//starting at the center point of the draft
Bounds lBounds = new Bounds(x, x, y, y);
Bounds rBounds = new Bounds(x, x, y, y);
Bounds tBounds = new Bounds(x, x, y, y);
Bounds bBounds = new Bounds(x, x, y, y);
Iterator<DXFLayer> j = doc.getDXFLayerIterator();
while (j.hasNext()) {
DXFLayer l = j.next();
//set color to gray
l.setColor(8);
Iterator<String> ti = l.getDXFEntityTypeIterator();
while (ti.hasNext()) {
String type = (String) ti.next();
Iterator<DXFEntity> ei = l.getDXFEntities(type).iterator();
while (ei.hasNext()) {
DXFEntity entity = ei.next();
//set to gray
entity.setColor(8);
Bounds currentBounds = entity.getBounds();
if (currentBounds.isValid()) {
if (currentBounds.getMinimumX() <= lBounds.getMinimumX()) {
lBounds = currentBounds;
left = entity;