[求助]如何保存缩略图?
打开后关闭并保存Autodesk..ApplicationServices.Application.DocumentManager.Open(operFilePath, false);
Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
savepath = operFilePath;
doc.CloseAndSave(savepath);
之后,发现如果原来图形有缩略图的,保存之后还会有缩略图,原来没有缩略图的,保存之后还是没有。但是原来没有缩略图的,我手工打开DWG,然后保存一下就有缩略图了。
请问如何把缩略图保存出来?
命令 : BLOCKICON 没用啊
for (iDwg = 0; iDwg
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);
//}
}
汗,搞错,blockicon是生成块图标的:)
不过缩略图为什么需要?
可以试下Wblock或直接调用Save命令
算了,缩略图不要也罢
只是有个问题,就是比如点击一个按钮,但是按钮执行的是一个循环,循环体如果使用editor发送命令,无论什么命令,都不执行。
还有,如果不是循环,那么发送的命令会在这个按钮事件函数全部执行完毕之后,CAD开始执行发送的命令。不知道这是为什么。
public void modify()
{
DwgFrame Fra = new DwgFrame();
Autodesk.AutoCAD.ApplicationServices.Application.ShowModelessDialog(Fra);
}
DwgFrame 是一个窗体,上面有按钮。不知道怎样才能让按钮事件中发送的命令立即执行,执行之后再回到按钮事件继续往下执行?
SendStringToExecute会产生延时,试下这个
页:
[1]