public void StandardSOMFilledStylesInActiveView(Document doc)
        {
            filledRegion f = new filledRegion();
            GraphicsStyle SOM1 = null;
            List<GraphicsStyle> SOMlist = new List<GraphicsStyle>();
            f.ListBoundaryCorners(doc);
            List<CurveElement> curveElementList = f.GetCurveElementList();
            List<string> namelist = f.GetdetailLineNameList();
            var dictionary = DictionaryLines();
            string value = null;
            try {
                foreach (Element e in new FilteredElementCollector(doc).OfClass(typeof(CurveElement)))
                {
                    CurveElement ln = e as CurveElement;
                    string detailLineName = ln.LineStyle.Name;
                    if (dictionary.ContainsValue(detailLineName))
                    {
                        SOM1 = ln.LineStyle as GraphicsStyle;
                        SOMlist.Add(SOM1);
                    }
                }

                foreach (CurveElement CurveElement in curveElementList)
                {
                    string detailLineName = CurveElement.LineStyle.Name;

                    using (Transaction t = new Transaction(doc, "change line style"))
                    {
                        t.Start();
                        if (dictionary.ContainsKey(detailLineName))
                        {
                            List<GraphicsStyle> distinct = SOMlist.Distinct().ToList();
                            foreach (GraphicsStyle gs in distinct)
                            {
                                value = dictionary[detailLineName];

                                if (gs.Name == value)
                                {
                                    CurveElement.LineStyle = gs;
                                }
                            }
                        }
                        t.Commit();
                    }
                }
            }
            catch { }
        }
        public Result Execute(
          ExternalCommandData commandData,
          ref string message,
          ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;
            UIDocument uidoc = uiapp.ActiveUIDocument;
            Autodesk.Revit.ApplicationServices.Application app = uiapp.Application;
            Document doc = uidoc.Document;

            DeleteLinesWPF linesWPF = new DeleteLinesWPF();
            var res = linesWPF.ShowDialog();
            if (!(res.HasValue && res.Value)) return Result.Cancelled;

            //EXCEL FILE
            OfficeOpenXml.ExcelPackage package = new OfficeOpenXml.ExcelPackage();

            using (var fs = new System.IO.FileStream(linesWPF.ExcelListPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
            {
                package.Load(fs);
            }

            string path = linesWPF.ExcelListPathTextBox.Text;

            //------------------

            getLines getLines = new getLines(path);
            groups groupitems = new groups();
            filledRegion fillRegions = new filledRegion();

            string selectedItem = linesWPF.SelectComboBox.SelectedItem.ToString();

            // ENTIRE PROJECT
            if (selectedItem == "Entire Project")
            {
                groupitems.Ungroup(doc, uidoc, path);
                getLines.StandardSOMLineStyle(doc);

                if (linesWPF.checkboxDeleteLines.IsChecked == true)
                {
                    getLines.deleteLineStyle(doc);
                }

                if (linesWPF.checkboxFilledRegion.IsChecked == true)
                {
                    fillRegions.EditFilledRegion(doc);
                }

                if (linesWPF.checkboxDeleteLinePatterns.IsChecked == true)
                {
                    getLines.deleteLinePatterns(doc);
                }
            }

            // ACTIVE VIEW
            if (selectedItem == "Active View")
            {
                groupitems.UngroupActiveView(doc, uidoc, path);

                getLines.StandardSOMLineStylesInActiveView(doc);
                getLines.StandardSOMFilledStylesInActiveView(doc);
                fillRegions.MoveFilledReigionInActiveViews(doc);
            }

            return Result.Succeeded;
        }