WIP: [kicad-parser] write a KicadBoard#201
Conversation
|
@bschwind The current data model seems to assume that the |
Yep, let's keep these as separate types. |
bschwind
left a comment
There was a problem hiding this comment.
Looking pretty good so far! A few questions:
- What's the scope for this PR, or when do we consider it "done"? When we can write out a fully-functioning
*.kicad_pcbfile? - It would make sense to have a
write_to_file<P: AsRef<Path>>(file: P)convenience function - Pretty printing of the S-expressions would be nice, maybe the
sexpcrate doesn't support that though - Just for fun I tried exporting a
kicad_pcbfile by reading thesample.kicad_pcbfile and immediately serializing it again. When trying to read it into KiCAD, I got:
|
|
||
| pub fn write_board<W: std::io::Write>( | ||
| writer: &mut W, | ||
| board: &KicadBoard, |
There was a problem hiding this comment.
Should this instead be KicadPcb? I think my original plan was for KicadBoard to hold the actual board data like copper, footprints, silkscreens, etc, while KicadPcb would hold a KicadBoard, as well as extra data like the version and other metadata.
| fn circle_to_sexp(circle: &GraphicCircle) -> Sexp { | ||
| let items = vec![ | ||
| atom_s("gr_circle"), | ||
| cons_s("start", point_to_sexp(circle.center_point)), |
There was a problem hiding this comment.
| cons_s("start", point_to_sexp(circle.center_point)), | |
| cons_s("center", point_to_sexp(circle.center_point)), |
| atom_s(layer_str) | ||
| } | ||
|
|
||
| fn position_to_sexp(location: (f64, f64), rotation_degrees: f64) -> Sexp { |
There was a problem hiding this comment.
I might call this orientation_to_sexp or transform_to_sexp, as I expected position to just mean an XY coordinate.
No description provided.