© 2010 Autodesk
Introduction to Revit 2011 API
Model Creation
Create a Wall
<VB.NET>
''  create walls
Sub CreateWalls()
    ''  get the levels we want to work on. 
    Dim level1 As Level = ElementFiltering.FindElement(m_rvtDoc, GetType(Level), "Level 1")
    Dim level2 As Level = ElementFiltering.FindElement(m_rvtDoc, GetType(Level), "Level 2")
 
    ''  set four corner of walls.
    Dim pts As New List(Of XYZ)(5)
    ...
 
    Dim isStructural As Boolean = False ''  flag for structural wall or not.
    ''  loop through list of points and define four walls.
    For i As Integer = 0 To 3
        ''  define a base curve from two points.
        Dim baseCurve As Line = m_rvtApp.Create.NewLineBound(pts(i), pts(i + 1))
        ''  create a wall using the one of overloaded methods.
        Dim aWall As Wall = m_rvtDoc.Create.NewWall(baseCurve, level1, isStructural)
        ''  set the Top Constraint to Level 2
        aWall.Parameter(BuiltInParameter.WALL_HEIGHT_TYPE).Set(level2.Id)
    Next
    ''  This is important. we need these lines to have shrinkwrap working.
    m_rvtDoc.Regenerate()
    m_rvtDoc.AutoJoinElements()
End Sub
</VB.NET>
Model Creation
New Walls