示例#1
0
        public void CreateFactoryEntities(PicFactory factory, ParameterStack stack, Transform2D transform)
        {
            PicFactory fTemp = new PicFactory();

            // free variables
            double a = stack.GetDoubleParameterValue("a");
            double b = stack.GetDoubleParameterValue("b");
            double h = stack.GetDoubleParameterValue("h");
            double e = stack.GetDoubleParameterValue("e");
            double g = stack.GetDoubleParameterValue("g");

            int iTop = stack.GetMultiParameterValue("TOP");
            int iBot = stack.GetMultiParameterValue("BOTTOM");

            double gg = 15.0;

            // formulas
            SortedList <uint, PicEntity> entities = new SortedList <uint, PicEntity>();

            if (g < 5)
            { // Glue_flap
                IPlugin        pluginIn = Host.GetPluginByGuid("729625f4-921d-4f72-af43-4248835a59f3");
                ParameterStack stackIn  = Host.GetInitializedParameterStack(pluginIn);
                gg = stackIn.GetDoubleParameterValue("g");
            }
            else
            {
                gg = g;
            }
            //---------- TOP Architecture ---------------------
            if (iTop == 0)
            { // Sleeve
                IPlugin        pluginIn = Host.GetPluginByGuid("da290efa-83a5-4ccd-808c-9a5eec81f36b");
                ParameterStack stackIn  = Host.GetInitializedParameterStack(pluginIn);
                stackIn.SetDoubleParameter("A", a);             // A
                stackIn.SetDoubleParameter("B", b);             // B
                stackIn.SetDoubleParameter("e", e);             // e
                stackIn.SetDoubleParameter("H", h / 2);         // H
                stackIn.SetDoubleParameter("g", gg);            // g
                bool        reflectionX = false, reflectionY = false;
                Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity);
                pluginIn.CreateFactoryEntities(fTemp, stackIn,
                                               Transform2D.Translation(new Vector2D(gg, 0.0))
                                               * Transform2D.Rotation(0.0)
                                               * transfReflect);
            }
            else if (iTop == 1)
            { // Tuck_end
                int iTuck = stack.GetMultiParameterValue("TUCK");

                IPlugin        pluginIn = Host.GetPluginByGuid("818567a3-ce01-45f5-b328-04031713c12c");
                ParameterStack stackIn  = Host.GetInitializedParameterStack(pluginIn);
                stackIn.SetDoubleParameter("a", a);             // A
                stackIn.SetDoubleParameter("b", b);             // B
                stackIn.SetDoubleParameter("h", h / 2);         // H
                stackIn.SetDoubleParameter("e", e);             // t
                stackIn.SetDoubleParameter("g", g);             // g
                if (2 == iTuck)
                {
                    int iHole = stack.GetMultiParameterValue("HOLE");
                    stackIn.SetMultiParameter("HOLE", iHole);           // Hanging Hole
                }
                stackIn.SetDoubleParameter("bp", iTuck);
                bool        reflectionX = false, reflectionY = false;
                Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity);
                pluginIn.CreateFactoryEntities(fTemp, stackIn,
                                               Transform2D.Translation(new Vector2D(0.0, 0.0))
                                               * Transform2D.Rotation(0.0)
                                               * transfReflect);
            }
            else if (iTop == 2)
            { // Inverted_Tuck_end
                int iTuck = stack.GetMultiParameterValue("TUCK");

                IPlugin        pluginIn = Host.GetPluginByGuid("66e5437d-a8a8-404d-951c-e7bf944d2342");
                ParameterStack stackIn  = Host.GetInitializedParameterStack(pluginIn);
                stackIn.SetDoubleParameter("a", a);             // A
                stackIn.SetDoubleParameter("b", b);             // B
                stackIn.SetDoubleParameter("h", h / 2);         // H
                stackIn.SetDoubleParameter("e", e);             // t
                stackIn.SetDoubleParameter("g", g);             // g
                stackIn.SetDoubleParameter("bp", iTuck);
                bool        reflectionX = false, reflectionY = false;
                Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity);
                pluginIn.CreateFactoryEntities(fTemp, stackIn,
                                               Transform2D.Translation(new Vector2D(0.0, 0.0))
                                               * Transform2D.Rotation(0.0)
                                               * transfReflect);
            }
            else if (iTop == 3)
            { // Edge_Lock
                int iEdge = stack.GetMultiParameterValue("Edge");

                IPlugin        pluginIn = Host.GetPluginByGuid("827b4625-ccad-41f8-823a-c165852ca8f4");
                ParameterStack stackIn  = Host.GetInitializedParameterStack(pluginIn);
                stackIn.SetDoubleParameter("A", a);             // A
                stackIn.SetDoubleParameter("B", b);             // B
                stackIn.SetDoubleParameter("h", h / 2);         // h
                stackIn.SetDoubleParameter("e", e);             // e
                stackIn.SetDoubleParameter("g", gg);            // g
                stackIn.SetMultiParameter("Edge", iEdge);       // Edge Lock
                stackIn.SetDoubleParameter("A1", b);            // A1
                bool        reflectionX = false, reflectionY = false;
                Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity);
                pluginIn.CreateFactoryEntities(fTemp, stackIn,
                                               Transform2D.Translation(new Vector2D(gg, 0.0))
                                               * Transform2D.Rotation(0.0)
                                               * transfReflect);
            }
            else if (iTop == 4)
            { // Seal_End
                int iSeal = stack.GetMultiParameterValue("Seal");

                IPlugin        pluginIn = Host.GetPluginByGuid("af7fb901-90de-4034-9a27-c21d51f826d2");
                ParameterStack stackIn  = Host.GetInitializedParameterStack(pluginIn);
                stackIn.SetDoubleParameter("A", a);             // A
                stackIn.SetDoubleParameter("B", b);             // B
                stackIn.SetDoubleParameter("h", h / 2);         // h
                stackIn.SetDoubleParameter("g", gg);            // g
                stackIn.SetMultiParameter("Seal", iSeal);       // Seal End
                stackIn.SetDoubleParameter("e", e);             // e
                bool        reflectionX = false, reflectionY = false;
                Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity);
                pluginIn.CreateFactoryEntities(fTemp, stackIn,
                                               Transform2D.Translation(new Vector2D(gg, 0.0))
                                               * Transform2D.Rotation(0.0)
                                               * transfReflect);
            }


            //---------- BOTTOM Architecture ---------------------
            if (iBot == 0)
            { // Sleeve
                IPlugin        pluginIn = Host.GetPluginByGuid("da290efa-83a5-4ccd-808c-9a5eec81f36b");
                ParameterStack stackIn  = Host.GetInitializedParameterStack(pluginIn);
                stackIn.SetDoubleParameter("A", a);             // A
                stackIn.SetDoubleParameter("B", b);             // B
                stackIn.SetDoubleParameter("e", e);             // e
                stackIn.SetDoubleParameter("H", h / 2);         // H
                stackIn.SetDoubleParameter("g", gg);            // g
                bool        reflectionX = true, reflectionY = false;
                Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity);
                pluginIn.CreateFactoryEntities(fTemp, stackIn,
                                               Transform2D.Translation(new Vector2D(gg, 0.0))
                                               * Transform2D.Rotation(0.0)
                                               * transfReflect);
            }
            else if (iBot == 1)
            { // Tuck_end
                int            iBTuck   = stack.GetMultiParameterValue("BTUCK");
                IPlugin        pluginIn = Host.GetPluginByGuid("818567a3-ce01-45f5-b328-04031713c12c");
                ParameterStack stackIn  = Host.GetInitializedParameterStack(pluginIn);
                stackIn.SetDoubleParameter("a", a);             // A
                stackIn.SetDoubleParameter("b", b);             // B
                stackIn.SetDoubleParameter("h", h / 2);         // H
                stackIn.SetDoubleParameter("e", e);             // t
                stackIn.SetDoubleParameter("g", g);             // g
                stackIn.SetDoubleParameter("bp", 0.0);
                if (iBTuck == 2)
                {
                    stackIn.SetDoubleParameter("bp", 0);
                }
                else
                {
                    stackIn.SetDoubleParameter("bp", iBTuck);
                }
                bool        reflectionX = true, reflectionY = false;
                Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity);
                pluginIn.CreateFactoryEntities(fTemp, stackIn,
                                               Transform2D.Translation(new Vector2D(0.0, 0.0))
                                               * Transform2D.Rotation(0.0)
                                               * transfReflect);
            }
            else if (iBot == 2)
            { // Inverted_Tuck_end
                int iBTuck = stack.GetMultiParameterValue("BTUCK");

                IPlugin        pluginIn = Host.GetPluginByGuid("66e5437d-a8a8-404d-951c-e7bf944d2342");
                ParameterStack stackIn  = Host.GetInitializedParameterStack(pluginIn);
                stackIn.SetDoubleParameter("a", a);             // A
                stackIn.SetDoubleParameter("b", b);             // B
                stackIn.SetDoubleParameter("h", h / 2);         // H
                stackIn.SetDoubleParameter("e", e);             // t
                stackIn.SetDoubleParameter("g", g);             // g
                stackIn.SetDoubleParameter("bp", 0.0);
                if (iBTuck == 2)
                {
                    stackIn.SetDoubleParameter("bp", 0);
                }
                else
                {
                    stackIn.SetDoubleParameter("bp", iBTuck);
                }
                bool        reflectionX = true, reflectionY = false;
                Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity);
                pluginIn.CreateFactoryEntities(fTemp, stackIn,
                                               Transform2D.Translation(new Vector2D(0.0, 0.0))
                                               * Transform2D.Rotation(0.0)
                                               * transfReflect);
            }
            else if (iBot == 3)
            { // Snap_lock_base
                IPlugin        pluginIn = Host.GetPluginByGuid("2c366e1f-35d1-4e72-ba2b-7786e699f94c");
                ParameterStack stackIn  = Host.GetInitializedParameterStack(pluginIn);
                stackIn.SetDoubleParameter("a", a);             // a
                stackIn.SetDoubleParameter("b", b);             // b
                stackIn.SetDoubleParameter("h", h / 2);         // h
                stackIn.SetDoubleParameter("e", e);             // e
                stackIn.SetDoubleParameter("g", g);             // g
                bool        reflectionX = false, reflectionY = false;
                Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity);
                pluginIn.CreateFactoryEntities(fTemp, stackIn,
                                               Transform2D.Translation(new Vector2D(0.0, 0.0))
                                               * Transform2D.Rotation(0.0)
                                               * transfReflect);
            }
            else if (iBot == 4)
            { // Crash_lock_base
                IPlugin        pluginIn = Host.GetPluginByGuid("2015adce-a857-49c8-b051-b6891b90b941");
                ParameterStack stackIn  = Host.GetInitializedParameterStack(pluginIn);
                stackIn.SetDoubleParameter("a", a);             // a
                stackIn.SetDoubleParameter("b", b);             // b
                stackIn.SetDoubleParameter("h", h / 2);         // h
                stackIn.SetDoubleParameter("e", e);             // e
                stackIn.SetDoubleParameter("d", e);             // d
                stackIn.SetDoubleParameter("g", g);             // g
                bool        reflectionX = false, reflectionY = false;
                Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity);
                pluginIn.CreateFactoryEntities(fTemp, stackIn,
                                               Transform2D.Translation(new Vector2D(0.0, -h / 2))
                                               * Transform2D.Rotation(0.0)
                                               * transfReflect);
            }
            else if (iBot == 5)
            { // Edge_Lock
                int iBEdge = stack.GetMultiParameterValue("BEdge");

                IPlugin        pluginIn = Host.GetPluginByGuid("827b4625-ccad-41f8-823a-c165852ca8f4");
                ParameterStack stackIn  = Host.GetInitializedParameterStack(pluginIn);
                stackIn.SetDoubleParameter("A", a);             // A
                stackIn.SetDoubleParameter("B", b);             // B
                stackIn.SetDoubleParameter("h", h / 2);         // h
                stackIn.SetDoubleParameter("e", e);             // e
                stackIn.SetDoubleParameter("g", gg);            // g
                stackIn.SetMultiParameter("Edge", iBEdge);      // Edge Lock
                stackIn.SetDoubleParameter("A1", b);            // A1
                bool        reflectionX = true, reflectionY = false;
                Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity);
                pluginIn.CreateFactoryEntities(fTemp, stackIn,
                                               Transform2D.Translation(new Vector2D(gg, 0.0))
                                               * Transform2D.Rotation(0.0)
                                               * transfReflect);
            }
            else if (iBot == 6)
            { // Seal_End
                int iBSeal = stack.GetMultiParameterValue("BSeal");

                IPlugin        pluginIn = Host.GetPluginByGuid("af7fb901-90de-4034-9a27-c21d51f826d2");
                ParameterStack stackIn  = Host.GetInitializedParameterStack(pluginIn);
                stackIn.SetDoubleParameter("A", a);             // A
                stackIn.SetDoubleParameter("B", b);             // B
                stackIn.SetDoubleParameter("h", h / 2);         // h
                stackIn.SetDoubleParameter("g", gg);            // g
                stackIn.SetMultiParameter("Seal", iBSeal);      // Seal End
                stackIn.SetDoubleParameter("e", e);             // e
                bool        reflectionX = true, reflectionY = false;
                Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity);
                pluginIn.CreateFactoryEntities(fTemp, stackIn,
                                               Transform2D.Translation(new Vector2D(gg, 0.0))
                                               * Transform2D.Rotation(0.0)
                                               * transfReflect);
            }

            factory.AddEntities(fTemp, transform);
        }
示例#2
0
        /// <summary>
        /// Create factory entities
        /// </summary>
        /// <param name="factory"></param>
        /// <param name="stack"></param>
        public void CreateFactoryEntities(PicFactory factory, ParameterStack stack, Transform2D transform)
        {
            // get parameter values
            double ParamX1 = stack.GetDoubleParameterValue("ParamX1");
            double L1      = stack.GetDoubleParameterValue("L1");
            double B1      = stack.GetDoubleParameterValue("B1");
            double L2      = stack.GetDoubleParameterValue("L2");
            double B2      = stack.GetDoubleParameterValue("B2");
            double H1      = stack.GetDoubleParameterValue("H1");
            double RL      = stack.GetDoubleParameterValue("RL");
            double RB      = stack.GetDoubleParameterValue("RB");
            double Xo      = stack.GetDoubleParameterValue("Xo");
            double Yo      = stack.GetDoubleParameterValue("Yo");
            double Diro    = stack.GetDoubleParameterValue("Diro");
            bool   Symy    = stack.GetBoolParameterValue("Symy");

            double m15      = stack.GetDoubleParameterValue("m15");
            double m16      = stack.GetDoubleParameterValue("m16");
            double decalenc = stack.GetDoubleParameterValue("decalenc");
            double encoche  = stack.GetDoubleParameterValue("encoche");

            int PoignsurTete = stack.GetIntParameterValue("PoignsurTete");

            bool caisse_en_2 = stack.GetBoolParameterValue("caisse_en_2");
            int  caisse_en_4 = stack.GetIntParameterValue("caisse_en_4");

            double lgPatte = stack.GetDoubleParameterValue("lgPatte");

            IPlugin DemiPatteCol = stack.GetPluginParameterValue("DemiPatteCol");
            IPlugin Poignee      = stack.GetPluginParameterValue("Poignee");


            double HY = 0.0;

            double ec1 = 0.0, ec2 = 0.0;

            CalEncoche(ref ec1, ref ec2, m15, m16, decalenc, encoche);

            if (caisse_en_2 || caisse_en_4 > 0)
            {
                B1 = B2;
                L2 = 0.0;
                B2 = 0.0;
            }
            if (caisse_en_4 == 1 || caisse_en_4 == 3)
            {
                B1 = 0.0;
                RB = RL;
                L2 = 0.0;
                B2 = 0.0;
            }
            if (caisse_en_4 == 2 || caisse_en_4 == 4)
            {
                L1 = B1;
                RL = RB;
                B1 = 0.0;
                L2 = 0.0;
                B2 = 0.0;
            }

            double PX1 = lgPatte;
            double PX2 = L1;
            double PX3 = B1;
            double PX4 = L2;
            double PX5 = B2;

            double RBY1 = 0.0, RBY2 = 0.0, RBY3 = 0.0, RBY4 = 0.0, RBY5 = 0.0;
            double RHY1 = 0.0, RHY2 = 0.0, RHY3 = 0.0, RHY4 = 0.0, RHY5 = 0.0;
            double patProlong = 0.0;

            if (Symy)
            {
                RBY1 = patProlong;
                RBY2 = RL;
                RBY3 = RB;
                RBY4 = RL;
                RBY5 = RB;
            }
            else
            {
                RHY1 = patProlong;
                RHY2 = RL;
                RHY3 = RB;
                RHY4 = RL;
                RHY5 = RB;
            }
            HY = HY + H1;

            if (caisse_en_2 || caisse_en_4 > 0)
            {
                if (PX5 != 0)
                {
                    PX3 = PX5;
                }
                PX4  = 0;
                PX5  = 0;
                RHY4 = 0;
                RHY5 = 0;
                RBY4 = 0;
                RBY5 = 0;
            }

            double V0 = 0.0;
            double v1 = V0 + lgPatte;
            double v2 = v1 + L1;
            double v3 = v2 + B1;
            double v4 = v3 + L2;
            double V5 = v4 + B2;
            double V6 = H1;
            double w0 = 0.0;
            double w1 = V6 + RL;
            double w2 = V6 + RB;
            double w3 = V6 + RL;
            double w4 = V6 + RB;

            SortedList <uint, PicEntity> entities = new SortedList <uint, PicEntity>();
            PicFactory fTemp = new PicFactory();

            // segments
            double x1 = 0.0, y1 = 0.0, x2 = 0.0, y2 = 0.0;
            uint   index = 0;
            const PicGraphics.LT ltCut  = PicGraphics.LT.LT_CUT;
            const PicGraphics.LT ltFold = PicGraphics.LT.LT_CREASING;

            if (3 == caisse_en_4)
            {
                x1 = v1;
                y1 = V6;
                x2 = v2;
                y2 = y1;
                entities.Add(++index, fTemp.AddSegment(ltFold, 1, 1, x1, y1, x2, y2));

                x1 = v1;
                y1 = w0;
                x2 = x1;
                y2 = w2;
                entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));

                x1 = x2;
                y1 = y2;
                x2 = v2;
                y2 = y1;
                entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));

                x1 = x2;
                y1 = y2;
                x2 = x1;
                y2 = w0;
                entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));
            }
            else
            {
                x1 = v1;
                y1 = w0;
                x2 = x1;
                y2 = V6;
                entities.Add(++index, fTemp.AddSegment(ltFold, 1, 1, x1, y1, x2, y2));

                x1 = v2;
                y1 = w0;
                x2 = x1;
                y2 = V6;

                if (!caisse_en_2 && 0 == caisse_en_4)
                {
                    entities.Add(++index, fTemp.AddSegment(ltFold, 1, 1, x1, y1, x2, y2));

                    x1 = v3;
                    y1 = w0;
                    x2 = x1;
                    y2 = V6;
                    entities.Add(++index, fTemp.AddSegment(ltFold, 1, 1, x1, y1, x2, y2));

                    x1 = v4;
                    y1 = w0;
                    x2 = x1;
                    y2 = V6;
                }
                if (0 == caisse_en_4)
                {
                    entities.Add(++index, fTemp.AddSegment(ltFold, 1, 1, x1, y1, x2, y2));
                    x1 = v1 + ec2;
                    y1 = V6;
                    x2 = v2 - ec2;
                }
                else
                {
                    x1 = v1 + ec2;
                    y1 = V6;
                    if (caisse_en_4 == 4)
                    {
                        x2 = v2 - ec2;
                    }
                    else
                    {
                        x2 = v2;
                    }
                }
                y2 = y1;
                entities.Add(++index, fTemp.AddSegment(ltFold, 1, 1, x1, y1, x2, y2));

                if (caisse_en_4 == 4)
                {
                    x1 = x2;
                    y1 = y2;
                    x2 = x1 + ec1;
                    y2 = y1;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));
                }
                x1 = v2 + ec1;
                y1 = V6;
                if (!caisse_en_2 && caisse_en_4 == 0)
                {
                    x2 = v3 - ec1;
                }
                else
                {
                    x2 = v3;
                }
                y2 = y1;
                if (caisse_en_4 == 0)
                {
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));
                }

                if (!caisse_en_2 && caisse_en_4 == 0)
                {
                    // 9
                    x1 = v3 + ec2;
                    y1 = V6;
                    x2 = v4 - ec2;
                    y2 = y1;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));

                    // 10
                    x1 = v4 + ec1;
                    y1 = V6;
                    x2 = V5;
                    y2 = y1;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));
                }


                // 11
                if (!caisse_en_2 && caisse_en_4 == 0)
                {
                    x1 = V5;
                }
                else
                {
                    if (caisse_en_4 == 0)
                    {
                        x1 = v3;
                    }
                    else
                    {
                        x1 = v2;
                    }
                }
                y1 = w0;
                x2 = x1;
                if (caisse_en_4 == 4)
                {
                    y2 = V6;
                }
                else
                {
                    y2 = w4;
                }
                entities.Add(++index, fTemp.AddSegment(caisse_en_4 == 4 ? ltFold : ltCut, 1, 1, x1, y1, x2, y2));

                if (caisse_en_4 == 4)
                {
                    x1 = x1 - ec1;
                    x2 = x1;
                    y1 = y2;
                    y2 = w4;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));
                }

                if (!caisse_en_2 && caisse_en_4 == 0)
                {
                    // 12
                    x1 = x2;
                    y1 = y2;
                    x2 = v4 + ec1;
                    y2 = y1;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));

                    // 13
                    x1 = x2;
                    y1 = y2;
                    x2 = x1;
                    y2 = V6;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));

                    // 14
                    x1 = x2;
                    y1 = y2;
                    x2 = v4 - ec2;
                    y2 = y1;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));

                    // 15
                    x1 = x2;
                    y1 = y2;
                    x2 = x1;
                    y2 = w3;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));

                    // 16
                    x1 = x2;
                    y1 = y2;
                    x2 = v3 + ec2;
                    y2 = y1;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));

                    // 17
                    x1 = x2;
                    y1 = y2;
                    x2 = x1;
                    y2 = V6;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));

                    // 18
                    x1 = x2;
                    y1 = y2;
                    x2 = v3 - ec1;
                    y2 = y1;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));

                    // 19
                    x1 = x2;
                    y1 = y2;
                    x2 = x1;
                    y2 = w2;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));
                }

                // 20
                x1 = x2;
                y1 = y2;
                y2 = y1;
                if (caisse_en_4 == 0)
                {
                    x2 = v2 + ec1;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));
                    // 21
                    x1 = x2;
                    y1 = y2;
                    x2 = x1;
                    y2 = V6;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));
                    // 22
                    x1 = x2;
                    y1 = y2;
                    x2 = v2 - ec2;
                    y2 = y1;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));
                    // 23
                    x1 = x2;
                    y1 = y2;
                    x2 = x1;
                    y2 = w1;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));
                    // 24
                }
                else
                {
                    if (caisse_en_4 != 4)
                    {
                        x2 = v2;
                    }
                }

                x1 = x2;
                y1 = y2;
                x2 = v1 + ec2;
                y2 = y1;
                entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));

                // 25
                x1 = x2;
                y1 = y2;
                x2 = x1;
                y2 = V6;
                entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));

                // 26
                x1 = x2;
                y1 = y2;
                x2 = v1;
                y2 = y1;
                entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));

                // Patte de Collage
                ParameterStack stackDemiPatteCol = DemiPatteCol.Parameters;
                if (caisse_en_4 != 3)
                {
                    //Call DemiPatteCol(ParamX1, lgPatte, H1, ec1, anglPc, patProlong, 0#, 0#, 0#, False)
                    DemiPatteCol.CreateFactoryEntities(fTemp, stackDemiPatteCol, transform);
                }
                if (caisse_en_4 == 4)
                {
                    // Call DemiPatteCol(ParamX1, lgPatte, H1, ec1, anglPc, patProlong, L1 + 2 * lgPatte, 0#, 180, True)
                    DemiPatteCol.CreateFactoryEntities(fTemp, stackDemiPatteCol, transform);
                }
            }

            if ((!Symy && PoignsurTete > 0) && caisse_en_4 == 0)
            {
                if (L1 < B1)
                {
                    v1 = lgPatte + L1 / 2.0;
                    v2 = lgPatte + L1 + B1 + L2 / 2.0;
                }
                else
                {
                    v1 = lgPatte + L1 + B1 / 2.0;
                    v2 = lgPatte + L1 + B1 + L2 + B2 / 2.0;
                }
                // ParamX1, v1, H1, 0, False
                ParameterStack stackPoignee = Poignee.Parameters;
                stackPoignee.SetDoubleParameter("", v1);
                stackPoignee.SetDoubleParameter("", H1);
                stackPoignee.SetDoubleParameter("", 0);
                stackPoignee.SetBoolParameter("", false);
                Poignee.CreateFactoryEntities(fTemp, stackPoignee, transform);

                //(ParamX1, v2, H1, 0, False)
                if (!caisse_en_2)
                {
                    Poignee.CreateFactoryEntities(fTemp, stackPoignee, transform);
                }
            }

            factory.AddEntities(fTemp, transform);

/*
 *          int hom = 0;
 *          if (Symy)
 *              hom = -1;
 *          else
 *              hom = 1;
 *          //ParamX1.Tranf2d Index(index1), Index(idxcour), Xo, Yo, Diro, hom
 */
        }