- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I understand that the Revit 2017 sdk samples cover structural connections, however they appear to be removed from the sdk page. Does anyone have sample code that covers creating a new connection and applying that to beams in a project?
I have the base code in place, I just need a way to get custom connections by name and add them to the selected beams. I am only adding base/end plates so I only have one member in the connection (though I have a few hundred instances in the project, hence the need for api automation)
public void FramingAddConnection()
{
UIDocument uidoc = this.ActiveUIDocument;
Document document = uidoc.Document;
Autodesk.Revit.DB.View activev = document.ActiveView;
IList<Reference> felems = uidoc.Selection.PickObjects(ObjectType.Element, "Select Framing Members to Add Connections to");
using (Transaction t = new Transaction(document, "FramingAddConnection"))
{
t.Start();
foreach (Reference eref in felems)
{
ElementId elid = eref.ElementId;
Element el = document.GetElement(elid);
if (el.Category.Name.Contains("Structural Framing"))
{
//TaskDialog.Show("Revit", el.Name.ToString());
FamilyInstance elfi = el as FamilyInstance;
// ADD CONNECTIONS HERE
//StructuralConnectionHandler srcConn =
//StructuralConnectionType stype =
//FramingAddConnection()
}
}
document.Regenerate();
t.Commit();
}
}
Solved! Go to Solution.