예제 #1
0
    void xSignalReport()
    {
        IPCB_ServerInterface PCBServer = PCB.GlobalVars.PCBServer;
        IPCB_Board           Board;

        IPCB_PinPairsManager PinPairsManager;
        IPCB_PinPair         PinPair;
        ArrayList            Report = new ArrayList();
        IClient Client = DXP.GlobalVars.Client;

        if (PCBServer == null)
        {
            return;
        }
        //Get current board.
        Board = PCBServer.GetCurrentPCBBoard();
        if (Board == null)
        {
            return;
        }

        //Get board pinpair manager used for xSignals.
        PinPairsManager = Board.GetState_PinPairsManager();
        if (PinPairsManager == null)
        {
            return;
        }
        List <IPCB_PinPair> test = new List <IPCB_PinPair>();

        PinPair = PinPairsManager.CreateFromPinsDescriptors("U66|U7");
        //PinPair.GetState_Length() if = -1 then broken.

        //PinPair.SetState_Name("Test2");
        test.Add(PinPair);
        //PinPairsManager.AssignPinPairClass(PinPair, "Temp");
        PinPairsManager.InvalidateAll();

        //Iterator = Board.BoardIterator_Create();
        //try
        //{
        //    //Filter for class objects
        //    Iterator.AddFilter_ObjectSet(Util.MKset(PCB.TObjectId.eClassObject));
        //    Iterator.AddFilter_LayerSet(PCBConstant.V6AllLayersSet);

        //    ObjectClass = (IPCB_ObjectClass2)Iterator.FirstPCBObject();
        //    while (ObjectClass != null)
        //    {
        //        if (ObjectClass.GetState_MemberKind() == TClassMemberKind.eClassMemberKind_Signal)
        //        {
        //            Report.Add("xSignal Class : " + ObjectClass.GetState_DisplayName());

        //            //Loop through all xSignals of the board.
        //            for (int I = 0; I <= PinPairsManager.GetState_PinPairsCount() - 1; I++)
        //            {
        //                PinPair = PinPairsManager.GetState_PinPairs(I);

        //                if (ObjectClass.IsMember(PinPair.GetState_Name()))
        //                {
        //                    Report.Add(String.Format("    xSignal : {0}, Node Count : {1}, Signal Length : {2}mils, Routed Length : {3}mils, Unrouted Length : {4}mils, Primitive Count : {5}",
        //                                PinPair.GetState_Name(),
        //                                PinPair.GetState_NodeCount(),
        //                                EDP.Utils.CoordToMils((int)PinPair.GetState_Length()),
        //                                EDP.Utils.CoordToMils((int)PinPair.GetState_RoutedLength()),
        //                                EDP.Utils.CoordToMils((int)PinPair.GetState_UnroutedLength()),
        //                                PinPair.GetState_PrimitivesCount()));

        //                    //Loop through all the pins of the xSignal.
        //                    for (int j = 0; j <= PinPair.GetState_PrimitivesCount() - 1; j++)
        //                    {
        //                        Prim = PinPair.GetPrimitives(j);
        //                        if (Prim.GetState_DescriptorString().StartsWith("Pad")) //need refdes, pin number, net name
        //                        {
        //                            Pad = (IPCB_Pad)Prim; //Pad.GetState_PinDescriptorString() = "U6-C17"
        //                            Report.Add("        Pin: " + Pad.GetState_PinDescriptorString() + ", Net: " + Prim.GetState_Net().GetState_Name());
        //                        }
        //                    }
        //                }
        //            }
        //        }

        //        ObjectClass = (IPCB_ObjectClass2)Iterator.NextPCBObject();
        //    }

        //    //Write report file.
        //    File.WriteAllLines(Util.ProjPath() + "\\xSignals.txt", (string[])Report.ToArray(typeof(string)));
        //    //Open file.
        //    Client.ShowDocument(Client.OpenDocument("Text", Util.ProjPath() + "\\xSignals.txt"));
        //}
        ////Error catch if the file is open.
        //catch (IOException)
        //{
        //    Utils.ShowMessage("File in use. Please close the file and try again.");
        //}
        //catch (Exception ex)
        //{
        //    ErrorMail.LogError("Error in " + System.Reflection.MethodBase.GetCurrentMethod().Name + ".", ex);
        //}
        //finally
        //{
        //    Board.BoardIterator_Destroy(ref Iterator);
        //}
    }
예제 #2
0
    public void Command_GetxSignalInfo()//Const View : IServerDocumentView; Var Parameters : WideString)
    {
        IPCB_ServerInterface PCBServer = PCB.GlobalVars.PCBServer;
        IPCB_Board           Board;
        IPCB_BoardIterator   Iterator;
        IPCB_ObjectClass2    ObjectClass;
        IPCB_PinPairsManager PinPairsManager;
        IPCB_PinPair         PinPair;
        //int I;
        ArrayList      Report = new ArrayList();
        IClient        Client = DXP.GlobalVars.Client;
        IPCB_Primitive Prim;
        IPCB_Pad       Pad;

        if (PCBServer == null)
        {
            return;
        }

        Board = PCBServer.GetCurrentPCBBoard();
        if (Board == null)
        {
            return;
        }

        PinPairsManager = Board.GetState_PinPairsManager();
        if (PinPairsManager == null)
        {
            return;
        }

        PinPairsManager.InvalidateAll();

        Iterator = Board.BoardIterator_Create();
        try
        {
            Iterator.AddFilter_ObjectSet(Util.MKset(PCB.TObjectId.eClassObject));
            Iterator.AddFilter_LayerSet(PCBConstant.V6AllLayersSet);

            ObjectClass = (IPCB_ObjectClass2)Iterator.FirstPCBObject();
            while (ObjectClass != null)
            {
                if (ObjectClass.GetState_MemberKind() == TClassMemberKind.eClassMemberKind_Signal)
                {
                    Report.Add("xSignal Class : " + ObjectClass.GetState_DisplayName());

                    for (int I = 0; I <= PinPairsManager.GetState_PinPairsCount() - 1; I++)
                    {
                        PinPair = PinPairsManager.GetState_PinPairs(I);

                        if (ObjectClass.IsMember(PinPair.GetState_Name()))
                        {
                            //need primitive info
                            //refdes and pin number

                            Report.Add(String.Format("    xSignal : {0}, Node Count : {1}, Signal Length : {2}mils, Routed Length : {3}mils, Unrouted Length : {4}mils, Primitive Count : {5}",

                                                     PinPair.GetState_Name(),
                                                     PinPair.GetState_NodeCount(),
                                                     EDP.Utils.CoordToMils((int)PinPair.GetState_Length()),
                                                     EDP.Utils.CoordToMils((int)PinPair.GetState_RoutedLength()),
                                                     EDP.Utils.CoordToMils((int)PinPair.GetState_UnroutedLength()),
                                                     PinPair.GetState_PrimitivesCount()));

                            for (int j = 0; j <= PinPair.GetState_PrimitivesCount() - 1; j++)
                            {
                                Prim = PinPair.GetPrimitives(j);
                                if (Prim.GetState_DescriptorString().StartsWith("Pad")) //need refdes, pin number, net name
                                {
                                    Pad = (IPCB_Pad)Prim;                               //Pad.GetState_PinDescriptorString() = "U6-C17"
                                    Report.Add("        Pin: " + Pad.GetState_PinDescriptorString() + ", Net: " + Prim.GetState_Net().GetState_Name());
                                    //Report.Add("        Primative Desc: " + Prim.GetState_DescriptorString() + ", Net : " + Prim.GetState_Net().GetState_Name());
                                }
                            }
                        }
                    }
                }

                ObjectClass = (IPCB_ObjectClass2)Iterator.NextPCBObject();
            }

            File.WriteAllLines("C:\\xSignals.txt", (string[])Report.ToArray(typeof(string)));

            //Client.OpenDocument("Text", "C:\\xSignals.txt");
        }
        finally
        {
            Board.BoardIterator_Destroy(ref Iterator);
            //FreeAndnull(Report);
        }
    }