Example #1
0
        /// <summary>
        /// Does this ray intersect with the provided SolidOperation?
        /// </summary>
        /// <param name="solidOp">The SolidOperation to intersect with.</param>
        /// <param name="result">The list of intersection results, ordered by distance from the ray origin.</param>
        /// <returns>True if an intersection occurs, otherwise false. If true, check the intersection result for the location of the intersection.</returns>
        public bool Intersects(SolidOperation solidOp, out List <Vector3> result)
        {
            var intersects = Intersects(solidOp.Solid, out List <Vector3> tempResult);

            result = tempResult;
            return(intersects);
        }
Example #2
0
        /// <summary>
        /// Get DXF entities from a SolidOperation.
        /// </summary>
        /// <param name="solidOp"></param>
        /// <param name="transform"></param>
        /// <returns></returns>
        public static List <DxfEntity> ToDxfEntities(this SolidOperation solidOp, Transform transform)
        {
            var list = new List <DxfEntity>();

            switch (solidOp)
            {
            case Extrude extrude:
            {
                var profile = extrude.Profile.Transformed(transform);
                list.AddRange(profile.ToDxfEntities());
                break;
            }

            case Sweep sweep:
            {
                var profile = sweep.Profile.Transformed(sweep.Curve.TransformAt(sweep.StartSetback));
                list.AddRange(profile.ToDxfEntities());
                break;
            }

            case Lamina lamina:
            {
                var profile = new Profile(lamina.Perimeter.TransformedPolygon(transform), lamina.Voids?.Select(v => v.TransformedPolygon(transform)).ToList() ?? new List <Polygon>());
                list.AddRange(profile.ToDxfEntities());
                break;
            }
            }
            return(list);
        }