I'm trying to display a new family on a sheet. It doesn't display. How do I do that? This is my sample code:
Public Function Execute(ByVal commandData As Autodesk.Revit.UI.ExternalCommandData, ByRef message As String, ByVal elements As Autodesk.Revit.DB.ElementSet) As Autodesk.Revit.UI.Result Implements Autodesk.Revit.UI.IExternalCommand
.Execute
Dim fileName As String =
"C:\Users\cpo\my documents\titleblock.rfa"
TaskDialog.Show("Title"
, fileName.ToString)
m_rvtUIApp = commandData.Application
TaskDialog.Show(m_rvtUIApp.ToString, ""
)
m_rvtUIDoc = m_rvtUIApp.ActiveUIDocument
TaskDialog.Show(m_rvtUIDoc.ToString, ""
)
m_rvtApp = m_rvtUIApp.Application
TaskDialog.Show(m_rvtApp.ToString, ""
)
m_rvtDoc = m_rvtUIDoc.Document
TaskDialog.Show(m_rvtDoc.ToString, ""
)
Dim family As Family = Nothing
If Not m_rvtDoc.LoadFamily(fileName, family)
Then
Throw New Exception("Unable to load "
+ fileName)
End
If
TaskDialog.Show(family.ToString, ""
)
Dim symbolItor As FamilySymbolSetIterator
= family.Symbols.ForwardIterator()
Dim x As Double = 0, y As Double
= 0
While
symbolItor.MoveNext()
Dim symbol As FamilySymbol = TryCast(symbolItor.Current, FamilySymbol
)
Dim location As New Autodesk.Revit.DB.XYZ
(x, y, 10)
Dim instance As Autodesk.Revit.DB.FamilyInstance = m_rvtDoc.Create.NewFamilyInstance(location, symbol, Autodesk.Revit.DB.Structure.StructuralType
.NonStructural)
TaskDialog.Show(symbol.ToString, ""
)
x += 10
End
While
Return Result
.Succeeded
End
Function
|