示例#1
0
        private static void ResetView(UIDocument uiDocument, View3D view)
        {
            using var trans = new Transaction(uiDocument.Document);
            if (trans.Start($"Reset view '{view.Name}'") != TransactionStatus.Started)
            {
                return;
            }

            Log.Information("Removing current selection ...");
            uiDocument.Selection.SetElementIds(new List <ElementId>());

            view.DisableTemporaryViewMode(TemporaryViewMode.TemporaryHideIsolate);
            view.DisableTemporaryViewMode(TemporaryViewMode.RevealHiddenElements);
            view.IsSectionBoxActive = false;

            var currentlyHiddenElements = uiDocument.Document.GetHiddenElementsOfView(view).ToList();

            if (currentlyHiddenElements.Any())
            {
                Log.Information("Unhide {n} currently hidden elements ...", currentlyHiddenElements.Count);
                view.UnhideElements(currentlyHiddenElements);
            }

            trans.Commit();
        }
示例#2
0
        public static void IntegrateEnergyResults(UIDocument uidoc, Document doc, IDFFile.Building Bui, string massName, Dictionary <string, double[]> resultsDF, Dictionary <string, Element> masses)
        {
            Bui.AssociateProbabilisticEnergyPlusResults(resultsDF);
            View3D v1 = (new FilteredElementCollector(doc).OfClass(typeof(View3D)).Cast <View3D>()).First(v => v.Name.Contains("Op - " + massName));

            using (Transaction tx = new Transaction(doc, "Simplified EP"))
            {
                uidoc.ActiveView = v1;
                tx.Start();
                View3D v2 = View3D.CreateIsometric(doc, v1.GetTypeId());
                v2.Name = "SimplifiedEP-" + massName;
                IEnumerable <Element> allElements = new FilteredElementCollector(doc).WhereElementIsNotElementType().OfCategory(BuiltInCategory.OST_Mass);
                allElements = allElements.Concat(new FilteredElementCollector(doc).WherePasses(new ElementClassFilter(typeof(CurveElement))));
                v2.HideElements(allElements.Select(e => e.Id).ToList());
                v2.UnhideElements(new List <ElementId>()
                {
                    masses[massName].Id
                });
                tx.Commit();

                uidoc.ActiveView = v2;
            }
        }
示例#3
0
        public override Value Evaluate(FSharpList <Value> args)
        {
            View3D view    = null;
            var    eye     = (XYZ)((Value.Container)args[0]).Item;
            var    target  = (XYZ)((Value.Container)args[1]).Item;
            var    name    = ((Value.String)args[2]).Item;
            var    extents = ((Value.Container)args[3]).Item;
            var    isolate = Convert.ToBoolean(((Value.Number)args[4]).Item);

            var globalUp  = XYZ.BasisZ;
            var direction = target.Subtract(eye);
            var up        = direction.CrossProduct(globalUp).CrossProduct(direction);
            var orient    = new ViewOrientation3D(eye, up, direction);

            if (this.Elements.Any())
            {
                if (dynUtils.TryGetElement(this.Elements[0], out view))
                {
                    if (!view.ViewDirection.IsAlmostEqualTo(direction) || !view.Origin.IsAlmostEqualTo(eye))
                    {
                        view.Unlock();
                        view.SetOrientation(orient);
                        view.SaveOrientationAndLock();
                    }

                    if (!view.Name.Equals(name))
                    {
                        view.Name = ViewBase.CreateUniqueViewName(name);
                    }
                }
                else
                {
                    //create a new view
                    view        = ViewBase.Create3DView(orient, name, isPerspective);
                    Elements[0] = view.Id;
                }
            }
            else
            {
                view = Create3DView(orient, name, isPerspective);
                Elements.Add(view.Id);
            }

            var fec = dynRevitUtils.SetupFilters(dynRevitSettings.Doc.Document);

            if (isolate)
            {
                view.CropBoxActive = true;

                var element = extents as Element;
                if (element != null)
                {
                    var e = element;

                    var all    = fec.ToElements();
                    var toHide =
                        fec.ToElements().Where(x => !x.IsHidden(view) && x.CanBeHidden(view) && x.Id != e.Id).Select(x => x.Id).ToList();

                    if (toHide.Count > 0)
                    {
                        view.HideElements(toHide);
                    }

                    dynRevitSettings.Doc.Document.Regenerate();

                    Debug.WriteLine(string.Format("Eye:{0},Origin{1}, BBox_Origin{2}, Element{3}",
                                                  eye.ToString(), view.Origin.ToString(), view.CropBox.Transform.Origin.ToString(), (element.Location as LocationPoint).Point.ToString()));

                    //http://wikihelp.autodesk.com/Revit/fra/2013/Help/0000-API_Deve0/0039-Basic_In39/0067-Views67/0069-The_View69
                    if (isPerspective)
                    {
                        var farClip = view.get_Parameter("Far Clip Active");
                        farClip.Set(0);
                    }
                    else
                    {
                        //http://adndevblog.typepad.com/aec/2012/05/set-crop-box-of-3d-view-that-exactly-fits-an-element.html
                        var pts = new List <XYZ>();

                        ParseElementGeometry(element, pts);

                        var bounding     = view.CropBox;
                        var transInverse = bounding.Transform.Inverse;
                        var transPts     = pts.Select(transInverse.OfPoint).ToList();

                        //ingore the Z coordindates and find
                        //the max X ,Y and Min X, Y in 3d view.
                        double dMaxX = 0, dMaxY = 0, dMinX = 0, dMinY = 0;

                        //geom.XYZ ptMaxX, ptMaxY, ptMinX,ptMInY;
                        //coorresponding point.
                        bool bFirstPt = true;
                        foreach (var pt1 in transPts)
                        {
                            if (true == bFirstPt)
                            {
                                dMaxX    = pt1.X;
                                dMaxY    = pt1.Y;
                                dMinX    = pt1.X;
                                dMinY    = pt1.Y;
                                bFirstPt = false;
                            }
                            else
                            {
                                if (dMaxX < pt1.X)
                                {
                                    dMaxX = pt1.X;
                                }
                                if (dMaxY < pt1.Y)
                                {
                                    dMaxY = pt1.Y;
                                }
                                if (dMinX > pt1.X)
                                {
                                    dMinX = pt1.X;
                                }
                                if (dMinY > pt1.Y)
                                {
                                    dMinY = pt1.Y;
                                }
                            }
                        }

                        bounding.Max = new XYZ(dMaxX, dMaxY, bounding.Max.Z);
                        bounding.Min = new XYZ(dMinX, dMinY, bounding.Min.Z);
                        view.CropBox = bounding;
                    }
                }
                else
                {
                    var xyz = extents as BoundingBoxXYZ;
                    if (xyz != null)
                    {
                        view.CropBox = xyz;
                    }
                }

                view.CropBoxVisible = false;
            }
            else
            {
                view.UnhideElements(fec.ToElementIds());
                view.CropBoxActive = false;
            }

            return(Value.NewContainer(view));
        }
示例#4
0
        /// <summary>
        /// 视图逻辑处理
        /// 支持(隐藏,淡显,红显)和(反隐藏,淡显,红显)
        /// </summary>
        /// <param name="showDialogType"></param>
        /// <param name="needHide"></param>
        /// <param name="getElementIds"></param>
        /// <returns></returns>
        private bool DetailWithView(ShowDialogType showDialogType, bool needHide, Func <Document, List <ElementId> > getElementIds)
        {
            ListForm.ShowDialogType = showDialogType;
            string viewName        = ListForm.ShowDialogType.GetViewName();
            var    doc             = UI_Doc.Document;
            View3D view            = null;
            var    transactionName = nameof(SubsidenceMonitor) + nameof(btn_ViewSelection_Click);
            bool   isSuccess       = DealWithTransaction(viewName, doc, transactionName, () =>
            {
                view = Revit_Document_Helper.GetElementByNameAs <View3D>(UI_Doc.Document, viewName);
                if (view == null)
                {
                    view = Revit_Document_Helper.Create3DView(doc, viewName);
                }
                if (needHide)
                {
                    //渲染_所有 隐藏
                    IList <Element> allElements      = GetAllElements(doc);
                    List <ElementId> elementIdsToHid = new List <ElementId>();
                    foreach (var element in allElements)
                    {
                        if (element.CanBeHidden(view) && element.Id != view.Id)
                        {
                            elementIdsToHid.Add(element.Id);
                        }
                    }
                    if (elementIdsToHid.Count > 0)
                    {
                        view.HideElements(elementIdsToHid);
                    }
                    //渲染_测点 淡显
                    var nodesElementIds = Model.GetAllNodesElementIdsByTNode(doc);
                    if (nodesElementIds.Count > 0)
                    {
                        view.UnhideElements(nodesElementIds);
                    }
                    var defaultOverrideGraphicSettings = CPSettings.GetTingledOverrideGraphicSettings(doc);
                    foreach (var elementId in nodesElementIds)
                    {
                        view.SetElementOverrides(elementId, defaultOverrideGraphicSettings);
                    }
                }
                else
                {
                    ////渲染_所有 反隐藏
                    //IList<Element> allElements = GetAllElements(doc);
                    //List<ElementId> elementIdsToHid = new List<ElementId>();
                    //foreach (var element in allElements)
                    //    if (element.CanBeHidden(view) && element.Id != view.Id)
                    //        elementIdsToHid.Add(element.Id);
                    //view.UnhideElements(elementIdsToHid);
                    //渲染_所有 淡显
                    var allElementIds = GetAllElements(doc);
                    var defaultOverrideGraphicSettings = CPSettings.GetTingledOverrideGraphicSettings(doc);
                    foreach (var elementId in allElementIds)
                    {
                        view.SetElementOverrides(elementId.Id, defaultOverrideGraphicSettings);
                    }
                }
                //渲染_选中 红显
                var overrideGraphicSettings = Revit_Helper.GetOverrideGraphicSettings(ColorForSelectedElements, CPSettings.GetDefaultFillPatternId(doc), 0);
                var selectedElementIds      = getElementIds(doc);
                foreach (var elementId in selectedElementIds)
                {
                    view.SetElementOverrides(elementId, overrideGraphicSettings);
                }
            });

            if (view != null)
            {
                UI_Doc.ActiveView = view;
            }
            return(isSuccess);
        }
示例#5
0
 // Token: 0x060000B6 RID: 182 RVA: 0x0000C1E0 File Offset: 0x0000A3E0
 private void buttonShowPatterns_Click(object sender, EventArgs e)
 {
     try
     {
         this.m_AllViews.FindPatterns = true;
         Autodesk.Revit.ApplicationServices.Application application = this.p_commandData.Application.Application;
         Document document = this.p_commandData.Application.ActiveUIDocument.Document;
         FilteredElementCollector filteredElementCollector = new FilteredElementCollector(document);
         ICollection <Element>    collection = filteredElementCollector.OfClass(typeof(View3D)).ToElements();
         View3D view3D = null;
         FilteredElementCollector filteredElementCollector2 = new FilteredElementCollector(document);
         ICollection <Element>    collection2 = filteredElementCollector2.OfClass(typeof(View3D)).ToElements();
         FilteredElementCollector filteredElementCollector3 = new FilteredElementCollector(document);
         ICollection <Element>    collection3 = filteredElementCollector3.OfClass(typeof(FamilySymbol)).ToElements();
         FilteredElementCollector filteredElementCollector4 = new FilteredElementCollector(document);
         ICollection <Element>    collection4 = filteredElementCollector4.OfClass(typeof(FamilySymbol)).ToElements();
         FilteredElementCollector filteredElementCollector5 = new FilteredElementCollector(document);
         ICollection <Element>    collection5 = filteredElementCollector5.OfClass(typeof(FamilyInstance)).ToElements();
         List <string>            list        = new List <string>();
         MessageBoxIcon           icon        = MessageBoxIcon.Exclamation;
         MessageBoxButtons        buttons     = MessageBoxButtons.OK;
         string caption  = "ef | Export To Unity";
         int    num      = 1;
         bool   @checked = this.radioButtonSingleObject.Checked;
         if (@checked)
         {
             num = 1;
         }
         bool checked2 = this.radioButtonByTypes.Checked;
         if (checked2)
         {
             num = 5;
         }
         bool checked3 = this.radioButtonMaterialsFast.Checked;
         if (checked3)
         {
             num = 6;
         }
         bool flag  = false;
         bool flag2 = document.ActiveView.ViewType != ViewType.ThreeD;
         if (flag2)
         {
             MessageBox.Show("The active view must be a 3D view type.");
             base.Close();
         }
         bool flag3 = document.ActiveView.ViewType == ViewType.ThreeD & document.ActiveView.IsTemplate;
         if (flag3)
         {
             MessageBox.Show("The active view is a template view and is not exportable.");
             flag = true;
             base.Close();
         }
         bool flag4 = document.ActiveView.ViewType == ViewType.ThreeD & !document.ActiveView.IsTemplate;
         if (flag4)
         {
             view3D = (document.ActiveView as View3D);
         }
         bool checked4 = this.checkBoxStartVU.Checked;
         if (checked4)
         {
         }
         Transaction transaction = new Transaction(document);
         transaction.Start("HideAnnotations");
         foreach (object obj in document.Settings.Categories)
         {
             Category category = (Category)obj;
             bool     flag5    = category.get_AllowsVisibilityControl(view3D);
             if (flag5)
             {
                 bool flag6 = category.CategoryType != CategoryType.Model;
                 if (flag6)
                 {
                     view3D.SetCategoryHidden(category.Id, true);
                 }
             }
         }
         transaction.Commit();
         int  num2  = 500000;
         int  num3  = 2000000;
         int  num4  = num3 * 2;
         bool flag7 = !this.checkBoxMaxVertices.Checked;
         if (flag7)
         {
             bool flag8 = !flag;
             if (flag8)
             {
                 bool flag9 = view3D != null;
                 if (flag9)
                 {
                     CheckExportContext checkExportContext = new CheckExportContext(document, this.m_AllViews);
                     new CustomExporter(document, checkExportContext)
                     {
                         IncludeGeometricObjects = false,
                         ShouldStopOnError       = false
                     }.Export(view3D);
                     this.m_AllViews.GroupingOptions = 0;
                     bool checked5 = this.radioButtonSingleObject.Checked;
                     if (checked5)
                     {
                         this.m_AllViews.GroupingOptions = 3;
                     }
                     bool checked6 = this.radioButtonByTypes.Checked;
                     if (checked6)
                     {
                         this.m_AllViews.GroupingOptions = 5;
                     }
                     bool checked7 = this.radioButtonMaterialsFast.Checked;
                     if (checked7)
                     {
                         this.m_AllViews.GroupingOptions = 6;
                     }
                     bool flag10 = checkExportContext.TotalNBofPoints > num2;
                     if (flag10)
                     {
                         DialogResult dialogResult = MessageBox.Show("Cette vue contient " + checkExportContext.TotalNBofPoints.ToString() + " vertices.\nVoulez-vous vraiment continuer?", "Avertissement", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);
                         bool         flag11       = dialogResult == DialogResult.No;
                         if (flag11)
                         {
                             flag = true;
                         }
                     }
                     bool flag12 = checkExportContext.TotalNBofPoints > num4;
                     if (flag12)
                     {
                         MessageBox.Show(string.Concat(new string[]
                         {
                             "This 3D View contains ",
                             checkExportContext.TotalNBofPoints.ToString(),
                             " Vertices.\nMax Vertices per Export: ",
                             num4.ToString(),
                             "."
                         }), caption, buttons, icon);
                         flag = true;
                     }
                 }
             }
         }
         bool flag13 = flag;
         if (flag13)
         {
             base.Close();
         }
         bool flag14 = application.VersionNumber.Contains("2019") | application.VersionNumber.Contains("2020");
         if (flag14)
         {
             bool flag15 = !this.checkBoxMaxVertices.Checked;
             if (flag15)
             {
                 bool flag16 = view3D != null & !flag;
                 if (flag16)
                 {
                     this.context = new CheckExportContext(document, this.m_AllViews);
                     CustomExporter customExporter = new CustomExporter(document, this.context);
                     customExporter.IncludeGeometricObjects = false;
                     customExporter.ShouldStopOnError       = false;
                     try
                     {
                         this.m_AllViews.ExportSubCategories = false;
                         bool flag17 = num == 1 | num == 5 | num == 6;
                         if (flag17)
                         {
                             int num5 = 1000;
                             FilteredElementCollector filteredElementCollector6 = new FilteredElementCollector(document, view3D.Id);
                             ICollection <ElementId>  collection6 = filteredElementCollector6.ToElementIds();
                             ICollection <ElementId>  collection7 = filteredElementCollector6.ToElementIds();
                             collection7.Clear();
                             List <int> list2  = new List <int>();
                             List <int> list3  = new List <int>();
                             List <int> list4  = new List <int>();
                             bool       flag18 = false;
                             foreach (ElementId elementId in collection6)
                             {
                                 bool    flag19  = false;
                                 Element element = document.GetElement(elementId);
                                 bool    flag20  = element != null;
                                 if (flag20)
                                 {
                                     bool flag21 = element.Category != null;
                                     if (flag21)
                                     {
                                         bool flag22 = element.Category.CategoryType == CategoryType.Model;
                                         if (flag22)
                                         {
                                             flag19 = true;
                                         }
                                         bool flag23 = element.Category.Id.IntegerValue == -2001340;
                                         if (flag23)
                                         {
                                             flag18 = true;
                                         }
                                         bool flag24 = element.Category.Id.IntegerValue == -2001352;
                                         if (flag24)
                                         {
                                             flag18 = true;
                                         }
                                     }
                                     bool flag25 = element.GetTypeId() != null;
                                     if (flag25)
                                     {
                                         int  integerValue = element.GetTypeId().IntegerValue;
                                         bool flag26       = flag19 & !flag18;
                                         if (flag26)
                                         {
                                             GeometryElement geometryElement = element.get_Geometry(new Options
                                             {
                                                 ComputeReferences = true
                                             });
                                             bool flag27 = geometryElement != null;
                                             if (flag27)
                                             {
                                                 foreach (GeometryObject geometryObject in geometryElement)
                                                 {
                                                     bool flag28 = geometryObject is Solid;
                                                     if (flag28)
                                                     {
                                                         Solid solid  = geometryObject as Solid;
                                                         bool  flag29 = null != solid;
                                                         if (flag29)
                                                         {
                                                             bool flag30 = solid.Faces.Size > 0;
                                                             if (flag30)
                                                             {
                                                                 flag18 = true;
                                                                 break;
                                                             }
                                                         }
                                                     }
                                                     GeometryInstance geometryInstance = geometryObject as GeometryInstance;
                                                     bool             flag31           = null != geometryInstance;
                                                     if (flag31)
                                                     {
                                                         foreach (GeometryObject geometryObject2 in geometryInstance.SymbolGeometry)
                                                         {
                                                             Solid solid2 = geometryObject2 as Solid;
                                                             bool  flag32 = null != solid2;
                                                             if (flag32)
                                                             {
                                                                 bool flag33 = solid2.Faces.Size > 0;
                                                                 if (flag33)
                                                                 {
                                                                     flag18 = true;
                                                                     break;
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                         bool flag34 = !list2.Contains(integerValue) && flag18;
                                         if (flag34)
                                         {
                                             list2.Add(integerValue);
                                         }
                                     }
                                 }
                                 flag18 = false;
                             }
                             for (int i = 0; i < list2.Count; i++)
                             {
                                 int  item   = list2[i];
                                 int  num6   = 0;
                                 bool flag35 = num6 <= num5;
                                 if (flag35)
                                 {
                                     list4.Add(item);
                                 }
                                 bool flag36 = num6 > num5;
                                 if (flag36)
                                 {
                                     list3.Add(item);
                                 }
                             }
                             bool flag37 = list4.Count > 0;
                             if (flag37)
                             {
                                 bool flag38 = false;
                                 foreach (ElementId elementId2 in collection6)
                                 {
                                     Element element2 = document.GetElement(elementId2);
                                     bool    flag39   = element2 != null;
                                     if (flag39)
                                     {
                                         int  integerValue2 = element2.GetTypeId().IntegerValue;
                                         bool flag40        = !list4.Contains(integerValue2);
                                         if (flag40)
                                         {
                                             bool flag41 = element2.Category != null;
                                             if (flag41)
                                             {
                                                 bool flag42 = element2.Category.Id.IntegerValue == -2001340;
                                                 if (flag42)
                                                 {
                                                     flag38 = true;
                                                 }
                                             }
                                             bool flag43 = !flag18;
                                             if (flag43)
                                             {
                                                 GeometryElement geometryElement2 = element2.get_Geometry(new Options
                                                 {
                                                     ComputeReferences = true
                                                 });
                                                 bool flag44 = geometryElement2 != null;
                                                 if (flag44)
                                                 {
                                                     foreach (GeometryObject geometryObject3 in geometryElement2)
                                                     {
                                                         bool flag45 = geometryObject3 is Solid;
                                                         if (flag45)
                                                         {
                                                             Solid solid3 = geometryObject3 as Solid;
                                                             bool  flag46 = null != solid3;
                                                             if (flag46)
                                                             {
                                                                 bool flag47 = solid3.Faces.Size > 0;
                                                                 if (flag47)
                                                                 {
                                                                     flag38 = true;
                                                                     break;
                                                                 }
                                                             }
                                                         }
                                                         GeometryInstance geometryInstance2 = geometryObject3 as GeometryInstance;
                                                         bool             flag48            = null != geometryInstance2;
                                                         if (flag48)
                                                         {
                                                             foreach (GeometryObject geometryObject4 in geometryInstance2.SymbolGeometry)
                                                             {
                                                                 Solid solid4 = geometryObject4 as Solid;
                                                                 bool  flag49 = null != solid4;
                                                                 if (flag49)
                                                                 {
                                                                     bool flag50 = solid4.Faces.Size > 0;
                                                                     if (flag50)
                                                                     {
                                                                         flag38 = true;
                                                                         break;
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                             bool flag51 = flag38;
                                             if (flag51)
                                             {
                                                 bool flag52 = element2.CanBeHidden(view3D);
                                                 if (flag52)
                                                 {
                                                     collection7.Add(elementId2);
                                                 }
                                             }
                                         }
                                     }
                                     flag38 = false;
                                 }
                                 Transaction transaction2 = new Transaction(document);
                                 transaction2.Start("TempHideType");
                                 bool flag53 = collection7.Count > 0;
                                 if (flag53)
                                 {
                                     view3D.HideElements(collection7);
                                 }
                                 transaction2.Commit();
                                 customExporter.Export(view3D);
                                 Transaction transaction3 = new Transaction(document);
                                 transaction3.Start("TempUnhideType");
                                 bool flag54 = collection7.Count > 0;
                                 if (flag54)
                                 {
                                     view3D.UnhideElements(collection7);
                                 }
                                 transaction3.Commit();
                                 collection7.Clear();
                             }
                             bool flag55 = list3.Count > 0;
                             if (flag55)
                             {
                                 foreach (int num7 in list3)
                                 {
                                     bool flag56 = false;
                                     bool flag57 = num7 != -1;
                                     if (flag57)
                                     {
                                         foreach (ElementId elementId3 in collection6)
                                         {
                                             Element element3 = document.GetElement(elementId3);
                                             bool    flag58   = element3 != null;
                                             if (flag58)
                                             {
                                                 int  integerValue3 = element3.GetTypeId().IntegerValue;
                                                 bool flag59        = num7 != integerValue3;
                                                 if (flag59)
                                                 {
                                                     bool flag60 = element3.Category != null;
                                                     if (flag60)
                                                     {
                                                         bool flag61 = element3.Category.Id.IntegerValue == -2001340;
                                                         if (flag61)
                                                         {
                                                             flag56 = true;
                                                         }
                                                     }
                                                     bool flag62 = !flag56;
                                                     if (flag62)
                                                     {
                                                         GeometryElement geometryElement3 = element3.get_Geometry(new Options
                                                         {
                                                             ComputeReferences = true
                                                         });
                                                         bool flag63 = geometryElement3 != null;
                                                         if (flag63)
                                                         {
                                                             foreach (GeometryObject geometryObject5 in geometryElement3)
                                                             {
                                                                 bool flag64 = geometryObject5 is Solid;
                                                                 if (flag64)
                                                                 {
                                                                     Solid solid5 = geometryObject5 as Solid;
                                                                     bool  flag65 = null != solid5;
                                                                     if (flag65)
                                                                     {
                                                                         bool flag66 = solid5.Faces.Size > 0;
                                                                         if (flag66)
                                                                         {
                                                                             flag56 = true;
                                                                             break;
                                                                         }
                                                                     }
                                                                 }
                                                                 GeometryInstance geometryInstance3 = geometryObject5 as GeometryInstance;
                                                                 bool             flag67            = null != geometryInstance3;
                                                                 if (flag67)
                                                                 {
                                                                     foreach (GeometryObject geometryObject6 in geometryInstance3.SymbolGeometry)
                                                                     {
                                                                         Solid solid6 = geometryObject6 as Solid;
                                                                         bool  flag68 = null != solid6;
                                                                         if (flag68)
                                                                         {
                                                                             bool flag69 = solid6.Faces.Size > 0;
                                                                             if (flag69)
                                                                             {
                                                                                 flag56 = true;
                                                                                 break;
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                     bool flag70 = flag56;
                                                     if (flag70)
                                                     {
                                                         bool flag71 = element3.CanBeHidden(view3D);
                                                         if (flag71)
                                                         {
                                                             collection7.Add(elementId3);
                                                         }
                                                     }
                                                 }
                                             }
                                             flag56 = false;
                                         }
                                         Transaction transaction4 = new Transaction(document);
                                         transaction4.Start("TempHideType");
                                         bool flag72 = collection7.Count > 0;
                                         if (flag72)
                                         {
                                             view3D.HideElements(collection7);
                                         }
                                         transaction4.Commit();
                                         customExporter.Export(view3D);
                                         Transaction transaction5 = new Transaction(document);
                                         transaction5.Start("TempUnhideType");
                                         bool flag73 = collection7.Count > 0;
                                         if (flag73)
                                         {
                                             view3D.UnhideElements(collection7);
                                         }
                                         transaction5.Commit();
                                         collection7.Clear();
                                     }
                                 }
                             }
                         }
                     }
                     catch (ExternalApplicationException ex)
                     {
                         Debug.Print("ExternalApplicationException " + ex.Message);
                     }
                     bool flag74 = !flag;
                     if (flag74)
                     {
                         foreach (int num8 in this.context.ListMaterialID)
                         {
                             bool flag75 = num8 != ElementId.InvalidElementId.IntegerValue & !num8.ToString().Contains("-") & num8.ToString() != "-1";
                             if (flag75)
                             {
                                 ElementId elementId4 = new ElementId(num8);
                                 Material  material   = document.GetElement(elementId4) as Material;
                                 bool      flag76     = material != null;
                                 if (flag76)
                                 {
                                     FillPatternElement fillPatternElement = document.GetElement(material.SurfaceForegroundPatternId) as FillPatternElement;
                                     bool flag77 = fillPatternElement != null;
                                     if (flag77)
                                     {
                                         bool flag78 = !list.Contains(fillPatternElement.Name);
                                         if (flag78)
                                         {
                                             list.Add(fillPatternElement.Name);
                                             this.h_MatIDPatID.Add(material.Id.IntegerValue, fillPatternElement.Id.IntegerValue);
                                             this.key_MatIDPatID = this.h_MatIDPatID.Keys;
                                         }
                                     }
                                 }
                             }
                         }
                         bool flag79 = list != null;
                         if (flag79)
                         {
                             bool flag80 = list.Count > 0;
                             if (flag80)
                             {
                                 this.listBoxPatterns.DataSource = list;
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex2)
     {
         MessageBox.Show(ex2.Message);
     }
 }