Bounding Box Issue

Bounding Box Issue

Anonymous
Not applicable
705 Views
1 Reply
Message 1 of 2

Bounding Box Issue

Anonymous
Not applicable

When I use bounding box for joining wall and structural framing, while joining it its shows warning that Highlighted elements are joined but do not intersect. 

 

This is because of the structural framing bounding box is joined to wall bounding box,but not actual structural framing and wall has been Intersect.

 

I want to join wall and structural framing and also use bounding box for this.I want the bounding box is equal to actual length of structural framing that means structural framing and bounding box boundary is same. How I do this without changing revit model only bounding box boundary is equal to actual element length?

 

 

 

 

 

Here is my code:

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace JoinGeometry
{
[Transaction(TransactionMode.Manual)]
class WBjoin
{
bool check;
public Result Execute(ExternalCommandData commandData)
{
UIApplication uiApp = commandData.Application;
UIDocument uidoc = uiApp.ActiveUIDocument;
Document doc = uidoc.Document;

 

 

//--get walls on the active view-----------

FilteredElementCollector collWalls = new FilteredElementCollector(doc, doc.ActiveView.Id);
collWalls.OfClass(typeof(Wall));

try
{
foreach (Wall w in collWalls)
{
FilteredElementCollector wallbeam = new FilteredElementCollector(doc, doc.ActiveView.Id);

wallbeam.OfClass(typeof(FamilyInstance));
wallbeam.OfCategory(BuiltInCategory.OST_StructuralFraming);


BoundingBoxXYZ bb = w.get_BoundingBox(doc.ActiveView);
Outline outline = new Outline(bb.Min,bb.Max);


BoundingBoxIntersectsFilter bbfilter =
new BoundingBoxIntersectsFilter(outline);
wallbeam.WherePasses(bbfilter);

foreach (FamilyInstance bem in wallbeam)
{

using (Transaction t = new Transaction(doc, "Join All Walls/beam"))
{
t.Start();


check = JoinGeometryUtils.AreElementsJoined(doc, w, bem);
if (check == true)
{

}
else
{
JoinGeometryUtils.JoinGeometry(doc, w, bem);
}

t.Commit();
}

}


}
}
catch
{
TaskDialog.Show("Revit", "not join");
}



return Result.Succeeded;
}
}
}

 

 

 

 

 

 

What changes I want to do in the code for this?

0 Likes
706 Views
1 Reply
Reply (1)
Message 2 of 2

jeremytammik
Autodesk
Autodesk

Dear Payaloma,

 

Sorry, but I do not understand you question.

 

There is no way to join bounding boxes.

 

You can join elements and their geometry, but not their bounding boxes.

 

The only purpose of a bounding box is to give a very rough indication of the space occupied by an element.

 

It is not used in any other way whatsoever.

 

I hope this helps.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes