乐筑天下

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

插入dwg为块的问题

[复制链接]

44

主题

185

帖子

8

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
361
发表于 2015-5-31 10:57:00 | 显示全部楼层 |阅读模式
VBA中,可以用下面的语句
Set m_ref = ThisDrawing.ModelSpace.InsertBlock(m_insertpoint, "C:\Windows\CycFonts\" &  "123.dwg", m_scale, m_scale, m_scale, 0)
在当前图形中插入一个123.dwg的图形,插入后,此图形成了块
方法是InsertBlock(),C# .NET中,我好像没找到这个函数,要不只有通过COM调用?
或者用第二版中的方法,这样看起来代码很繁琐,请问C# .net下有没有VBA InsertBlock()这样直接可以用dwg路径插入block的方法?
回复

使用道具 举报

0

主题

275

帖子

8

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
275
发表于 2015-5-31 11:54:00 | 显示全部楼层
help
You can also insert an entire drawing file into the current drawing by using the ReadDwgFile method to open a drawing file in memory, and then use the Insert method to insert the drawing in memory into the current drawing. When you insert an entire drawing into another drawing, AutoCAD treats the inserted drawing like any other block reference. Subsequent insertions reference the block definition (which contains the geometric description of the block) with different position, scale, and rotation settings.
回复

使用道具 举报

44

主题

185

帖子

8

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
361
发表于 2015-5-31 15:33:00 | 显示全部楼层

thanks.i don't know there is ReadDwgFile method in it.by the way ,where did you get the information?can you give me the link?
回复

使用道具 举报

0

主题

275

帖子

8

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
275
发表于 2015-5-31 16:52:00 | 显示全部楼层
回复

使用道具 举报

3

主题

7

帖子

3

银币

初来乍到

Rank: 1

铜币
19
发表于 2015-6-4 23:19:00 | 显示全部楼层
using (Database blkDb = new Database(false, true))
                    {
                        blkDb.ReadDwgFile(filename, System.IO.FileShare.Read, true, null);
                        blkDb.CloseInput(true);
                        using (DocumentLock docLock = doc.LockDocument())//多文档要先这样,否则报至命错误
                        {
                            using (Transaction t = doc.TransactionManager.StartTransaction())
                            {
                                ObjectId idBTR = doc.Database.Insert(blkdefname, blkDb, false);
                                t.Commit();
                            }
                        }
                        blkDb.Dispose();
回复

使用道具 举报

44

主题

185

帖子

8

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
361
发表于 2015-6-5 20:59:00 | 显示全部楼层

thanks,already
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-4-19 20:33 , Processed in 0.323057 second(s), 64 queries .

© 2020-2025 乐筑天下

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