Hi everybody,
i coded this simple utility that allows the user to edit some dbtext without using the mouse (after selection).
It works but sometimes, it seems randomly, i get a fatal error.
This is the code
public void Run(object param)
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
Database db = doc.Database;
PromptSelectionOptions pso = new PromptSelectionOptions();
pso.MessageForAdding = "\nSelect texts";
pso.AllowDuplicates = false;
pso.AllowSubSelections = false;
SelectionFilter sf = new SelectionFilter(new TypedValue[] { new TypedValue((int)DxfCode.Start, "TEXT") });
PromptSelectionResult psr = ed.GetSelection(pso, sf);
if (psr.Status != PromptStatus.OK)
return;
foreach (SelectedObject so in psr.Value)
{
ed.SetImpliedSelection(new ObjectId[] { so.ObjectId });
executeSyncro("_textedit ");
}
ed.Regen();
}
void executeSyncro(string command)
{
AcadApplication app = (AcadApplication)Application.AcadApplication;
app.ActiveDocument.SendCommand(command);
}
The run function it's called from a commandmethod with the CommandFlags.Session flag.
Where's the problem?
Thanks