- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
What is missing in the sample below (e.g. locking, closing, transactions) ?
The example below loads the dxf data but it doesn't show up in the Doc(after zoom all), until the document is saved and reopened.
Also AutoCAD crash if changed from Model to Paper: "Internal error: !dbsymblk.cpp@464:eWasOpenForWrite "
[CommandMethod("myCmd")]
public void myCmd()
{
Document myDoc = Application.DocumentManager.MdiActiveDocument;
Database myDb = myDoc.Database;
Editor myEd = myDoc.Editor;
String dxfFilename = @"C:\temp\dxfSample.dxf";
String logFilename=@"c:\temp\dxfin.log";
myDb.DxfIn(dxfFilename, logFilename);
using (Transaction myTrans = myDb.TransactionManager.StartTransaction())
{
BlockTable myBlocks = (BlockTable)myDb.BlockTableId.GetObject(OpenMode.ForRead);
BlockTableRecord myMS = (BlockTableRecord) myBlocks[BlockTableRecord.ModelSpace].GetObject(OpenMode.ForRead);
BlockTableRecordEnumerator btrEnum = myMS.GetEnumerator();
long nMsEnts = myMS.Cast<ObjectId>().Count();
myEd.WriteMessage("{0} ModelSpace Entities", nMsEnts);
myTrans.Commit();
}
}
Thanks for any help.
Solved! Go to Solution.