How to Join two structural framings
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to join two structural framing..This is the code I had written below but its show error.I attached some screen shoot for this.
plz tell me what mistake that I had done.If possible plz tell the code
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
namespace JoinGeometry
{
[Transaction(TransactionMode.Manual)]
class BBunjoin:IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
UIApplication uiApp = commandData.Application;
UIDocument uidoc = uiApp.ActiveUIDocument;
Document doc = uidoc.Document;
//--get walls on the active view-----------
FilteredElementCollector beam1 = new FilteredElementCollector(doc, doc.ActiveView.Id);
beam1.OfClass(typeof(FamilyInstance));
beam1.OfCategory(BuiltInCategory.OST_StructuralFraming);
foreach (FamilyInstance bem1 in beam1)
{
FilteredElementCollector beam2 = new FilteredElementCollector(doc, doc.ActiveView.Id);
beam2.OfClass(typeof(FamilyInstance));
beam2.OfCategory(BuiltInCategory.OST_StructuralFraming);
/* BoundingBoxXYZ bb = bem1.get_BoundingBox(doc.ActiveView);
Outline outline = new Outline(bb.Min, bb.Max);
BoundingBoxIntersectsFilter bbfilter =
new BoundingBoxIntersectsFilter(outline);
beam2.WherePasses(bbfilter);*/
foreach (FamilyInstance bem2 in beam2)
{
using (Transaction t = new Transaction(doc, "Join All beam/beam"))
{
t.Start();
JoinGeometryUtils.JoinGeometry(doc, bem1, bem2);
t.Commit();
}
}
}
return Result.Succeeded;
}
}
}
