// links? // no-connects? public kicad_pcb() { RootNode = new SExpression(); //RootNode.Name = "kicad_pcb"; //RootNode.Items = new List<SNodeBase>(); //RootNode.Items.Add(new SExpression("version", new List<SNodeBase>() { new SNodeNumber(3) })); FileVersion = "4"; Host_Name = "pcbnew"; Host_Version = "(2013-07-07 BZR 4022)-stable"; //?? General = new General(); Page = "A4"; PageMode = PageMode.landscape; Layers = PcbLayer.DefaultLayers(); Setup = new Setup(); Nets = new List <Net>(); Nets.Add(new Net(0, "")); NetClasses = new List <NetClass>(); NetClasses.Add(NetClass.DefaultNetclass()); Modules = null; Drawings = null; Setup.aux_axis_origin = new PointF(0, 0); Zones = new List <Zone>(); Segments = new List <PcbSegment>(); Vias = new List <Via>(); Dimensions = new List <Dimension>(); }
public static NetClass DefaultNetclass() { NetClass result = new NetClass(); result.Name = "Default"; result.Description = "This is the default net class."; result.clearance = 0.254f; result.trace_width = 0.254f; result.via_dia = 0.889f; result.via_drill = 0.635f; result.uvia_dia = 0.508f; result.uvia_drill = 0.127f; result.net_names = new List <string>(); result.net_names.Add(""); return(result); }
public void SaveToFile(string filename) { filename = Path.ChangeExtension(filename, "kicad_pcb"); if (Drawings == null) { General.drawings = 0; } else { General.drawings = Drawings.Count; } if (Modules == null) { General.modules = 0; } else { General.modules = Modules.Count; } if (Nets == null) { General.nets = 0; } else { General.nets = Nets.Count; } // RootNode = new SExpression(); List <SExpression> sex_list; List <SNodeBase> node_list; RootNode.Name = "kicad_pcb"; RootNode.Items = new List <SNodeBase>(); RootNode.Items.Add(new SExpression("version", new List <SNodeBase>() { new SNodeAtom(FileVersion) })); RootNode.Items.Add(new SExpression("host", new List <SNodeBase>() { new SNodeAtom(Host_Name), new SNodeAtom(Host_Version) })); RootNode.Items.Add(General.GetSExpression()); node_list = new List <SNodeBase>(); node_list.Add(new SNodeAtom(Page)); if (PageMode != PageMode.landscape) { node_list.Add(new SNodeAtom(PageMode.ToString())); } RootNode.Items.Add(new SExpression("page", node_list)); RootNode.Items.Add(PcbLayer.GetSExpression(Layers)); RootNode.Items.Add(Setup.GetSExpression()); sex_list = Net.GetSExpressionList(Nets); foreach (SExpression sex in sex_list) { RootNode.Items.Add(sex); } sex_list = NetClass.GetSExpressionList(NetClasses); foreach (SExpression sex in sex_list) { RootNode.Items.Add(sex); } if (Modules != null) { sex_list = Module.GetSExpressionList(Modules); foreach (SExpression sex in sex_list) { RootNode.Items.Add(sex); } } if (Drawings != null) { sex_list = graphic_base.GetSExpressionList(Drawings); foreach (SExpression sex in sex_list) { RootNode.Items.Add(sex); } } if (Segments != null) { sex_list = PcbSegment.GetSExpressionList(Segments); foreach (SExpression sex in sex_list) { RootNode.Items.Add(sex); } } if (Zones != null) { sex_list = Zone.GetSExpressionList(Zones); foreach (SExpression sex in sex_list) { RootNode.Items.Add(sex); } } if (Vias != null) { sex_list = Via.GetSExpressionList(Vias); foreach (SExpression sex in sex_list) { RootNode.Items.Add(sex); } } if (Dimensions != null) { sex_list = Dimension.GetSExpressionList(Dimensions); foreach (SExpression sex in sex_list) { RootNode.Items.Add(sex); } } // RootNode.WriteToFile(filename); }