Example #1
0
        /// <summary>
        /// Create a Wall from a Profile and thickness.  If centerline is not included it will be
        /// computed from the Profile.  The Profile will be projected to the
        /// centerline Plane, and used to find Openings of the Wall.
        /// </summary>
        public WallByProfile(Profile @profile,
                             double @thickness,
                             Line @centerline               = null,
                             Transform @transform           = null,
                             Material @material             = null,
                             Representation @representation = null,
                             bool @isElementDefinition      = false)
            : base(transform != null ? transform : new Transform(),
                   material != null ? material : BuiltInMaterials.Concrete,
                   representation != null ? representation : new Representation(new List <SolidOperation>()),
                   isElementDefinition,
                   Guid.NewGuid(),
                   "Wall by Profile")
        {
            var point = profile.Perimeter.Vertices.First();

            this.Centerline = @centerline;
            this.Thickness  = @thickness;
            this.Perimeter  = profile.Perimeter.Project(GetCenterPlane());

            foreach (var aVoid in profile.Voids)
            {
                AddOpening(aVoid, thickness, thickness);
            }

            // TODO remove when we remove Profile.
            var perpendicularToWall = Centerline.Direction().Cross(Vector3.ZAxis);

#pragma warning disable 612, 618
            this.Profile = GetProfile().Transformed(new Transform(perpendicularToWall * this.Thickness / 2));
#pragma warning restore 612, 618
        }
Example #2
0
        /// <summary>
        /// Construct a wall along a line.
        /// </summary>
        /// <param name="centerLine">The center line of the wall.</param>
        /// <param name="wallType">The wall type of the wall.</param>
        /// <param name="height">The height of the wall.</param>
        /// <param name="openings">A collection of Openings in the wall.</param>
        /// <param name="transform">The transform of the wall.
        /// This transform will be concatenated to the transform created to describe the wall in 2D.</param>
        /// <param name="material">The wall's material.</param>
        /// <exception cref="System.ArgumentOutOfRangeException">Thrown when the height of the wall is less than or equal to zero.</exception>
        /// <exception cref="System.ArgumentOutOfRangeException">Thrown when the Z components of wall's start and end points are not the same.</exception>
        public Wall(Line centerLine, WallType wallType, double height, Material material = null, Opening[] openings = null, Transform transform = null)
        {
            if (height <= 0.0)
            {
                throw new ArgumentOutOfRangeException($"The wall could not be created. The height of the wall provided, {height}, must be greater than 0.0.");
            }

            if (centerLine.Start.Z != centerLine.End.Z)
            {
                throw new ArgumentException("The wall could not be created. The Z component of the start and end points of the wall's center line must be the same.");
            }

            this.CenterLine  = centerLine;
            this.Height      = height;
            this.ElementType = wallType;
            this.Openings    = openings;

            // Construct a transform whose X axis is the centerline of the wall.
            // The wall is described as if it's lying flat in the XY plane of that Transform.
            var d             = centerLine.Direction();
            var z             = d.Cross(Vector3.ZAxis);
            var wallTransform = new Transform(centerLine.Start, d, z);

            this.Transform = wallTransform;
            if (transform != null)
            {
                wallTransform.Concatenate(transform);
            }

            if (openings != null && openings.Length > 0)
            {
                var voids = new Polygon[openings.Length];
                for (var i = 0; i < voids.Length; i++)
                {
                    var o = openings[i];
                    voids[i] = o.Perimeter;
                }
                this.Profile = new Profile(Polygon.Rectangle(Vector3.Origin, new Vector3(centerLine.Length(), height)), voids);
            }
            else
            {
                this.Profile = new Profile(Polygon.Rectangle(Vector3.Origin, new Vector3(centerLine.Length(), height)));
            }

            this.Geometry = new [] { Solid.SweepFace(this.Profile.Perimeter,
                                                     this.Profile.Voids, this.Thickness(), this.ElementType.MaterialLayers[0].Material, true) };
        }
Example #3
0
        /// <summary>
        /// Construct a wall along a line.
        /// </summary>
        /// <param name="centerLine">The center line of the wall.</param>
        /// <param name="elementType">The wall type of the wall.</param>
        /// <param name="height">The height of the wall.</param>
        /// <param name="openings">A collection of Openings in the wall.</param>
        /// <param name="transform">The transform of the wall.
        /// This transform will be concatenated to the transform created to describe the wall in 2D.</param>
        /// <exception cref="System.ArgumentOutOfRangeException">Thrown when the height of the wall is less than or equal to zero.</exception>
        /// <exception cref="System.ArgumentOutOfRangeException">Thrown when the Z components of wall's start and end points are not the same.</exception>
        public StandardWall(Line centerLine, WallType elementType, double height, List <Opening> openings = null, Transform transform = null)
        {
            if (height <= 0.0)
            {
                throw new ArgumentOutOfRangeException($"The wall could not be created. The height of the wall provided, {height}, must be greater than 0.0.");
            }

            if (centerLine.Start.Z != centerLine.End.Z)
            {
                throw new ArgumentException("The wall could not be created. The Z component of the start and end points of the wall's center line must be the same.");
            }

            this.CenterLine  = centerLine;
            this.Height      = height;
            this.ElementType = elementType;
            if (openings != null)
            {
                this._openings = openings;
            }

            // Construct a transform whose X axis is the centerline of the wall.
            // The wall is described as if it's lying flat in the XY plane of that Transform.
            var d             = centerLine.Direction();
            var z             = d.Cross(Vector3.ZAxis);
            var wallTransform = new Transform(centerLine.Start, d, z);

            this.Transform = wallTransform;
            if (transform != null)
            {
                wallTransform.Concatenate(transform);
            }

            this.Profile          = new Profile(Polygon.Rectangle(Vector3.Origin, new Vector3(centerLine.Length(), height)));
            this.ExtrudeDepth     = this.Thickness();
            this.ExtrudeDirection = Vector3.ZAxis;
        }