Message 1 of 2
Failed to perform the Boolean operation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hope everyone is doing well, the operation I need to execute is a intersection between the room solid space and a solid extrusion from wall faces. In my las post I solved a similar issue by placing a single wall and editing the profile:
Unfortunately, in this next scenario I have a completely different kitchen layout and the problem comes up with the dining room:
this is a small piece of code:
//Set BoundarySegments Options
SpatialElementBoundaryOptions sebOptions = new SpatialElementBoundaryOptions{
SpatialElementBoundaryLocation= SpatialElementBoundaryLocation.Finish
};
//Eliminate or ignore null room location
List<SpatialElement> allRoomsInModel = new FilteredElementCollector(doc).OfClass(typeof(SpatialElement)).WhereElementIsNotElementType().Cast<SpatialElement>().Where(x => x.Category.Name == "Rooms" && x.Location != null).ToList();
if (allRoomsInModel.Any()) {
foreach (SpatialElement element in allRoomsInModel) {
Room room = element as Room;
double roomWallFinishArea = 0;
if (room != null ) {
if (room.Name != "DINING 99") {
continue;
}
SpatialElementGeometryResults results2 = cal.CalculateSpatialElementGeometry(room);
Solid roomSolid2 = results2.GetGeometry(); //GetSolid from spatial geometry
List<double> areas = new List<double>();
#region 2.3) Wall Finish
foreach (Face roomFace in roomSolid2.Faces) {
// Filter spatial room Face by same wall Id from wall retrieved from bounding segment, instead of doing FaceNormal.Z != 1 ...etc.
IList<SpatialElementBoundarySubface> boundaryGeometryInfoList = results2.GetBoundaryFaceInfo(roomFace);//it will retrieve INFO for geometry boundary that define this specific spatial roomFace
foreach (SpatialElementBoundarySubface boundaryGeometryInfo in boundaryGeometryInfoList)//for each wall Info get Face info
{
if (boundaryGeometryInfo.SubfaceType == SubfaceType.Side) //Work with boundary geometry info that is a side face type
{
//get element that gave rise to this geometry face <> wall face
Wall wall = doc.GetElement(boundaryGeometryInfo.SpatialBoundaryElement.HostElementId) as Wall;
if (wall != null) {
//Face of the bounding wall ()
Face wallFace = boundaryGeometryInfo.GetBoundingElementFace();
if (wallFace is PlanarFace) {
//planarFace of the bounding wall
PlanarFace planarWallFc = wallFace as PlanarFace;
if (!areas.Contains(wallFace.Area)) {
//tailorBird.tessellateFace(wallFace,doc);
#region 2.3.1). Create Solid from opening inserts in each boundary wall
IList<ElementId> wallInserts = wall.FindInserts(true,false,true,true);
Solid overallOpeningSolid = null;
if (wallInserts.Any()) {
foreach (ElementId idinsert in wallInserts) {
Element insert = doc.GetElement(idinsert);
FamilyInstance famIns = insert as FamilyInstance;
XYZ pCutDir = XYZ.Zero;
CurveLoop curveLoop = ExporterIFCUtils.GetInstanceCutoutFromWall(doc,wall,famIns,out pCutDir);
/// ExporterIFCUtils.ComputeAreaOfCurveLoops( loops )
IList<CurveLoop> profileLoops = new List<CurveLoop>();
profileLoops.Add(curveLoop);
if (overallOpeningSolid == null) {
Solid negExt = GeometryCreationUtilities.CreateExtrusionGeometry(profileLoops,-pCutDir,1);
Solid posExtr = GeometryCreationUtilities.CreateExtrusionGeometry(profileLoops,pCutDir,1);
overallOpeningSolid = BooleanOperationsUtils.ExecuteBooleanOperation(negExt,posExtr,BooleanOperationsType.Union);
}
else if (overallOpeningSolid != null) {
Solid negExt = GeometryCreationUtilities.CreateExtrusionGeometry(profileLoops,-pCutDir,1);
Solid posExtr = GeometryCreationUtilities.CreateExtrusionGeometry(profileLoops,pCutDir,1);
Solid openingSolid = BooleanOperationsUtils.ExecuteBooleanOperation(negExt,posExtr,BooleanOperationsType.Union);
overallOpeningSolid = BooleanOperationsUtils.ExecuteBooleanOperation(overallOpeningSolid,openingSolid,BooleanOperationsType.Union);
}
}
}
#endregion
#region 2.3.2). Create solid from bondary wall face
Solid wallFaceExtrus = GeometryCreationUtilities.CreateExtrusionGeometry(planarWallFc.GetEdgesAsCurveLoops(),planarWallFc.FaceNormal,0.1);
//make sure the wallFaceExtruded it's surrounding the room (roomSolid is produced by wall faces, so they have same height, although width is variable that's why we intersect both solids)
TaskDialog.Show("de",wall.Id.ToString());
wallFaceExtrus = BooleanOperationsUtils.ExecuteBooleanOperation(roomSolid2,wallFaceExtrus,BooleanOperationsType.Intersect);
#endregion
areas.Add(wallFace.Area);
}
}
}
}
}
}
#endregion
}
}
}
I'm attaching the revit project:
Help with this one please, thanks you in advance
Miguel G.
Developer Advocacy and Support +