Entity selection to modify properties

<?xml encoding=”UTF-8″>By Balaji Ramamoorthy

To select entities and to have their properties displayed in the property palette, it is necessary for your command to use CommandFlags.Redraw. This ensures that AutoCAD highlights the selection. You can then modify their common properties if you wish.

Here is a small code snippet to select all entities :

 [CommandMethod(<span>"SelectAll"</span><span> , CommandFlags.Redraw)]</span>
 <span>static</span><span>  <span>public</span><span>  <span>void</span><span>  SelectMethod()</span></span></span>
 <span>{</span>
     Editor ed 
 	= Application.DocumentManager.MdiActiveDocument.Editor;
 
     PromptSelectionResult psr = ed.SelectAll();
 
     <span>using</span><span>  (SelectionSet ss = psr.Value)</span>
     <span>{</span>
         ed.SetImpliedSelection(ss.GetObjectIds());
     <span>}</span>
 <span>}</span>
 

Here is a screenshot in AutoCAD :

1


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading