private Autodesk.Revit.DB.View CreateTemplateFor3DView(Autodesk.Revit.DB.View viewTemplate) { Transaction t = new Transaction(_doc); t.Start("Create view template 'DCE Structure 3D'"); // Copy an existing view template ICollection <ElementId> copyIds = new Collection <ElementId> { viewTemplate.Id }; // Create a default CopyPasteOptions CopyPasteOptions cpOpts = new CopyPasteOptions(); ElementId tmpId = ElementTransformUtils.CopyElements( _doc, copyIds, _doc, Transform.Identity, cpOpts) .First(); viewTemplate = _doc.GetElement(tmpId) as Autodesk.Revit.DB.View; viewTemplate.Name = THREED_VIEW_TEMPLATE_NAME; t.Commit(); // Ensure that the parameters are included in "DCE Structure 3D" view template List <BuiltInParameter> bipList = new List <BuiltInParameter>() { BuiltInParameter.VIEW_SCALE_PULLDOWN_METRIC, BuiltInParameter.VIEW_DETAIL_LEVEL, // BuiltInParameter.VIEW_PARTS_VISIBILITY, BuiltInParameter.VIS_GRAPHICS_MODEL, BuiltInParameter.VIS_GRAPHICS_ANNOTATION, // BuiltInParameter.VIS_GRAPHICS_ANALYTICAL_MODEL, // BuiltInParameter.VIS_GRAPHICS_IMPORT, BuiltInParameter.VIS_GRAPHICS_FILTERS, BuiltInParameter.VIS_GRAPHICS_RVT_LINKS, BuiltInParameter.GRAPHIC_DISPLAY_OPTIONS_MODEL, //BuiltInParameter.GRAPHIC_DISPLAY_OPTIONS_SHADOWS, //BuiltInParameter.GRAPHIC_DISPLAY_OPTIONS_SKETCHY_LINES, //BuiltInParameter.GRAPHIC_DISPLAY_OPTIONS_LIGHTING, //BuiltInParameter.GRAPHIC_DISPLAY_OPTIONS_PHOTO_EXPOSURE, //BuiltInParameter.GRAPHIC_DISPLAY_OPTIONS_BACKGROUND, //BuiltInParameter.VIEW_PHASE_FILTER, BuiltInParameter.VIEW_DISCIPLINE, BuiltInParameter.VIEW_SHOW_HIDDEN_LINES, //BuiltInParameter.VIEWER3D_RENDER_SETTINGS }; ViewTemplate.IncludParamToViewTemplate(_doc, viewTemplate, bipList); List <BuiltInCategory> bicList = new List <BuiltInCategory> { BuiltInCategory.OST_Walls, BuiltInCategory.OST_StructuralColumns, BuiltInCategory.OST_StructuralFraming, BuiltInCategory.OST_Floors, BuiltInCategory.OST_StructuralFoundation }; ViewTemplate.SetOnlyCategoriesVisible(_doc, viewTemplate, bicList); t.Start("Set view display paramters"); // Set the scale value viewTemplate.Scale = 400; // Set the detail level viewTemplate.DetailLevel = ViewDetailLevel.Fine; // Set the display style viewTemplate.DisplayStyle = DisplayStyle.ShadingWithEdges; // Set the discipline viewTemplate.Discipline = ViewDiscipline.Structural; OverrideGraphicSettings ogs = new OverrideGraphicSettings(); ogs.SetSurfaceTransparency(50); ogs.SetCutFillPatternVisible(false); viewTemplate.SetCategoryOverrides( _doc.Settings.Categories.get_Item(BuiltInCategory.OST_Floors).Id, ogs); // Remove all the filter in the view template foreach (ElementId id in viewTemplate.GetFilters()) { viewTemplate.RemoveFilter(id); } t.Commit(); return(viewTemplate); }