杰夫:谢谢!快速问题:由于新图形当前处于打开状态,我应该将第一个参数(blockName)设置为什么?以下是我到目前为止所做的:
- // Get the current document and database
- Document doc = acApp.DocumentManager.MdiActiveDocument;
- Editor ed = doc.Editor;
- Database db = acApp.DocumentManager.MdiActiveDocument.Database;
- // Create a temporary database to import an existing file
- using (Database tmpDB = new Database(false, false))
- {
- string strPath = @"C:\a\1.dwg";
- // Read the 'strPath' file into the new database
- tmpDB.ReadDwgFile(strPath, System.IO.FileShare.Read, true, "");
- // Try to insert our the dwg file as a block and get the return id of
- // the new block table record.
- ObjectId BlockID = db.Insert(blockName, tmpDB, true);
- }
|