Join only selected wall and column

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I create a simple addin for joining wall and column but it join all wall and column in the active view. I want to join only selected wall and column.It is possible without using inbuilt join button which is in revit?
what changes I want to make in this code?
I using this code: for joining all wall and column
UIApplication uiApp = commandData.Application;
UIDocument uidoc = uiApp.ActiveUIDocument;
Document doc = uidoc.Document;
FilteredElementCollector collWalls = new FilteredElementCollector(doc, doc.ActiveView.Id);
collWalls.OfClass(typeof(Wall));
foreach (Wall w in collWalls)
{
FilteredElementCollector collColumnsOnThisWall = new FilteredElementCollector(doc, doc.ActiveView.Id);
collColumnsOnThisWall.OfClass(typeof(FamilyInstance));
collColumnsOnThisWall.OfCategory(BuiltInCategory.OST_StructuralColumns);
BoundingBoxXYZ bb = w.get_BoundingBox(doc.ActiveView);
Outline outline = new Outline(bb.Min, bb.Max);
BoundingBoxIntersectsFilter bbfilter =
new BoundingBoxIntersectsFilter(outline);
collColumnsOnThisWall.WherePasses(bbfilter);
foreach (FamilyInstance column in collColumnsOnThisWall)
{
using (Transaction t = new Transaction(doc, "Join All Walls/Column"))
{
t.Start();
check = JoinGeometryUtils.AreElementsJoined(doc, w, column);
if (check == true)
{
}
else
{
JoinGeometryUtils.JoinGeometry(doc, w, column);
}
t.Commit();
}
}
}