PPT_LOGO_4b
Revit Programming Introduction <#>
Copyright © 2009 Autodesk Inc.
柱タイプ
»' Get Family Type for the new instances.
»' Names must match a column type available in the model
»Dim sFamilyName As String = "M_Wood Timber Column"
»Dim sTypeName As String = "191 x 292mm"
»Dim symbol As FamilySymbol = LabUtils.GetFamilySymbol( _
»  doc, sFamilyName, sTypeName)
»If symbol Is Nothing Then
»  MsgBox("Cannot find Family=" & sFamilyName & " Type=" & sTypeName _
»    & " in the model - load it first!")
»  Return IExternalCommand.Result.Cancelled
»End If
要素コレクション
    /// Helper to get specified Type for specified Family as FamilySymbol object
    public static FamilySymbol GetFamilySymbol(
      Application app,
      string familyName,
      string typeName )
    {
      Filter filterType = app.Create.Filter.NewTypeFilter( typeof( FamilySymbol ) );
      Filter filterFamilyName = app.Create.Filter.NewFamilyFilter( familyName );
      Filter filter = app.Create.Filter.NewLogicAndFilter( filterType, filterFamilyName );
      List<Element> elementList = new List<Element>();
      int n = app.ActiveDocument.get_Elements( filter, elementList );
      // we have a list of symbols for a given family.
      // loop through the list and find a match
      foreach( Element e in elementList )
      {
        if( e.Name.Equals( typeName ) )
        {
          return e as FamilySymbol;
        }
      }
      return null;
    }