Skip to content

Commit

Permalink
Merge pull request #1 from seppestas/master
Browse files Browse the repository at this point in the history
Added support for PCB layer types and pad clearance overrides
  • Loading branch information
andete authored Mar 23, 2017
2 parents 61d4aac + 26240bf commit 093e563
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/footprint/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ pub enum Element {
At(At),
/// 3D model information
Model(Model),
/// Clearance override for module
Clearance(f64),
/// is the module locked
Locked,
}
Expand All @@ -186,6 +188,7 @@ impl BoundingBox for Element {
Element::Model(_) |
Element::Attr(_) |
Element::SolderMaskMargin(_) |
Element::Clearance(_) |
Element::Tags(_) |
Element::Locked |
Element::TStamp(_) => Bound::default(),
Expand All @@ -211,6 +214,7 @@ impl Named for Element {
Element::Model(_) => "Model",
Element::TStamp(_) => "Tstamp",
Element::SolderMaskMargin(_) => "SolderMaskMargin",
Element::Clearance(_) |
Element::Tags(_) => "Tags",
Element::Attr(_) => "Attr",
Element::Locked => "Locked",
Expand Down
1 change: 1 addition & 0 deletions src/footprint/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ impl FromSexp for Element {
"path" => wrap(s, parse_string_element, Element::Path),
"at" => wrap(s, from_sexp, Element::At),
"model" => wrap(s, from_sexp, Element::Model),
"clearance" => wrap(s, parse_float_element, Element::Clearance),
_ => Err(format!("unknown element in module: {}", name).into()),
}
}
Expand Down
1 change: 1 addition & 0 deletions src/footprint/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ impl IntoSexp for Element {
Element::Path(ref p) => ("path", p).into(),
Element::At(ref p) => p.into_sexp(),
Element::Model(ref p) => p.into_sexp(),
Element::Clearance(ref s) => ("clearance", s).into(),
Element::Locked => "locked".into(),
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/layout/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ pub struct Layer {
pub enum LayerType {
/// signal layer
Signal,
/// power layer
Power,
/// mixed layer
Mixed,
/// jumper layer
Jumper,
/// user layer
User,
}
Expand Down
3 changes: 3 additions & 0 deletions src/layout/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ impl FromSexp for LayerType {
let x = s.string()?;
match &x[..] {
"signal" => Ok(LayerType::Signal),
"power" => Ok(LayerType::Power),
"mixed" => Ok(LayerType::Mixed),
"jumper" => Ok(LayerType::Jumper),
"user" => Ok(LayerType::User),
_ => Err(format!("unknown layertype {} in {}", x, s).into()),
}
Expand Down
3 changes: 3 additions & 0 deletions src/layout/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ impl fmt::Display for LayerType {
fn fmt(&self, f: &mut fmt::Formatter) -> result::Result<(), fmt::Error> {
let s = match *self {
LayerType::Signal => "signal",
LayerType::Power => "power",
LayerType::Mixed => "mixed",
LayerType::Jumper => "jumper",
LayerType::User => "user",
};
write!(f, "{}", s)
Expand Down

0 comments on commit 093e563

Please sign in to comment.