Autodesk Revit API
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Place repeating detail using the API
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi, I am trying to figure out how to place a repeating detail in a model using the API.
I have the Repeating Detail component defined already in my document, so I assume that it is just a matter of finding the right Family Symbol for my repeating component and treating as a line detail component using something like doc.Create.NewFamilyInstance(Line,Family Symbol,View)
but I can't quite figure out how to get it to work.
Any advice would be much apprecieated.
Thanks,
Clayton
Re: Place repeating detail using the API
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi Clayton,
If you know the family symbol, it is just as you said, call NewFamilyInstance to generate the family instance.
The code should like: (Note, I didn't add the code to find the target family symbol)
[Autodesk.Revit.Attributes.Transaction(Autodesk.Re
[Autodesk.Revit.Attributes.Journaling(Autodesk.Rev
public class CreateRepeatDetail : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
try
{
UIApplication app = commandData.Application;
Document doc = app.ActiveUIDocument.Document;
Transaction trans = new Transaction(doc);
trans.Start();
//find the symbol.
FamilySymbol symbol = null;
// fine the family symbol here.
// create the line
Line line = app.Application.Create.NewLineBound(new XYZ(0, 0, 0), new XYZ(20, 0, 0));
//Create the instance.
FamilyInstance instance = doc.Create.NewFamilyInstance(line, symbol, doc.ActiveView);
trans.Commit();
return Result.Succeeded;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return Result.Failed;
}
}
}
Note: For simplicity, I use doc.ActiveView to get a view. This requires your active view is not a 3D view.
Hope this helps.
If this still cannot make you through, please upload your family, i will finish the command.
Autodesk Developer Network

