@SuppressWarnings("unchecked") public void saveAsFile() { TransformGroup themodel = lobj.getModel3D(); File file = showSaveImageDialog(); if (file != null) { BranchGroup scene = new BranchGroup(); render.removeObj3D(lobj); Enumeration<Group> enume = themodel.getAllChildren(); while (enume.hasMoreElements()) { Group next = enume.nextElement(); themodel.removeChild(next); scene.addChild(next); } // String file=this.getModel3DHref(); // file.replace(".3ds", ".j3d"); // OutputStream outS; try { SceneGraphFileWriter filew = new SceneGraphFileWriter(file, null, false, "genereted by Neptus", null); filew.writeBranchGraph(scene); System.err.println("vehicle w:" + file.getPath() + "\n"); filew.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnsupportedUniverseException e) { // TODO Auto-generated catch block e.printStackTrace(); } TransformGroup themodel2 = new TransformGroup(); enume = scene.getAllChildren(); while (enume.hasMoreElements()) { Group next = enume.nextElement(); scene.removeChild(next); themodel2.addChild(next); } lobj = new Obj3D(); lobj.setModel3D(themodel2); render.addObj3D(lobj); } }