mirror of https://codeberg.org/topola/topola.git
specctra: changes for compatibility with EasyEDA
This commit is contained in:
parent
2a0b6464ae
commit
b7027ae603
|
|
@ -103,8 +103,21 @@ impl SpecctraMesadata {
|
||||||
.map(|class| (class.name.clone(), SpecctraRule::from_dsn(&class.rule))),
|
.map(|class| (class.name.clone(), SpecctraRule::from_dsn(&class.rule))),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let mut structure_rule = super::structure::Rule {
|
||||||
|
width: 0.0,
|
||||||
|
clearances: Vec::new(),
|
||||||
|
};
|
||||||
|
// workaround for differing syntax
|
||||||
|
// collapse multiple rule entries into a single one
|
||||||
|
for rule in &pcb.structure.rules {
|
||||||
|
if rule.width.is_some() {
|
||||||
|
structure_rule.width = rule.width.unwrap()
|
||||||
|
}
|
||||||
|
structure_rule.clearances.extend_from_slice(&rule.clearances);
|
||||||
|
}
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
structure_rule: SpecctraRule::from_dsn(&pcb.structure.rule),
|
structure_rule: SpecctraRule::from_dsn(&structure_rule),
|
||||||
class_rules,
|
class_rules,
|
||||||
layer_layername,
|
layer_layername,
|
||||||
net_netname,
|
net_netname,
|
||||||
|
|
|
||||||
|
|
@ -53,9 +53,9 @@ pub struct DsnFile {
|
||||||
pub struct Pcb {
|
pub struct Pcb {
|
||||||
#[anon]
|
#[anon]
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub parser: Parser,
|
pub parser: Option<Parser>,
|
||||||
pub resolution: Resolution,
|
pub resolution: Resolution,
|
||||||
pub unit: String,
|
pub unit: Option<String>,
|
||||||
pub structure: Structure,
|
pub structure: Structure,
|
||||||
pub placement: Placement,
|
pub placement: Placement,
|
||||||
pub library: Library,
|
pub library: Library,
|
||||||
|
|
@ -87,7 +87,13 @@ pub struct Structure {
|
||||||
#[vec("plane")]
|
#[vec("plane")]
|
||||||
pub planes: Vec<Plane>,
|
pub planes: Vec<Plane>,
|
||||||
pub via: ViaNames,
|
pub via: ViaNames,
|
||||||
pub rule: Rule,
|
#[vec("grid")]
|
||||||
|
pub grids: Vec<Grid>,
|
||||||
|
// this is a vec of special structs because EasyEDA uses different syntax
|
||||||
|
// it outputs a sequence of rules containing a clearance each
|
||||||
|
// (in class rules it outputs a single rule with all clearances like KiCad)
|
||||||
|
#[vec("rule")]
|
||||||
|
pub rules: Vec<StructureRule>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(ReadDsn, WriteSes, Debug)]
|
#[derive(ReadDsn, WriteSes, Debug)]
|
||||||
|
|
@ -121,6 +127,21 @@ pub struct ViaNames {
|
||||||
pub names: Vec<String>,
|
pub names: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(ReadDsn, WriteSes, Debug)]
|
||||||
|
pub struct Grid {
|
||||||
|
#[anon]
|
||||||
|
pub kind: String,
|
||||||
|
#[anon]
|
||||||
|
pub value: f64,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(ReadDsn, WriteSes, Debug)]
|
||||||
|
pub struct StructureRule {
|
||||||
|
pub width: Option<f32>,
|
||||||
|
#[vec("clearance")]
|
||||||
|
pub clearances: Vec<Clearance>,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(ReadDsn, WriteSes, Debug)]
|
#[derive(ReadDsn, WriteSes, Debug)]
|
||||||
pub struct Placement {
|
pub struct Placement {
|
||||||
#[vec("component")]
|
#[vec("component")]
|
||||||
|
|
@ -428,7 +449,7 @@ pub struct Rule {
|
||||||
pub clearances: Vec<Clearance>,
|
pub clearances: Vec<Clearance>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(ReadDsn, WriteSes, Debug)]
|
#[derive(ReadDsn, WriteSes, Clone, Debug)]
|
||||||
pub struct Clearance {
|
pub struct Clearance {
|
||||||
#[anon]
|
#[anon]
|
||||||
pub value: f32,
|
pub value: f32,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue