Message 1 of 2
How to keep selection ?
Not applicable
11-27-2013
01:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hallo to all!
My code takes the selected entities and reads out all the text of the attributes.
If no blocks are selected, the code prompts for a selection.
Unfortunately, by ending the transaction, the entitis are deselected.
So how to keep the selection, because it will be handled in a follow-up step.
thank you for any suggestion.
below a shortened code for the procedure:
private void Get_Text()
{
Autodesk.AutoCAD.Internal.Utils.SetFocusToDwgView();
PromptSelectionResult sel = edt.SelectImplied();
if (sel.Status == PromptStatus.Error)
{
TypedValue[] auswahl_typ = new TypedValue[] { new TypedValue((int)DxfCode.Start, "INSERT") };
SelectionFilter auswahl_filtern = new SelectionFilter(auswahl_typ);
PromptSelectionOptions pso = new PromptSelectionOptions();
pso.MessageForAdding = "\nMake a selection";
sel = edt.GetSelection(pso, auswahl_filtern);
if (sel.Status != PromptStatus.OK)//
{
edt.WriteMessage("\nSelection failed");
return;
}//if
}//if
//-------------------------------------------------------------------------------------
try
{
using (Transaction tr = db.TransactionManager.StartTransaction())
{
using (DocumentLock dwg_lock = dwg.LockDocument())// Aktive Zeichnung wird wärend der Bearbeitung gesprerrt
{
// Code for reading out the text form the choosen blocks
}// using DocumentLock
}// using Transaction
}// try
catch { edt.WriteMessage("\n#Error! Task failed"); }
}// void