• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk Revit API

    Reply
    Active Member
    Posts: 6
    Registered: 08-03-2005

    Place Repeating Detail Again

    98 Views, 2 Replies
    02-22-2012 08:06 AM

    Working on my first batch of programming with the API.  Hit my first question that I cannot answer with Google.

     

    I am trying to place a repeating detail.  I read this

     

    http://forums.autodesk.com/t5/Autodesk-Revit-API/Place-repeating-detail-using-the-API/td-p/3313195

     

    And it mostly made sense.  The problem is, in the code sample it says "// fine (sic) the family symbol here" as a comment in the code.  I cannot figure out how to pick the family symbol I want. 

     

    I've spent a lot of time with FamilySymbol, but no luck.

     

    Any guidance on selecting the symbol I want to use?  And feel free to speak slowly.  Like I said, this is my first dive in the Revit API.  Thanks.

     

    Valued Contributor
    ollikat
    Posts: 63
    Registered: 04-01-2011

    Re: Place Repeating Detail Again

    02-23-2012 10:10 PM in reply to: jkunkel

    I'm not 100% if this is what you are looking for but here it is. A sample code searching a family symbol based on category and name. Code is C++/CLI but its somewhat similar with the C#

     

    List<FamilySymbol^>^ familySymbols(Document^ document, 
                                                               BuiltInCategory category,
                                                               String^ name)
    {
      // Filters
      ElementCategoryFilter ^categoryFilter = gcnew ElementCategoryFilter(category);
      ElementClassFilter ^classFilter             = gcnew ElementClassFilter(FamilySymbol::typeid);
      LogicalAndFilter ^lFilter                        = gcnew LogicalAndFilter(categoryFilter, classFilter);
    
      // Elements lookup
      FilteredElementCollector ^elementCollector = gcnew FilteredElementCollector(document);
      elementCollector->WherePasses(lFilter);
    
      // Find correct element and cast it to FamilySymbol
      List<FamilySymbol^> ^familyList = gcnew List<FamilySymbol^>;
      for each (Element ^elem in elementCollector)
      {
        FamilySymbol ^familySymbol = safe_cast<FamilySymbol^>(elem);
        if(familySymbol->Family->Name->Equals(name)
        {
          familyList->Add(familySymbol);
        }
      }
    
      return familyList;
    }

     

    Active Member
    Posts: 6
    Registered: 08-03-2005

    Re: Place Repeating Detail Again

    02-24-2012 06:16 AM in reply to: ollikat

    Thanks.  After some c# massagin, it does precisely what I wanted it to do.

     

    Of course, after much pacing, I think I am realizing that I am not knowledgeable enough to know what I really need this to do.

     

    Maybe I should back up and ask everyone, is it even possible to place a Repeating Detail with the API?  With the above poster's help, I have been able to place single detail component and a line-based detail component, but no Repeating Detail.  I have used different BuiltInCategories, different overloads of the NewFamilyInstance, but no dice.

     

    So, is placing a Repeating Detail even possible?