Exemplo n.º 1
0
        public static Drill Parse(SExpression node)
        {
            Drill result = new Drill();

            int index = 0;

            if ((node.Items[0] as SNodeAtom).Value == "oval")
            {
                result.style = "oval";
                index++;
                float w = (node.Items[index++] as SNodeAtom).AsFloat;
                float h = (node.Items[index++] as SNodeAtom).AsFloat;
                result.size = new SizeF(w, h);
            }
            else
            {
                result.diameter = (node.Items[0] as SNodeAtom).AsFloat;
                index++;
            }

            for (int j = index; j < node.Items.Count; j++)
            {
                SExpression sub = node.Items[j] as SExpression;

                if (sub.Name == "offset")
                {
                    result.offset = sub.GetPointF();
                }
            }

            return(result);
        }
Exemplo n.º 2
0
 public pad(string number, string type, string shape, PointF at, SizeF size, float drill)
 {
     this.number   = number;
     this.type     = type;
     this.shape    = shape;
     this.position = new Position(at);
     this.size     = size;
     this.drill    = new Drill(drill);
     this._layers  = new LayerList();
     set_layers();
 }
Exemplo n.º 3
0
        public static pad Parse(SNodeBase node)
        {
            pad result = new pad();

            if ((node is SExpression) && ((node as SExpression).Name == "pad"))
            {
                SExpression expr = node as SExpression;

                int index = 0;

                result.number = (expr.Items[index++] as SNodeAtom).Value;
                result.type   = (expr.Items[index++] as SNodeAtom).Value;
                result.shape  = (expr.Items[index++] as SNodeAtom).Value;

                //
                while (index < expr.Items.Count)
                {
                    SExpression sub = expr.Items[index] as SExpression;

                    switch (sub.Name)
                    {
                    case "at":
                        result.position = Position.Parse(sub);
                        break;

                    case "size":
                        result.size = sub.GetSizeF();
                        break;

                    case "drill":
                        result.drill = Drill.Parse(sub);
                        break;

                    case "layers":
                        result._layers.ParseLayers(sub);
                        break;

                    case "net":
                        result.net = Net.Parse(sub);
                        break;

                    case "die_length":
                        result.die_length = sub.GetFloat();
                        break;

                    case "solder_mask_margin":
                        result.solder_mask_margin = sub.GetFloat();
                        break;

                    case "clearance":
                        result.clearance = sub.GetFloat();
                        break;

                    case "solder_paste_margin":
                        result.solder_paste_margin = sub.GetFloat();
                        break;

                    case "solder_paste_ratio":
                        result.solder_paste_ratio = sub.GetInt();
                        break;

                    case "zone_connect":
                        result.zone_connect = sub.GetInt();
                        break;

                    case "thermal_width":
                        result.thermal_width = sub.GetFloat();
                        break;

                    case "thermal_gap":
                        result.thermal_gap = sub.GetFloat();
                        break;
                    }
                    index++;
                }

                return(result);
            }
            else
            {
                return(null);  // error
            }
        }