Example #1
0
    /// <summary>
    /// Creates T6 layerset
    /// </summary>
    /// <param name="LayerArgs">Provide an array of T6 Layers</param>
    /// <returns>T6_LayerSet</returns>
    public static TV6_LayerSet MKset(params TV6_Layer[] LayerArgs)
    {
        TV6_LayerSet ReturnSet = new TV6_LayerSet();

        foreach (TV6_Layer tmpLayer in LayerArgs)
        {
            ReturnSet.Add(tmpLayer);
        }
        return(ReturnSet);
    }
Example #2
0
    private void AddCourtyard()
    {
        IPCB_ServerInterface PcbServer = PCB.GlobalVars.PCBServer;

        if (PcbServer == null)
        {
            return;
        }

        IPCB_Library PcbLib = PcbServer.GetCurrentPCBLibrary();

        if (PcbLib == null)
        {
            return;
        }

        IPCB_LibraryIterator LibIteartor = PcbLib.LibraryIterator_Create();

        LibIteartor.AddFilter_ObjectSet(new PCB.TObjectSet(PCB.TObjectId.eComponentObject));
        IPCB_Component PcbCmp = LibIteartor.FirstPCBObject() as IPCB_Component;

        while (PcbCmp != null)
        {
            IPCB_Board currentBoard = PcbServer.GetCurrentPCBBoard();

            IPCB_GroupIterator PcbObjItera = PcbCmp.GroupIterator_Create();
            TV6_LayerSet       layers      = new TV6_LayerSet(TV6_Layer.eV6_BottomLayer, TV6_Layer.eV6_BottomOverlay, TV6_Layer.eV6_Mechanical13,
                                                              TV6_Layer.eV6_TopLayer, TV6_Layer.eV6_TopOverlay);
            PcbObjItera.AddFilter_LayerSet(layers);

            IPCB_Primitive PcbObj = PcbObjItera.FirstPCBObject();

            List <PrimitiveArea> Areas = new List <PrimitiveArea>();
            while (PcbObj != null)
            {
                PrimitiveArea ObjArea = new PrimitiveArea();

                switch (PcbObj.GetState_ObjectID())
                {
                case PCB.TObjectId.ePadObject:
                    ObjArea = CalPadArea(PcbObj as IPCB_Pad);
                    Areas.Add(ObjArea);
                    break;

                case PCB.TObjectId.eTrackObject:
                    ObjArea = CalTrackArea(PcbObj as IPCB_Track);
                    Areas.Add(ObjArea);
                    break;

                case PCB.TObjectId.eArcObject:
                    break;
                }

                PcbObj = PcbObjItera.NextPCBObject();
            }

            PrimitiveArea ComponentArea = CalComponentArea(Areas);
            DrawAreaAsCourtyard(ComponentArea, PcbServer, currentBoard);

            PcbCmp.GroupIterator_Destroy(ref PcbObjItera);

            PcbCmp = LibIteartor.NextPCBObject() as IPCB_Component;
        }

        PcbLib.LibraryIterator_Destroy(ref LibIteartor);
    }