private void CreateCorridorWalls(XPreviewBuildingStory story) { XbimPoint3D p1 = new XbimPoint3D(0, parameters.CorridorWidth, 0); XbimPoint3D p2 = new XbimPoint3D(parameters.ReferenceLine.Length, parameters.CorridorWidth, 0); XPolygon wallProfile = CreateWallProfile(p1.Distance(p2)); XPreviewWall wall = new XPreviewWall { Name = "Wall ", Location = new XbimPoint3D(0, -parameters.CorridorWidth / 2, 0), ProfilePath = wallProfile.Clone(), Thickness = parameters.InteriorWallThickness, Height = parameters.CeilingElevation, Container = story }; wall = new XPreviewWall { Name = "Wall ", Location = new XbimPoint3D(0, parameters.CorridorWidth / 2, 0), ProfilePath = wallProfile.Clone(), Thickness = parameters.InteriorWallThickness, Height = parameters.CeilingElevation, Container = story }; }
/// <summary> /// Creates the partition walls between the units. Not surprisingly uses similar logic to /// creating units /// </summary> /// <param name="story"></param> private void CreatePartitionWalls(XPreviewBuildingStory story) { UnitParameters firstUnit = unitsToCreate.First(); XLine refLine = parameters.ReferenceLine.Transformed(building.InverseGlobalTransform); XbimVector3D cross = refLine.NormalizedVector.CrossProduct(new XbimVector3D(0, 0, 1)); // The reference point on the center line from which the insertion points will be calculated XbimPoint3D referencePoint = new XbimPoint3D(refLine.sp.X + (firstUnit.UnitWidth - parameters.InteriorWallThickness / 2), refLine.sp.Y, refLine.sp.Z); int unitCount = 0; int wallcount = 0; foreach (UnitParameters unit in unitsToCreate) { if (unitCount != unitsToCreate.Count - 1) { // the length of the wall is going to be the minimum of the dwpth of the two units the wall is between double length = Math.Min(unit.UnitDepth, unitsToCreate[unitCount + 1].UnitDepth); if (parameters.CorridorMode != CorridorMode.Left) { // Right of the corridor XbimPoint3D location = cross.GetPoint(referencePoint, parameters.CorridorWidth / 2 + parameters.InteriorWallThickness / 2); XPreviewWall wall = new XPreviewWall { Name = "Wall " + (story.StoryNumber * 100 + wallcount).ToString(), Location = location, Container = story, ProfilePath = CreateWallProfile(length), Height = parameters.CeilingElevation, ReferenceDirection = new XbimVector3D(0, -1, 0) }; wallcount++; } if (parameters.CorridorMode != CorridorMode.Right) { // Left of the corridor XbimPoint3D location = cross.GetPoint(referencePoint, -parameters.CorridorWidth / 2 - parameters.InteriorWallThickness / 2); XPreviewWall wall = new XPreviewWall { Name = "Wall " + (story.StoryNumber * 100 + wallcount).ToString(), Location = location, Container = story, ProfilePath = CreateWallProfile(length), Height = parameters.CeilingElevation, ReferenceDirection = new XbimVector3D(0, 1, 0), }; wallcount++; } // Increment the location. Must use next unit width too as units may be different sizes if (unitCount != unitsToCreate.Count - 1) { UnitParameters nextUnit = unitsToCreate[unitCount + 1]; XbimPoint3D delta = new XbimPoint3D(nextUnit.UnitWidth, 0, 0); referencePoint = XbimPoint3D.Add(referencePoint, delta); } } unitCount++; } }