public void blockManagement ( ) { Vector dwgObjectsWithoutBlocks = new Vector ( ) ; boolean addingToBlock = false ; for ( int i = 0 ; i < dwgObjects . size ( ) ; i ++ ) { try { DwgObject entity = ( DwgObject ) dwgObjects . get ( i ) ; if ( entity instanceof DwgArc && ! addingToBlock ) { dwgObjectsWithoutBlocks . add ( entity ) ; } else if ( entity instanceof DwgEllipse && ! addingToBlock ) { dwgObjectsWithoutBlocks . add ( entity ) ; } else if ( entity instanceof DwgCircle && ! addingToBlock ) { dwgObjectsWithoutBlocks . add ( entity ) ; } else if ( entity instanceof DwgPolyline2D && ! addingToBlock ) { dwgObjectsWithoutBlocks . add ( entity ) ; } else if ( entity instanceof DwgPolyline3D && ! addingToBlock ) { dwgObjectsWithoutBlocks . add ( entity ) ; } else if ( entity instanceof DwgLwPolyline && ! addingToBlock ) { dwgObjectsWithoutBlocks . add ( entity ) ; } else if ( entity instanceof DwgSolid && ! addingToBlock ) { dwgObjectsWithoutBlocks . add ( entity ) ; } else if ( entity instanceof DwgLine && ! addingToBlock ) { dwgObjectsWithoutBlocks . add ( entity ) ; } else if ( entity instanceof DwgPoint && ! addingToBlock ) { dwgObjectsWithoutBlocks . add ( entity ) ; } else if ( entity instanceof DwgMText && ! addingToBlock ) { dwgObjectsWithoutBlocks . add ( entity ) ; } else if ( entity instanceof DwgText && ! addingToBlock ) { dwgObjectsWithoutBlocks . add ( entity ) ; } else if ( entity instanceof DwgAttrib && ! addingToBlock ) { dwgObjectsWithoutBlocks . add ( entity ) ; } else if ( entity instanceof DwgAttdef && ! addingToBlock ) { dwgObjectsWithoutBlocks . add ( entity ) ; } else if ( entity instanceof DwgBlock ) { addingToBlock = true ; } else if ( entity instanceof DwgEndblk ) { addingToBlock = false ; } else if ( entity instanceof DwgBlockHeader ) { addingToBlock = true ; } else if ( entity instanceof DwgInsert && ! addingToBlock ) { /* double[] p = ((DwgInsert) entity).getInsertionPoint(); Point2D point = new Point2D.Double(p[0], p[1]); double[] scale = ((DwgInsert) entity).getScale(); double rot = ((DwgInsert) entity).getRotation(); int blockHandle = ((DwgInsert) entity).getBlockHeaderHandle(); manageInsert(point, scale, rot, blockHandle, i, dwgObjectsWithoutBlocks);*/ } else { // System.out.println("Detectado dwgObject pendiente de implementar"); } } catch ( StackOverflowError e ) { e . printStackTrace ( ) ; System . out . println ( "Overflowerror at object: " + i ) ; } } dwgObjects = dwgObjectsWithoutBlocks ; }
Modify the geometry of the objects contained in the blocks of a DWG file and add these objects to the DWG object list .