插入dwg为块的问题
本帖最后由 Real_King 于 2015-5-31 11:01 编辑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的方法?
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. 本帖最后由 Real_King 于 2015-5-31 15:39 编辑
ivde 发表于 2015-5-31 11:54 static/image/common/back.gif
help
You can also insert an entire drawing file into the current drawing by using the ReadDwgFile m ...
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? http://docs.autodesk.com/ACD/2014/ENU/index.html?url=files/GUID-2656E245-6EAA-41A3-ABE9-742868182821.htm,topicNumber=d30e720423 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();
Arthas 发表于 2015-6-4 23:19 static/image/common/back.gif
using (Database blkDb = new Database(false, true))
{
...
thanks,already
页:
[1]