示例#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);
        }