»Dim doc As Revit.Document =
commandData.Application.ActiveDocument
»Dim ss As ElementSet = doc.Selection.Elements
»
»' must have single element only
»If Not ss.Size = 1 Then
» MsgBox( "You
must pre-select a single element!" )
» Return
IExternalCommand.Result.Cancelled
»End If
»
»' must be a wall
»Dim iter As ElementSetIterator = ss.ForwardIterator
»iter.MoveNext()
»Dim elem As Revit.Element = iter.Current
»If Not TypeOf elem Is Wall Then
» MsgBox( "Selected
element is NOT a wall!" )
» Return
IExternalCommand.Result.Cancelled
»End If
»Dim wall As Wall = elem