Esempio n. 1
0
        public void RunCase(CaseArgs selectedCase)
        {
            Welds.Clear();
            Shell = selectedCase.Shell;
            Neck  = selectedCase.Neck;

            if (!SetIntersectionCurves(selectedCase))
            {
                return;
            }

            DefinePadFlushPlane(_intersectOrigin, new Region(_innerIntersectionCurve).ConvertToSurface(), out var norm);

            var center = FindCenter(selectedCase.CutRegion.ContourList.ToArray());

            var trimBrep = OffsetRevolvedShell(_intersectedSurfaces, selectedCase.FilletLength,
                                               _flipNorm, true, _relOrigin);

            if (!DifferenceShells(trimBrep, ref Neck))
            {
                return;
            }

            BuildSetInNozzleWeld(selectedCase, trimBrep, center);
            Shell.ExtrudeRemove(selectedCase.CutRegion, selectedCase.ExtrudeLength);
        }
Esempio n. 2
0
        private bool SetIntersectionCurves(CaseArgs args)
        {
            if (!GetIntersectionCurves(args.Shell, args.Neck, out var tmpCurves))
            {
                return(false);
            }

            tmpCurves = UtilityEx.GetConnectedCurves(tmpCurves, 0.0001).ToList();
            var ordered = tmpCurves.OrderByDescending(c => c.StartPoint.X);

            _intersectionCurves.Add(ordered.Last());
            if (tmpCurves.Count > 1)
            {
                _intersectionCurves.Add(ordered.First());
            }
            _intersectOrigin = FindCenter(_innerIntersectionCurve.GetIndividualCurves());
            _relOrigin       = new Point3D(0, 0, _intersectOrigin.Z);

            return(true);
        }
Esempio n. 3
0
        /*
         *
         * Various Helper methods
         *
         */
        private bool BuildSetInNozzleWeld(CaseArgs args, Brep offsetBrep, Point3D center)
        {
            /*
             * INTERNAL FILLET
             *
             *  The curve 'rail' is solved for by extruding the shell cut region, and intersecting it with
             *    the offset internal surface of the shell.
             *
             *  The point 'topCorner' is determined by taking the point along the XZ Plane with the largest Z value
             *    off of the rail curve, internalTopPoint and bottomPoint are solved for using the Normal and planar axis.
             *
             *
             *    |                                                         |
             *    |                                                         |
             *    ----------------- SHELL -----------------------------------
             *       bottomPoint ----- topCorner
             *            -               |       |----------------------------------
             *                -           |       |  NECK
             *                    -       |       |
             *                   internalTopPoint |
             *                                    |
             *                                    |----------------------------------
             *
             */

            var topCornerNeck = args.CutRegion.ExtrudeAsBrep(args.ExtrudeLength);


            Brep.IntersectionLoops(topCornerNeck, offsetBrep, out var topCornerCurves);

            if (!topCornerCurves.Any())
            {
                return(false);
            }

            var topCornerCurve = topCornerCurves.OrderByDescending(c => c.EndPoint.Z).First();


            var approximatePoint = new Point3D(args.ReferencePoint.X + args.FilletLength, args.ReferencePoint.Y,
                                               args.ReferencePoint.Z + args.NeckRadius + args.NeckThickness);

            topCornerCurve.ClosestPointTo(approximatePoint, out var t);
            var topCorner = topCornerCurve.PointAt(t);

            var internalTopPoint = topCorner + -args.FilletLength * args.ExtrudePlane.AxisY;
            var bottomPoint      = topCorner + -args.FilletLength * args.Normal;

            var weldFaceCurves = new List <ICurve>
            {
                new Line(topCorner, internalTopPoint),
                new Line(internalTopPoint, bottomPoint),
                new Line(bottomPoint, topCorner)
            };
            var weldFace = new Region(new CompositeCurve(weldFaceCurves, 0.0001, true));

            switch (args.DisplayCase)
            {
            case Case.RegionAndRail:
                Welds.Add(weldFace.ConvertToSurface().ConvertToBrep(0.0001));
                Welds.Add(new Region(topCornerCurve).ConvertToSurface().ConvertToBrep(0.0001));
                break;

            case Case.Rotational:
                Welds.Add(weldFace.RevolveAsBrep(0.0, 2 * Math.PI, args.Normal, center, 0.0001));
                break;

            case Case.Sweep:
                Welds.Add(weldFace.SweepAsBrep(topCornerCurve, 0.0001, sweepMethodType.FrenetSerret));
                break;

            default:
                throw new ArgumentException("Unknown display case.");
            }

            return(true);
        }
Esempio n. 4
0
 public Nozzle(CaseArgs args)
 {
     RunCase(args);
 }