Beispiel #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            ComboBox[,] comboBoxs =
            {
                { cbParameter1, cbOperation1, cbValue1 },
                { cbParameter2, cbOperation2, cbValue2 },
                { cbParameter3, cbOperation3, cbValue3 },
                { cbParameter4, cbOperation4, cbValue4 }
            };

            IList <ElementFilter> filters = CollectFilters(comboBoxs);

            ICollection <ElementId> ids;

            if (andCheckBox.IsChecked == true)
            {
                LogicalAndFilter filter = new LogicalAndFilter(filters);
                ids = CollectorFromTreeView.collectorFromTreeView(DOC,
                                                                  (ObservableCollection <Node>)treeView.ItemsSource).WherePasses(filter).ToElementIds();
            }
            else
            {
                LogicalOrFilter filter = new LogicalOrFilter(filters);
                ids = CollectorFromTreeView.collectorFromTreeView(DOC,
                                                                  (ObservableCollection <Node>)treeView.ItemsSource).WherePasses(filter).ToElementIds();
            }

            if (ids.Count > 0)
            {
                textElementsCount.Text = ids.Count.ToString();
                UIDOC.Selection.SetElementIds(ids);
                UIDOC.ShowElements(ids);
            }
            else
            {
                textElementsCount.Text = "0";
            }
        }
Beispiel #2
0
        private void CollectParameters_Click(object sender, RoutedEventArgs e)
        {
            ObservableCollection <Node> items      = (ObservableCollection <Node>)treeView.ItemsSource;
            FilteredElementCollector    collector  = CollectorFromTreeView.collectorFromTreeView(DOC, items);
            List <ParameterData>        parameters = GetParamsFromSelectedElements.getParamsFromSelectedElements(collector);

            cbParameter1.ItemsSource = parameters;
            cbParameter2.ItemsSource = parameters;
            cbParameter3.ItemsSource = parameters;
            cbParameter4.ItemsSource = parameters;

            Collector = collector;

            cbOperation1.Text = "";
            cbOperation2.Text = "";
            cbOperation3.Text = "";
            cbOperation4.Text = "";

            cbValue1.Text = "";
            cbValue2.Text = "";
            cbValue3.Text = "";
            cbValue4.Text = "";
        }