没用啊 for (iDwg = 0; iDwg < dwgCount; iDwg++) { operFilePath = dwgFilesRoute[iDwg].ToString();//获得操作图形路径 if (fileType=="DWG") { Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.Open(operFilePath, false); } else//DXF { Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.Open(operFilePath, true); } Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; Editor ed = doc.Editor; //db.CloseInput(true); //DocumentLock lok = doc.LockDocument(); //Utils.ZoomObjects(true);//范围缩放视图 //curVtr = ed.GetCurrentView(); //Point2d d2d = new Point2d(curVtr.Target.X, curVtr.Target.Y); //curVtr.CenterPoint = new Point2d(0, 0); //curVtr.Target = new Point3d(0, 0, 0); //curVtr.ViewDirection = new Vector3d(0, 0, 1); //curVtr.CenterPoint = d2d; //ed.SetCurrentView(curVtr); //lok.Dispose(); doc.SendStringToExecute("BLOCKICON",true,false,false); //db.Save(); labelExecuteCondition.Text = "正在范围缩放" + System.IO.Path.GetFileName(operFilePath) + "视图,请等待……"; labelExecuteCondition.Visible = true; finish = (int)((Double)(iDwg + 1) / (Double)(dwgCount) * 100); progressBar1.Value = finish; progressBar1.Visible = true; this.Update(); //savepath = System.IO.Path.GetDirectoryName(operFilePath) + System.IO.Path.GetFileNameWithoutExtension(operFilePath); //savepath = folderPath+System.IO.Path.GetFileNameWithoutExtension(operFilePath); //savepath = "D:\\杂记\\1"; savepath = operFilePath; doc.CloseAndSave(savepath); //try //{ // doc.CloseAndSave(savepath); //} //catch (System.Exception eRR) //{ // doc.CloseAndSave(temppath); // if (fso.FileExists(operFilePath)) // { // fso.DeleteFile(operFilePath, true); // }
// fso.MoveFile(temppath, operFilePath); //} //if(fileType=="DWG") //{ // doc.CloseAndSave(savepath); //} //if (fileType == "DXF") //{ // doc.CloseAndSave(temppath); // if (fso.FileExists(operFilePath)) // { // fso.DeleteFile(operFilePath, true); // } // fso.MoveFile(temppath, operFilePath); //} } |