- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone,
I am trying to get the thickness of the walls that a Window cuts through. I can get easily the thickness of the wall that the window is hosted, however there is an extra wall (insulation) placed outside of the host wall which I must also know the thickness of. Therefore I thought on using the ElementIntersectSolidFilter with a solid geometry from the window:
Here is my code:
var windowGeometry = window.get_Geometry(new Options() {
DetailLevel = ViewDetailLevel.Fine
});
var w = windowGeometry.First() as GeometryInstance;
var instanceGeometry = w.GetInstanceGeometry(window.GetTotalTransform());
// get solid for intersection
Solid fensterbankSolid = null;
foreach(var geo in instanceGeometry) {
var graphicsId = (geo as GeometryObject).GraphicsStyleId;
var graphicStyle = linkDoc.GetElement(graphicsId).Cast < GraphicsStyle > ();
// The element with the graphicStype should cut through both insulation and wall.
if (graphicStyle?.Name.Contains("Fensterbank Aus") ?? false) {
fensterbankSolid = geo as Solid;
break;
}
}
if (fensterbankSolid != null) {
FilteredElementCollector wallIntersections = new FilteredElementCollector(linkDoc)
.OfClass(typeof (Wall))
.WherePasses(new ElementIntersectsSolidFilter(fensterbankSolid as Solid));
int n = wallIntersections.Count();
if (n > 0) {
// I only care about the intersecting walls that have type name "DAE"
var insulation = wallIntersections.Where(wall => wall.Name.Contains("DAE")).FirstOrDefault();
if (insulation != null) {
Wall insulationWall = insulation as Wall;
Debug.WriteLine($"Window intersects insulation of: {insulationWall.Width.ToMillimeters()}mm");
existingWallThickness += insulationWall.Width;
}
}
}
The results of the IntersectionFilter collector are a two 340 mm wall, and a 90 mm insulation wall. But what is expected is to find one 340 mm and one 60 mm insulation wall.
Is the code above the correct way to get the geometry of the window instance?
Is there an easier way to find the intersecting walls to a Window Instance?
Thank you
Solved! Go to Solution.