private static Result createReshoringLayoutSheets(UIDocument uiDoc) { Document _doc = uiDoc.Document; string _titleblockName = "E1 30 x 42 Horizontal: E1 30x42 Horizontal"; XYZ _columnScheduleBottomLeft = new XYZ(2.3354130772204, 2.39482128194158, 0); XYZ _viewCenter = new XYZ(1.45453036348288, 1.18116967618813, 0.871414246948733); XYZ _levelScheduleBottomLeft = new XYZ(0.156336990263879, 2.37688649933288, 0); var _levels = Getters.GetLevels(_doc); Level _levelAbove = null; Level _topLevel = _levels.FirstOrDefault(); Level _bottomLevel = _levels.LastOrDefault(); List <Tuple <ViewSheet, View> > _sheetsWithViews = new List <Tuple <ViewSheet, View> >(); foreach (Level _level in _levels) { if (_levelAbove == null) { _levelAbove = _level; } BoundedViewCreator _boundedViewCreator = new BoundedViewCreator(_level, null, null); SheetCreator _sheetCreator = new SheetCreator(_doc); string _viewName = _boundedViewCreator.GetViewName(string.Empty, "FP"); ViewSheet _viewSheet = _sheetCreator.CreateSheet(_titleblockName, _viewName, _viewName); ViewPlan _viewPlan = _boundedViewCreator.CreateViewPlan(80); _sheetsWithViews.Add(new Tuple <ViewSheet, View>(_viewSheet, _viewPlan)); ViewSchedule _columnSchedule = ScheduleCreator.CreateLayoutColumnSchedule(_doc, _level.Name, " Reshores"); ScheduleSheetInstance _columnScheduleSheetInstance = ScheduleSheetInstance.Create(_doc, _viewSheet.Id, _columnSchedule.Id, _columnScheduleBottomLeft); ViewSchedule _levelSchedule = ScheduleCreator.CreateLayoutLoadSchedule(_doc, _level.Name, " Loads"); ScheduleSheetInstance _levelScheduleSheetInstance = ScheduleSheetInstance.Create(_doc, _viewSheet.Id, _levelSchedule.Id, _levelScheduleBottomLeft); _levelAbove = _level; } _doc.Regenerate(); FamilySymbol _tagSymbol = new FilteredElementCollector(_doc) .OfCategory(BuiltInCategory.OST_MultiCategoryTags) .OfClass(typeof(FamilySymbol)).OfType <FamilySymbol>() .FirstOrDefault(p => p.FamilyName.Contains("Mark")); foreach (var _sheetWithView in _sheetsWithViews) { DimensionCreator.CreateDimensions(_sheetWithView.Item2); TagCreator.CreateTags(_sheetWithView.Item2, _tagSymbol); Viewport.Create(_doc, _sheetWithView.Item1.Id, _sheetWithView.Item2.Id, _viewCenter); } return(Result.Succeeded); }
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); }
private static void createSheetsAndViews(Document doc, IEnumerable <VisualizationDeliverable> visualizationDeliverables, BoundingBoxXYZ modelExtents) { //Setup string _titleblockName = "E1 30 x 42 Horizontal: E1 30x42 Horizontal"; int _demandViewScale = 120; int _combinedViewScale = 120; int _capacityViewScale = 120; SheetCreator _sheetCreator = new SheetCreator(doc); OverrideGraphicSettings _modelElementsOgs = getModelOgs(); Level _levelAbove = null; foreach (VisualizationDeliverable _visualizationDeliverable in visualizationDeliverables) { BoundingBoxXYZ _levelBounds = new BoundingBoxXYZ(); _levelBounds.Min = new XYZ(modelExtents.Min.X, modelExtents.Min.Y, _visualizationDeliverable.Level.Elevation); if (_levelAbove == null) { _levelBounds.Max = new XYZ(modelExtents.Max.X, modelExtents.Max.Y, modelExtents.Max.Z); _levelAbove = _visualizationDeliverable.Level; } else { _levelBounds.Max = new XYZ(modelExtents.Max.X, modelExtents.Max.Y, _levelAbove.Elevation); } //View Creation BoundedViewCreator _boundedViewCreator = new BoundedViewCreator(_visualizationDeliverable.Level, null, _levelBounds); string _viewName = _boundedViewCreator.GetViewName("Visualization", string.Empty); ViewSheet _viewSheet = _sheetCreator.CreateSheet(_titleblockName, _viewName, _viewName); _visualizationDeliverable.Sheet = _viewSheet; _visualizationDeliverable.DemandView = createView3D("Demand", _boundedViewCreator, _demandViewScale, _modelElementsOgs); _visualizationDeliverable.CombinedView = createView3D("Combined", _boundedViewCreator, _combinedViewScale, _modelElementsOgs); _visualizationDeliverable.CapacityView = createView3D("Capacity", _boundedViewCreator, _capacityViewScale, _modelElementsOgs); _levelAbove = _visualizationDeliverable.Level; } }