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. }
/// <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. }