static void SetOverrideGraphicSettingsOfCategories(View3D view, OverrideGraphicSettings settings) { Categories cates = view.Document.Settings.Categories; foreach (Category item in cates) { try { view.SetCategoryOverrides(item.Id, settings); } catch { } } //需要另外设置以下元素,因为在Categories找不到 view.SetCategoryOverrides(Category.GetCategory(view.Document, BuiltInCategory.OST_EdgeSlab).Id, settings); //SetOverride(Category.GetCategory(view.Document, BuiltInCategory.OST_EdgeSlab), setting, view); //隐藏以下线条 try { Category.GetCategory(view.Document, BuiltInCategory.OST_DuctCurvesCenterLine).set_Visible(view, false); //风管中心线 Category.GetCategory(view.Document, BuiltInCategory.OST_DuctFittingCenterLine).set_Visible(view, false); //风管管件中心线 Category.GetCategory(view.Document, BuiltInCategory.OST_PipeFittingCenterLine).set_Visible(view, false); //管件中心线 Category.GetCategory(view.Document, BuiltInCategory.OST_PipeCurvesCenterLine).set_Visible(view, false); //管道中心线 Category.GetCategory(view.Document, BuiltInCategory.OST_CableTrayFittingCenterLine).set_Visible(view, false); //电缆桥架配件中心线 Category.GetCategory(view.Document, BuiltInCategory.OST_CableTrayCenterLine).set_Visible(view, false); //电缆桥架中心线 } catch { } }
private static View3D createView3D(string prefix, BoundedViewCreator boundedViewCreator, int demandViewScale, OverrideGraphicSettings modelElementsOgs) { string _fullViewName = boundedViewCreator.GetViewName(prefix, "FP"); View3D _view3D = boundedViewCreator.CreateView3D(demandViewScale, _fullViewName); _view3D.SetCategoryHidden(new ElementId(BuiltInCategory.OST_VolumeOfInterest), true); _view3D.SetCategoryHidden(new ElementId(BuiltInCategory.OST_SectionBox), true); _view3D.SetCategoryHidden(new ElementId(BuiltInCategory.OST_Levels), true); _view3D.SetCategoryHidden(new ElementId(BuiltInCategory.OST_Floors), true); _view3D.SetCategoryOverrides(new ElementId(BuiltInCategory.OST_StructuralColumns), modelElementsOgs); _view3D.SetCategoryOverrides(new ElementId(BuiltInCategory.OST_StructuralFraming), modelElementsOgs); _view3D.SetCategoryOverrides(new ElementId(BuiltInCategory.OST_Walls), modelElementsOgs); _view3D.SetOrientation(new ViewOrientation3D(_view3D.Origin, new XYZ(0, 1, 0), new XYZ(0, 0, -1))); _view3D.AreAnalyticalModelCategoriesHidden = true; return(_view3D); }