コード例 #1
0
        private static PcbLayer DeterminePcbLayer(PadStack.StackLine line)
        {
            PcbLayer layer;

            switch ((PadStack.SpecialLayers)line.Layer)
            {
            case PadStack.SpecialLayers.Top:
                layer = PcbLayer.Top;
                break;

            case PadStack.SpecialLayers.Inner:
                layer = PcbLayer.InternalBottom;
                break;

            case PadStack.SpecialLayers.Bottom:
                layer = PcbLayer.Bottom;
                break;

            default:
                layer = (PcbLayer)(Enum.GetValues(typeof(PcbLayer)).Length + line.Layer - 1);
                WarningListener.Add(new NotImplementedException(),
                                    "Padstack non-special layer recognition is only partially implemented!");
                break;
            }
            return(layer);
        }
コード例 #2
0
        private static PcbPadStyle DeterminePadStyle(PadStack.StackLine line,PcbUnits coordinateUnits)
        {
            PcbPadStyle style;
            bool        drilled = line.Arguments[(int)PadStack.StackLine.DependentArguments.DrillSize].Present;

            switch (line.CurrentShape)
            {
            case PadStack.Shape.Round:     //"Round" pads with drill argument are used for drilled pads (not annular pads!)
                style = new PcbPadStyle(drilled ? PcbPadShape.CircularTH : PcbPadShape.CircularSMT,
                                        coordinateUnits,line.Size,0,
                                        drilled ? (double)line.Arguments[(int)PadStack.StackLine.DependentArguments.DrillSize].Value : 0);
                break;

            case PadStack.Shape.Square:
                style = new PcbPadStyle(drilled ? PcbPadShape.RectangularTH : PcbPadShape.RectangularSMT,
                                        coordinateUnits,line.Size,line.Size,
                                        drilled ? (double)line.Arguments[(int)PadStack.StackLine.DependentArguments.DrillSize].Value : 0);
                break;

            case PadStack.Shape.Annular:
                style = new PcbPadStyle(drilled ? PcbPadShape.CircularTH : PcbPadShape.CircularSMT,
                                        coordinateUnits,line.Size,
                                        (double)line.Arguments[(int)PadStack.StackLine.DependentArguments.InternalDiameter].Value,
                                        drilled ? (double)line.Arguments[(int)PadStack.StackLine.DependentArguments.DrillSize].Value : 0);
                break;

            case PadStack.Shape.RectangularFinger:
                style = new PcbPadStyle(PcbPadShape.RectangularSMT,coordinateUnits,line.Size,
                                        (double)line.Arguments[(int)PadStack.StackLine.DependentArguments.FingerLength].Value);
                WarningListener.Add(new NotImplementedException("Only Length argument is supported for RectangularFinger pad style!"));
                break;

            default:
                throw new NotImplementedException(string.Format(
                                                      "Pad shape {0} ignored.",Enum.GetName(typeof(PadStack.Shape),line.CurrentShape)));
            }
            return(style);
        }