Last active
July 5, 2020 06:54
-
-
Save chuongmep/b48e7ba41a88f3e6032abfcbb7f8b6dc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[CommandMethod("SelectionFilter")] | |
public static void LayerSelection() | |
{ | |
Document doc = Application.DocumentManager.MdiActiveDocument; | |
Database db = doc.Database; | |
Editor ed = doc.Editor; | |
TypedValue[] filterlist = new TypedValue[2]; | |
//select circle and line | |
filterlist[0] = new TypedValue(0, "CIRCLE,LINE"); | |
//8 = DxfCode.LayerName | |
filterlist[1] = new TypedValue(8, "0,Layer1,Layer2"); | |
SelectionFilter filter = | |
new SelectionFilter(filterlist); | |
PromptSelectionResult selRes = ed.SelectAll(filter); | |
if (selRes.Status != PromptStatus.OK) | |
{ | |
ed.WriteMessage( | |
"\nerror in getting the selectAll"); | |
return; | |
} | |
ObjectId[] ids = selRes.Value.GetObjectIds(); | |
ed.WriteMessage("No entity found: " | |
+ ids.Length.ToString() + "\n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment