예제 #1
0
        public LayerDescriptor FlipLayer(LayerList referenceLayers)
        {
            LayerDescriptor result = this.Clone();

            if (result.Number < LayerList.NumCopperLayers)
            {
                result.Number = LayerList.NumCopperLayers - 1 - result.Number;
                result.Name   = referenceLayers.GetLayerName(result.Number);
            }
            else
            {
                if (result.Name.StartsWith("F."))
                {
                    result.Name   = Layer.MakeLayerName("B", result.Name);
                    result.Number = referenceLayers.GetLayerNumber(result.Name);
                }
                else if (result.Name.StartsWith("B."))
                {
                    result.Name   = Layer.MakeLayerName("F", result.Name);
                    result.Number = referenceLayers.GetLayerNumber(result.Name);
                }
            }

            return(result);
        }
예제 #2
0
        public LayerDescriptor Clone()
        {
            LayerDescriptor result = new LayerDescriptor();

            result.Number  = this.Number;
            result.Name    = this.Name;
            result.Type    = this.Type;
            result.Visible = this.Visible;
            return(result);
        }
예제 #3
0
 public void AddLayer(string s)
 {
     if (s == "*.Cu")
     {
         foreach (LayerDescriptor ld in ReferenceLayers.Layers)
         {
             if (ld.Number < NumCopperLayers)
             {
                 Layers.Add(ld);
             }
         }
     }
     else
     {
         LayerDescriptor ld = ReferenceLayers.Layers.Find(x => x.Name == s);
         if (ld != null)
         {
             Layers.Add(ld);
         }
     }
 }
예제 #4
0
        //
        public k.LayerDescriptor ConvertLayer(List <Layer> LayerList, string number, string message = "")
        {
            k.LayerDescriptor result = new Kicad_utils.LayerDescriptor();

            //todo: for copper layers use number?
            //todo: use layer names from Eagle? (cu layers only)

            Layer layer = LayerList.Find(x => x.Number == number);

            if (layer == null)
            {
                Trace(string.Format("warning: layer not found: {0}", number));
                return(null);
            }
            else
            {
                switch (number)
                {
                case "1": result.Name = "F.Cu"; break;

                case "2": result.Name = "Inner1.Cu"; break;

                case "3": result.Name = "Inner2.Cu"; break;

                case "4": result.Name = "Inner3.Cu"; break;

                case "5": result.Name = "Inner4.Cu"; break;

                case "6": result.Name = "Inner5.Cu"; break;

                case "7": result.Name = "Inner6.Cu"; break;

                case "8": result.Name = "Inner7.Cu"; break;

                case "9": result.Name = "Inner8.Cu"; break;

                case "10": result.Name = "Inner9.Cu"; break;

                case "11": result.Name = "Inner10.Cu"; break;

                case "12": result.Name = "Inner11.Cu"; break;

                case "13": result.Name = "Inner12.Cu"; break;

                case "14": result.Name = "Inner13.Cu"; break;

                case "15": result.Name = "Inner14.Cu"; break;

                case "16": result.Name = "B.Cu"; break;

                // Dimension
                case "20": result.Name = "Edge.Cuts"; break;

                // tPlace
                case "21": result.Name = "F.SilkS"; break;

                // bPlace
                case "22": result.Name = "B.SilkS"; break;

                //  tNames
                case "25": result.Name = "F.SilkS"; break;     // or Fab?

                //  bNames
                case "26": result.Name = "B.SilkS"; break;

                //  tValues
                case "27": result.Name = "F.SilkS"; break;

                //  bValues
                case "28": result.Name = "B.SilkS"; break;

                //  tStop
                case "29": result.Name = "F.Mask"; break;

                //  bStop
                case "30": result.Name = "B.Mask"; break;

                //  tCream
                case "31": result.Name = "F.Paste"; break;

                //  bCream
                case "32": result.Name = "B.Paste"; break;

                //  tFinish
                case "33": result.Name = "F.Mask"; break;

                //  bFinish
                case "34": result.Name = "B.Mask"; break;

                //  tGlue
                case "35": result.Name = "F.Adhes"; break;

                //  bGlue
                case "36": result.Name = "B.Adhes"; break;

                //  tKeepout
                case "39": result.Name = "F.CrtYd"; break;

                //  bKeepout
                case "40": result.Name = "B.CrtYd"; break;

                // tRestrict
                case "41": result.Name = "Dwgs.User"; break;

                // bRestrict
                case "42": result.Name = "Dwgs.User"; break;

                // vRestrict
                case "43": result.Name = "Dwgs.User"; break;

                // Milling
                case "46": result.Name = "Dwgs.User"; break;     // edge?

                // Document
                case "48": result.Name = "F.Fab"; break;

                // Reference
                case "49": result.Name = "F.Fab"; break;

                //  tDocu
                case "51": result.Name = "F.Fab"; break;

                //  bDocu
                case "52": result.Name = "B.Fab"; break;

                default:

                    if (KnownErrors.Find(x => x == number + message) == null)
                    {
                        Trace(string.Format("warning: unsupported layer: {0} {1} in {2}", number, layer.Name, message));
                        KnownErrors.Add(number + message);
                    }
                    return(null);

                    break;
                }
            }

            result.Number = k.LayerList.StandardLayers.GetLayerNumber(result.Name);
            return(result);
        }