Place Repeating Detail Again

Place Repeating Detail Again

Anonymous
Not applicable
769 Views
3 Replies
Message 1 of 4

Place Repeating Detail Again

Anonymous
Not applicable

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.

 

0 Likes
770 Views
3 Replies
Replies (3)
Message 2 of 4

ollikat
Collaborator
Collaborator

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;
}

 

Message 3 of 4

Anonymous
Not applicable

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?

0 Likes
Message 4 of 4

lionel.kai
Advisor
Advisor

@Anonymous It looks like you're right - placing Repeating Detail idea is here: Expose Repeated Detail Component to API


Lionel J. Camara
BIM Manager at KAI Hawaii, Inc. - Structural and Forensic Engineers
Autodesk Certified Professional
0 Likes