I need to open the given path drawing file and then select the All lines of the drawing and then list number of the lines. I cannot do these things because while i open and then set the MdiActiveDocument method is returned. Below lines are not executed.
private static int GetNumberofLines(string drawingName)
{
int lineCount = 0;
DocumentCollection docMgr = AutoCAD.ApplicationServices.Application.DocumentManager;
Document doc = docMgr.Open(drawingName, false);
docMgr.MdiActiveDocument = doc; // in this line method is skipped
TypedValue[] filterlist = new TypedValue[1]; //cursor didn't come this line..
filterlist[0] = new TypedValue((int)DxfCode.Start, "Line");
SelectionFilter filter = new SelectionFilter(filterlist);
PromptSelectionOptions opts = new PromptSelectionOptions();
opts.MessageForAdding = "Select entities to get line counts: ";
PromptSelectionResult prmptSelRslt = doc.Editor.SelectAll(filter);
if (prmptSelRslt.Status != PromptStatus.OK)
{
return 0;
}
else
{
lineCount = prmptSelRslt.Value.Count;
}
return lineCount;
}
Please can anybody tell me how to open and list line number count.
Thanks in Advance....