Exemplo n.º 1
0
        static void Main(string[] args)
        {
            IApplication PulseID = new Pulse.Application();

            IEmbDesign Design           = PulseID.OpenDesign("C:\\Temp\\Emoji.PXF", FileTypes.ftAuto, OpenTypes.otOutlines, "Tajima");
            IElements  TemplateElements = Design.Elements;

            foreach (IElement Element in TemplateElements)
            {
                //Go through each element in a template

                Console.WriteLine("Element Name: {0:G}", Element.Name);
                for (int i = 0; i < Element.NumText; i++)
                {
                    // Go through each text element and print the default text

                    Console.WriteLine("Default Text: {0:G}", Element.Texts.GetValue(i));
                    Console.WriteLine();
                }
            }
            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            IApplication PulseID = new Pulse.Application();

            try
            {
                IEmbDesign myDesign = PulseID.OpenDesign("C:\\Temp\\Eagle2.pxf", FileTypes.ftAuto, OpenTypes.otDefault, "Tajima");
                try
                {
                    IBitmapImage myImage = PulseID.NewImage(300, 300);
                    try
                    {
                        myDesign.Render(myImage, 0, 0, 300, 300);
                        myImage.Save("C:\\Temp\\myImage.png", ImageTypes.itAuto);

                        PrintThreadChartNames(PulseID.ThreadCharts);

                        INeedleSequence designNeedleSequence = myDesign.NeedleSequence;
                        try
                        {
                            IThreadPalette designThreadPalette = myDesign.ThreadPalette;
                            // Get the thread palette information for the design.
                            try
                            {
                                // find the needle that is used for each color in the design.  Needle sequence is zero based 0=needle 1
                                for (int i = 0; i < designNeedleSequence.Count; i++)
                                {
                                    int             needle     = designNeedleSequence[i];
                                    IThreadProperty threadInfo = designThreadPalette[needle];

                                    Console.WriteLine("Manufacturer= {0} Name= {1} Code= {2} R= {3} G= {4} B= {5}", threadInfo.Manufacturer, threadInfo.Name, threadInfo.Code, threadInfo.Red, threadInfo.Green, threadInfo.Blue);
                                }
                                UpdateThreadColor(PulseID.ThreadCharts, myDesign, 0, "Madeira Classic Rayon 40", "1002");
                                UpdateThreadColor(PulseID.ThreadCharts, myDesign, 1, "Madeira Classic Rayon 40", "1000");


                                Console.WriteLine();
                                Console.WriteLine("New Thread Sequence");
                                Console.WriteLine("------------------------------" +
                                                  "");

                                // Get the thread palette information for the design.

                                // find the needle that is used for each color in the design.  Needle sequence is zero based 0=needle 1
                                for (int i = 0; i < designNeedleSequence.Count; i++)
                                {
                                    int             needle     = designNeedleSequence[i];
                                    IThreadProperty threadInfo = designThreadPalette[needle];

                                    Console.WriteLine("Manufacturer= {0} Name= {1} Code= {2} R= {3} G= {4} B= {5}", threadInfo.Manufacturer, threadInfo.Name, threadInfo.Code, threadInfo.Red, threadInfo.Green, threadInfo.Blue);
                                }

                                Console.WriteLine("Done");

                                ;

                                Console.ReadLine();

                                myDesign.Render(myImage, 0, 0, 300, 300);
                                myImage.Save("C:\\Temp\\myNewImage.png", ImageTypes.itAuto);
                                myDesign.Save("C:\\Temp\\NewDesign.pxf", FileTypes.ftAuto);
                            }
                            finally
                            {
                                Marshal.ReleaseComObject(designThreadPalette);
                            }
                        }
                        finally
                        {
                            Marshal.ReleaseComObject(designNeedleSequence);
                        }
                    }
                    finally
                    {
                        Marshal.ReleaseComObject(myImage);
                    }
                }
                finally
                {
                    Marshal.ReleaseComObject(myDesign);
                }
            }
            finally
            {
                Marshal.ReleaseComObject(PulseID);
            }
        }