- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
I have made a function as below for read all BlockReference objects from ActiveDocument, then have to do my required validation. But its showing poor performance while reading objects. Is there any rich performance procedure/function to real all BlockReference objects from ActiveDocument ?.
Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
Editor acDocEd = acDoc.Editor;
TypedValue[] acTypValAr = new TypedValue[1];
acTypValAr[0] = new TypedValue(0, "INSERT");
SelectionFilter acSelFtr = new SelectionFilter(acTypValAr);
var _selAll = acDocEd.SelectAll(acSelFtr);
var _SelectionSet = _selAll.Value;
if (_SelectionSet == null)
{
return ;
}
if (_SelectionSet.Count > 0)
{
using (var tr = acDoc.TransactionManager.StartTransaction())
{
foreach (var ObjIdBlock in _SelectionSet.GetObjectIds())
{
using (DBObject obj = tr.GetObject(ObjIdBlock, Autodesk.AutoCAD.DatabaseServices.OpenMode.ForRead))
{
BlockReference br = (BlockReference)tr.GetObject(obj.Id, OpenMode.ForRead);
}
}
}
}
Could you please help me with sample code to improve performance ?
Thanks in Advance.
Regards,
Manohar.
Solved! Go to Solution.