File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ using Autodesk . AutoCAD . ApplicationServices . Core ;
2+ using Autodesk . AutoCAD . DatabaseServices ;
3+ using Autodesk . AutoCAD . EditorInput ;
4+ using Autodesk . AutoCAD . Runtime ;
5+
6+ namespace Test . Selection ;
7+
8+ public class QuickSelectFilter
9+ {
10+ [ CommandMethod ( "SelectText" ) ]
11+ public static void SelectText ( )
12+ {
13+ var doc = Application . DocumentManager . MdiActiveDocument ;
14+ var db = doc . Database ;
15+ var ed = doc . Editor ;
16+ var peo = new PromptEntityOptions ( "\n Select a text: " ) ;
17+ peo . SetRejectMessage ( "\n Selected object is not a text." ) ;
18+ peo . AddAllowedClass ( typeof ( DBText ) , true ) ;
19+ var per = ed . GetEntity ( peo ) ;
20+ if ( per . Status != PromptStatus . OK )
21+ return ;
22+ using ( var tr = db . TransactionManager . StartTransaction ( ) )
23+ {
24+ var ent = ( DBText ) tr . GetObject ( per . ObjectId , OpenMode . ForRead ) ;
25+ ed . WriteMessage ( $ "\n { ent . TextString } ") ;
26+ tr . Commit ( ) ;
27+ }
28+ }
29+ }
You can’t perform that action at this time.
0 commit comments