Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for PCB layer types and pad clearance overrides #1

Merged
merged 2 commits into from
Mar 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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