乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 79|回复: 5

[求助]如何保存缩略图?

[复制链接]

16

主题

53

帖子

1

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
117
发表于 2009-10-13 10:37:00 | 显示全部楼层 |阅读模式
打开后关闭并保存
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,然后保存一下就有缩略图了。
请问如何把缩略图保存出来?

1tp3mcb5tti.jpg

1tp3mcb5tti.jpg

回复

使用道具 举报

72

主题

2726

帖子

9

银币

社区元老

Rank: 75Rank: 75Rank: 75

铜币
3014
发表于 2009-10-13 19:23:00 | 显示全部楼层
命令 : BLOCKICON
回复

使用道具 举报

16

主题

53

帖子

1

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
117
发表于 2009-10-13 20:03:00 | 显示全部楼层
没用啊
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);
                //}
            }
回复

使用道具 举报

72

主题

2726

帖子

9

银币

社区元老

Rank: 75Rank: 75Rank: 75

铜币
3014
发表于 2009-10-14 19:14:00 | 显示全部楼层
汗,搞错,blockicon是生成块图标的:)
不过缩略图为什么需要?
可以试下Wblock或直接调用Save命令
回复

使用道具 举报

16

主题

53

帖子

1

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
117
发表于 2009-10-14 23:06:00 | 显示全部楼层
算了,缩略图不要也罢
只是有个问题,就是比如点击一个按钮,但是按钮执行的是一个循环,循环体如果使用editor发送命令,无论什么命令,都不执行。
还有,如果不是循环,那么发送的命令会在这个按钮事件函数全部执行完毕之后,CAD开始执行发送的命令。不知道这是为什么。
[CommandMethod("MODFRM",CommandFlags.Session)]
        public void modify()
        {
            
            
            DwgFrame Fra = new DwgFrame();
            Autodesk.AutoCAD.ApplicationServices.Application.ShowModelessDialog(Fra);
        }
DwgFrame 是一个窗体,上面有按钮。不知道怎样才能让按钮事件中发送的命令立即执行,执行之后再回到按钮事件继续往下执行?
回复

使用道具 举报

72

主题

2726

帖子

9

银币

社区元老

Rank: 75Rank: 75Rank: 75

铜币
3014
发表于 2009-10-15 09:05:00 | 显示全部楼层
SendStringToExecute会产生延时,试下这个
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-14 16:01 , Processed in 2.443455 second(s), 67 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表