private static void AddNetInfos(IStep step, IODBLayer parentLayer, String NetName, IODBObject netItem)
        {
            if (NetName.Length == 0) //the default net
            {
                NetName = "$NONE$";
            }

            int  lastNetNr = step.GetNets().Count;
            INet outNet    = step.GetNet(NetName);
            int  netNr     = -1;

            if (outNet == null)
            {
                netNr = step.AddNet(NetName, "", out outNet);
            }
            else
            {
                netNr = outNet.GetNetNumber();
            }

            netItem.PcbNetNumber = outNet.GetNetNumber();                          //set the netinformation to the object
            int newNr = outNet.AddLayerRef(parentLayer.GetLayerName(), lastNetNr); //each net saves a list of all layers are used.

            if (newNr == lastNetNr)
            {
                lastNetNr++;
            }
            parentLayer.SetNetNumber(NetName, netItem.PcbNetNumber);                                       //for each object the layer needs information that this net is used.
            outNet.AddFID(PCBI.FidType.Copper, parentLayer.GetLayerName(), netItem.GetIndexOnLayer(), ""); //this is specific to ODB++, if you don't use it and save the data as ODB++ some information get lost.
        }
Exemplo n.º 2
0
        private static void MakeDrillCutOutOnCopperLayers(IPCBIWindow Parent, IMatrix matrix, IStep step)
        {
            IFilter filter            = new IFilter(Parent);
            int     counterDielectirc = 1;

            foreach (string layerName in matrix.GetAllDrillLayerNames())
            {
                ILayer drill_layer = step.GetLayer(layerName);

                bool lastWasSignal = false;
                foreach (string sigLayer in matrix.GetAllLayerWithThisDrills(layerName))
                {
                    var type = matrix.GetMatrixLayerType(sigLayer);
                    if (type != MatrixLayerType.Dielectric && !matrix.IsSignalLayer(sigLayer)) //only dielectric und signals
                    {
                        continue;
                    }
                    if ((type == MatrixLayerType.Power_ground || type == MatrixLayerType.Signal))
                    {
                        if (lastWasSignal)
                        {
                            //if last and current one are signals -> we need a dielectric between both
                            IODBLayer dielectric = filter.CreateEmptyODBLayer("dielectric_" + counterDielectirc, step.Name);
                            counterDielectirc++;
                            if (dielectric != null)
                            {
                                AddDrillObjects(filter, drill_layer, MatrixLayerType.Dielectric, dielectric);
                                matrix.SetMatrixLayerIndex(dielectric.GetLayerName(), matrix.GetRawIndexByName(sigLayer));
                                matrix.SetMatrixLayerParameter(dielectric.GetLayerName(), MatrixLayerContext.Board, MatrixLayerPolarity.Negative, MatrixLayerType.Dielectric, -1, -1);
                                matrix.SetLayerHeight(dielectric.GetLayerName(), 5); //value in mils
                                matrix.UpdateDataAndList();                          //update list for correct order
                            }
                            else
                            {
                                Debug.WriteLine("error, can't create dielectric...");
                            }
                        }

                        lastWasSignal = true;
                    }
                    else
                    {
                        lastWasSignal = false;
                    }

                    IODBLayer odb_sig_layer = (IODBLayer)step.GetLayer(sigLayer);

                    if (drill_layer.GetType() == typeof(IODBLayer))
                    {
                        AddDrillObjects(filter, drill_layer, type, odb_sig_layer);

                        drill_layer.EnableLayer(false);
                        odb_sig_layer.EnableLayer(true);
                    }
                }
            }

            matrix.UpdateDataAndList();
            Parent.UpdateControlsAndResetView();
        }
Exemplo n.º 3
0
        /// <summary>
        /// You can use this method to add netinformation to an object.
        /// </summary>
        /// <param name="NetList">Hold all information in your own list.</param>
        /// <param name="step">The relevant step in PCB-I.</param>
        /// <param name="parentLayer">The layer from the relevant object.</param>
        /// <param name="NetName">The net name for this object.</param>
        /// <param name="netItem">This can be e.g. a pad or line or arc.</param>
        private static void AddNetInfos(Dictionary <string, netItem> NetList, IStep step, IODBLayer parentLayer, String NetName, IODBObject netItem)
        {
            if (NetName.Length == 0) //the default net
            {
                NetName = "$NONE$";
            }
            if (!NetList.ContainsKey(NetName)) //create a new net in the step.
            {
                INet    outNet;
                int     netNr = step.AddNet(NetName, "", out outNet);
                netItem netI  = new netItem(netNr, outNet);
                NetList.Add(NetName, netI);
            }

            netItem.PcbNetNumber = NetList[NetName].netNr;                                       //set the netinformation to the object
            int newNr = NetList[NetName].Net.AddLayerRef(parentLayer.GetLayerName(), lastNetNr); //each net saves a list of all layers are used.

            if (newNr == lastNetNr)
            {
                lastNetNr++;
            }
            parentLayer.SetNetNumber(NetName, netItem.PcbNetNumber);                                                     //for each object the layer needs information that this net is used.
            NetList[NetName].Net.AddFID(PCBI.FidType.Copper, parentLayer.GetLayerName(), netItem.GetIndexOnLayer(), ""); //this is specific to ODB++, if you don't use it and save the data as ODB++ some information get lost.
        }