public static List <IfWall> GetWalls(IfStory ifStory) { List <IfWall> wallsList = new List <IfWall>(); var walls = ifStory.IfcStory.ContainsElements .FirstOrDefault() .RelatedElements.OfType <IIfcWall>(); foreach (var wall in walls) { var dir = ((IIfcAxis2Placement3D)((IIfcLocalPlacement)wall.ObjectPlacement).RelativePlacement).RefDirection; var recD = wall.Representation.Representations .SelectMany(a => a.Items) .OfType <IIfcExtrudedAreaSolid>().Select(a => a.SweptArea) .OfType <IIfcRectangleProfileDef>().FirstOrDefault() ?? wall.Representation.Representations .SelectMany(a => a.Items) .OfType <IIfcBooleanClippingResult>().Select(a => a.FirstOperand) .OfType <IIfcExtrudedAreaSolid>().Select(a => a.SweptArea) .OfType <IIfcRectangleProfileDef>().FirstOrDefault() ?? wall.Representation.Representations .SelectMany(a => a.Items) .OfType <IIfcBooleanClippingResult>().Select(a => a.FirstOperand) .OfType <IIfcBooleanClippingResult>().Select(a => a.FirstOperand) .OfType <IIfcExtrudedAreaSolid>().Select(a => a.SweptArea) .OfType <IIfcRectangleProfileDef>().FirstOrDefault() ?? wall.Representation.Representations .SelectMany(a => a.Items) .OfType <IIfcBooleanClippingResult>().Select(a => a.FirstOperand) .OfType <IIfcBooleanClippingResult>().Select(a => a.FirstOperand) .OfType <IIfcBooleanClippingResult>().Select(a => a.FirstOperand) .OfType <IIfcExtrudedAreaSolid>().Select(a => a.SweptArea) .OfType <IIfcRectangleProfileDef>().FirstOrDefault(); //get the wall x,y,z if (recD != null) { IfWall crntWall = new IfWall(ifStory.IfModel, wall) { Story = ifStory, IfModel = ifStory.IfModel }; if (dir != null && dir.X < 0) { crntWall.Direction = Direction.Negative; } else { crntWall.Direction = Direction.Positive; } wallsList.Add(crntWall); } } return(wallsList); }
public static List <IfOpening> GetOpenings(IfWall ifWall) { var openings = new List <IfOpening>(); IfOpening ifopening; foreach (var opening in ifWall.IfcWall.HasOpenings) { ifopening = new IfOpening(ifWall, opening); var opnng = (IIfcAxis2Placement3D)((IIfcLocalPlacement)opening .RelatedOpeningElement.ObjectPlacement).RelativePlacement; var oLocation = opnng.Location;//get opening location point var recProfile = opening.RelatedOpeningElement.Representation.Representations.SelectMany(a => a.Items) .OfType <IIfcExtrudedAreaSolid>().Select(a => a.SweptArea) .OfType <IIfcRectangleProfileDef>().FirstOrDefault(); //get rec profile var recDepth = opening.RelatedOpeningElement.Representation. Representations.SelectMany(a => a.Items). OfType <IIfcExtrudedAreaSolid>().Select(a => a.Depth).FirstOrDefault(); //get filling elment doors or windows var voids = ((IfcOpeningElement)opening.RelatedOpeningElement) .HasFillings.FirstOrDefault(); var voidsPlacement = (IfcLocalPlacement)voids.RelatedBuildingElement.ObjectPlacement; ifopening.LocalPlacement = voidsPlacement; var dir = ((IIfcAxis2Placement3D)voidsPlacement.RelativePlacement).RefDirection; string filling = " "; if (voids != null) { filling = voids.RelatedBuildingElement.GetType().Name; } else { filling = "not Defined"; } ifopening.IfLocation = new IfLocation(Length.FromFeet(oLocation.X).Inches, Length.FromFeet(oLocation.Y).Inches, Length.FromFeet(oLocation.Z).Inches); ifopening.IfDimension = new IfDimension(Length.FromFeet(recProfile.YDim).Inches, Length.FromFeet(recDepth).Inches, Length.FromFeet(recProfile.XDim).Inches); switch (filling) { case "IfcDoor": ifopening.OpeningType = OpeningType.Door; ifopening.IfDimension = new IfDimension(Length.FromFeet(recProfile.XDim).Inches, Length.FromFeet(recDepth).Inches, Length.FromFeet(recProfile.YDim).Inches); break; case "IfcWindow": ifopening.OpeningType = OpeningType.Window; ifopening.IfDimension = new IfDimension(Length.FromFeet(recProfile.YDim).Inches, Length.FromFeet(recDepth).Inches, Length.FromFeet(recProfile.XDim).Inches); break; default: ifopening.OpeningType = OpeningType.Window; break; } if (dir != null && dir.X < 0) { ifopening.Direction = Direction.Negative; //ifopening.Flip(Axis.xAxis); } else { ifopening.Direction = Direction.Positive; } openings.Add(ifopening); } return(openings); }
public IfOpening(IfWall ifWall, IIfcRelVoidsElement ifcOpening) : base(ifWall.IfModel) { IfWall = ifWall; IfcOpening = ifcOpening; }
public IfStud(IfWall wall) : base(wall.IfModel) { IfWall = wall; }