コード例 #1
0
        /*
         * mi serve
         * 1- metodo che mi restituisca i profili calcolati
         *
         *
         *
         */

        //private static List<Profile2D> CalculateInternOffset(Profile2D origin, double offsetValue, double diameterValue)
        //{
        //    offsetValue = -Math.Abs(offsetValue);

        //    var firstPaths = origin.Offset(-diameterValue, false);

        //    if (firstPaths == null)
        //        return null;

        //    var rslt = new List<Profile2D>();

        //    foreach (var firstPath in firstPaths)
        //    {
        //        rslt.Add(firstPath);

        //        RicorsivaGenerateInternOffset(firstPath, offsetValue, false, ref rslt);
        //    }


        //    return rslt;
        //}

        //private static void RicorsivaGenerateInternOffset(Profile2D profile2D, double offset, bool clockwise, ref List<Profile2D> profile2DsList)
        //{
        //    // Calcola offset , ritorna 1 o più contorni
        //    var offsetRslt = profile2D.Offset(offset, clockwise);


        //    // se non ritorna più niente termina metodo
        //    if (offsetRslt == null)
        //        return;

        //    foreach (var singleContour in offsetRslt)
        //    {
        //        profile2DsList.Add(singleContour);
        //        RicorsivaGenerateInternOffset(singleContour, offset, clockwise, ref profile2DsList);
        //    }
        //}



        private static void FresaturaSmussaturaScanalaturaChiusaProgram(MoveActionCollection moveActionCollection, Profile2D profile2D, double profonditaSmusso, double zSicurezza, double zIniziale, double diaFresa, double larghezzaScanaltura)
        {
            /*
             * teoria.
             * - Prendo profilo
             *  - Se valido faccio offset negativo del raggio della fresa
             * - Poi faccio offset della larghezza di passata fino a che il metodo non mi restituisce più niente. ( ho raggiunto il massimo )
             */

            /*
             * Controllo Valori
             */
            if (CheckValueHelper.GreatherThanZero(new[] { profonditaSmusso, diaFresa, larghezzaScanaltura }) ||
                CheckValueHelper.GreatherThan(new[]
            {
                new KeyValuePair <double, double>(zSicurezza, zIniziale),
            })
                )
            {
                return;
            }

            if (profile2D == null)
            {
                return;
            }

            /*
             * chiamo metodo comune per 2 profili (maggiore e minore della fresatura di scanalatura)
             */
            var offsetValue = larghezzaScanaltura / 2;

            var profileExt = profile2D.Offset(offsetValue, true);
            var profileInt = profile2D.Offset(-offsetValue, true);

            if ((profileExt == null || profileExt.Count == 0) ||
                (profileInt == null || profileInt.Count == 0))
            {
                return;
            }

            MillProgrammingHelper.GetExterChamfer(moveActionCollection, profileInt[0], null, false, profonditaSmusso, diaFresa, 0, false, zIniziale, zSicurezza);

            MillProgrammingHelper.GetInternChamfer(moveActionCollection, profileExt[0], profonditaSmusso, diaFresa, 0, false, zIniziale, zSicurezza);
        }