mirror of https://codeberg.org/topola/topola.git
specctra: clean up the hack related to layer import
This commit is contained in:
parent
d86ef12e83
commit
947ecf2e1c
|
|
@ -55,8 +55,7 @@ impl SpecctraDesign {
|
||||||
///
|
///
|
||||||
pub fn load(reader: impl std::io::BufRead) -> Result<SpecctraDesign, LoadingError> {
|
pub fn load(reader: impl std::io::BufRead) -> Result<SpecctraDesign, LoadingError> {
|
||||||
let mut list_reader = ListTokenizer::new(reader);
|
let mut list_reader = ListTokenizer::new(reader);
|
||||||
let mut dsn = list_reader.read_value::<DsnFile>()?;
|
let dsn = list_reader.read_value::<DsnFile>()?;
|
||||||
dsn.pcb.structure.layers.append(&mut dsn.pcb.structure.layers_easyeda); // temporary hack
|
|
||||||
|
|
||||||
Ok(Self { pcb: dsn.pcb })
|
Ok(Self { pcb: dsn.pcb })
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ pub struct Resolution {
|
||||||
pub value: f32,
|
pub value: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(ReadDsn, WriteSes, Debug)]
|
#[derive(WriteSes, Debug)]
|
||||||
pub struct Structure {
|
pub struct Structure {
|
||||||
#[vec("layer")]
|
#[vec("layer")]
|
||||||
pub layers: Vec<Layer>,
|
pub layers: Vec<Layer>,
|
||||||
|
|
@ -95,10 +95,26 @@ pub struct Structure {
|
||||||
// (in class rules it outputs a single rule with all clearances like KiCad)
|
// (in class rules it outputs a single rule with all clearances like KiCad)
|
||||||
#[vec("rule")]
|
#[vec("rule")]
|
||||||
pub rules: Vec<StructureRule>,
|
pub rules: Vec<StructureRule>,
|
||||||
// EasyEDA outputs these last...
|
}
|
||||||
// this is a horrible hack to see what else causes trouble
|
|
||||||
#[vec("layer")]
|
// custom impl to handle layers appearing late
|
||||||
pub layers_easyeda: Vec<Layer>,
|
impl<R: std::io::BufRead> ReadDsn<R> for Structure {
|
||||||
|
fn read_dsn(
|
||||||
|
tokenizer: &mut ListTokenizer<R>,
|
||||||
|
) -> Result<Self, ParseErrorContext> {
|
||||||
|
let mut value = Self {
|
||||||
|
layers: tokenizer.read_named_array("layer")?,
|
||||||
|
boundary: tokenizer.read_named("boundary")?,
|
||||||
|
planes: tokenizer.read_named_array("plane")?,
|
||||||
|
via: tokenizer.read_named("via")?,
|
||||||
|
grids: tokenizer.read_named_array("grid")?,
|
||||||
|
rules: tokenizer.read_named_array("rule")?,
|
||||||
|
};
|
||||||
|
|
||||||
|
value.layers.append(&mut tokenizer.read_named_array("layer")?);
|
||||||
|
|
||||||
|
Ok(value)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(ReadDsn, WriteSes, Debug)]
|
#[derive(ReadDsn, WriteSes, Debug)]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue