void onSelectionAdded(object sender, SelectionAddedEventArgs e) { for (int i = 0; i < e.AddedObjects.Count; i++) { BlockReference br = (BlockReference)e.AddedObjects[i].ObjectId.GetObject(OpenMode.ForRead); if (GetEffectiveName(br) != blockName) { e.Remove(i); } } }
/// <summary> /// Handles the ClassFilterSelectionAdded event of the ed control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="SelectionAddedEventArgs"/> instance containing the event data.</param> private static void ed_ClassFilterSelectionAdded(object sender, SelectionAddedEventArgs e) { ObjectId[] ids = e.AddedObjects.GetObjectIds(); for (int i = 0; i < ids.Length; i++) { if (!AllowedClassPtrs.Contains(ids[i].ObjectClass.UnmanagedObject)) { e.Remove(i); } } }
/// <summary> /// Обработчик события для применения фильтрации при выборе объектов /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void ed_SelectionAdded(object sender, SelectionAddedEventArgs e) { ObjectId[] ids = e.AddedObjects.GetObjectIds(); for (int i = 0; i < ids.Length; i++) { if (!_filterObjectMethod(ids[i])) { e.Remove(i); } } }
private void OnSelectionAdded(object sender, SelectionAddedEventArgs e) { string name = ((BlockTableRecord)this.dlg.cbxAutoBlock.SelectedItem).Name; SelectionSet addedObjects = e.AddedObjects; for (int i = 0; i < e.AddedObjects.Count; i++) { if (addedObjects[i].ObjectId.GetObject <BlockReference>().GetEffectiveName() != name) { e.Remove(i); } } }