Пример #1
0
        private void IsolateElements_click(object sender, RoutedEventArgs e)
        {
            UIApplication uiApp = p_commanddata.Application;
            UIDocument    uiDoc = uiApp.ActiveUIDocument;

            if (ElementListView.Items.Count > 0)
            {
                try
                {
                    List <ElementId> vIds = new List <ElementId>();
                    foreach (Element vData in ElementListView.Items)
                    {
                        vIds.Add(vData.Id);
                    }

                    _Doc.ActiveView.IsolateElementsTemporary(vIds);
                    uiDoc.RefreshActiveView();
                    //this.Hide();
                    //this.Show();
                }
                catch (Exception vEx)
                {
                }
            }
            else
            {
                WrngMain vInsWrngMain = new WrngMain("No elements found");
                vInsWrngMain.Show();
            }
        }
Пример #2
0
        private void FilterButton_Click(object sender, RoutedEventArgs e)
        {
            if (ListParameter.SelectedItem != null)
            {
                try
                {
                    FilterParameter(txtFilter.Text);
                }
                catch (Exception vEx)
                {
                }
            }
            else
            {
                WrngMain vInsWrngMain = new WrngMain("No parameter selected");
                vInsWrngMain.Show();
            }

            if (ElementListView.Items.Count == 0)
            {
                TextBlockError.Visibility = System.Windows.Visibility.Visible;
            }
            else
            {
                TextBlockError.Visibility = System.Windows.Visibility.Hidden;
            }
        }
Пример #3
0
        private void HighlightElements_click(object sender, RoutedEventArgs e)
        {
            UIApplication uiApp = p_commanddata.Application;
            UIDocument    uiDoc = uiApp.ActiveUIDocument;



            if (ElementListView.Items.Count > 0)
            {
                try
                {
                    OverrideGraphicSettings ogs = new OverrideGraphicSettings();
                    Autodesk.Revit.DB.Color red = new Autodesk.Revit.DB.Color(255, 0, 0);
                    Element solidFill           = new FilteredElementCollector(_Doc).OfClass(typeof(FillPatternElement)).Where(q => q.Name.Contains("Solid")).First();

                    ogs.SetProjectionLineColor(red);
                    ogs.SetProjectionLineWeight(8);

                    try
                    {
                        List <ElementId> vIds = new List <ElementId>();
                        foreach (Element vData in ElementListView.Items)
                        {
                            vIds.Add(vData.Id);
                            using (Transaction t = new Transaction(_Doc, "Highlight element"))
                            {
                                try
                                {
                                    _Doc.ActiveView.SetElementOverrides(vData.Id, ogs);
                                }
                                catch (Exception ex)
                                {
                                    TaskDialog.Show("Exception", ex.ToString());
                                }


                                t.Commit();
                            }
                        }
                        _Doc.ActiveView.IsolateElementsTemporary(vIds);
                        _Doc.ActiveView.DisableTemporaryViewMode(TemporaryViewMode.TemporaryHideIsolate);
                    }
                    catch (Exception ex)
                    {
                        TaskDialog.Show("Exception", ex.ToString());
                    }
                }
                catch (Exception vEx)
                {
                }
                uiDoc.RefreshActiveView();
            }
            else
            {
                WrngMain vInsWrngMain = new WrngMain("No elements found");
                vInsWrngMain.Show();
            }
        }