12
Transactions 'Create a transaction, a bucket of database changes to the Revit model Using trans As Transaction = New Transaction( _ uiApp.ActiveUIDocument.Document, "Walls“) End Using Walls.vb

13
Transactions 'Create a transaction, a bucket of database changes to the Revit model Using trans As Transaction = New Transaction( _ uiApp.ActiveUIDocument.Document, "Walls") End Using Walls.vb 'Start the transaction trans.Start

16
Transactions 'Let's make each wall go up to Level 2... 'Use an iterator to loop through all the walls we just created Dim iter As ElementSetIterator = Walls.ForwardIterator End Using Walls.vb 'create the walls Walls.Insert(Wall.Create(doc, westWall, levelId, False)) Walls.Insert(Wall.Create(doc, eastWall, levelId, False)) Walls.Insert(Wall.Create(doc, northWall, levelId, False)) Walls.Insert(Wall.Create(doc, southWall, levelId, False))

17
Transactions 'Let's make each wall go up to Level 2... 'Use an iterator to loop through all the walls we just created Dim iter As ElementSetIterator = Walls.ForwardIterator End Using Walls.vb Do While iter.MoveNext Dim w As Wall = iter.Current 'This WALL_HEIGHT_TYPE parameter is the name for the Top Constraint 'Use the RevitLookup tool in the SDK to help you discover parameter names. w.Parameter(BuiltInParameter.WALL_HEIGHT_TYPE).Set( _ levels.Item("Level 2").Id) Loop

18
Transactions Do While iter.MoveNext... Loop 'commit the walls to the model trans.Commit() End Using Walls.vb

22
Door Type 'Create a collector so we can get the door symbol (Door Type in Revit UI) Dim collector As FilteredElementCollector = _ New FilteredElementCollector(uiApp.ActiveUIDocument.Document) 'Filter the collector for only Door related items collector.OfCategory(BuiltInCategory.OST_Doors) 'Filter the collector for only symbols (types in Revit UI) collector.OfClass(GetType(FamilySymbol)) 'Grab the first element from the collector Dim doorSymbol As FamilySymbol = collector.FirstElement Families.vb

33
Create Sheet 'Create the sheet and change its name Dim sheet As ViewSheet = docCreator.NewViewSheet(titleblock) sheet.Name = name Sheets.vb

34
Create Sheet 'We need to make sure the view hasn't already been added to a sheet 'If we don't check, and the view has been added, we'll get an exception If Viewport.CanAddViewToSheet( _ uiApp.ActiveUIDocument.Document, sheet.Id, view.Id) Then End If Sheets.vb

35
Create Sheet 'We need to make sure the view hasn't already been added to a sheet 'If we don't check, and the view has been added, we'll get an exception If Viewport.CanAddViewToSheet( _ uiApp.ActiveUIDocument.Document, sheet.Id, view.Id) Then 'Get the outline of the view so we can determine its width and height Dim outline As BoundingBoxUV = view.Outline width = outline.Max.U - outline.Min.U height = outline.Max.V - outline.Min.V End If Sheets.vb