mirror of https://codeberg.org/topola/topola.git
specctra: a hack to attempt loading layers from EasyEDA
This commit is contained in:
parent
479646d503
commit
dfb2c20f1d
|
|
@ -55,7 +55,8 @@ impl SpecctraDesign {
|
|||
///
|
||||
pub fn load(reader: impl std::io::BufRead) -> Result<SpecctraDesign, LoadingError> {
|
||||
let mut list_reader = ListTokenizer::new(reader);
|
||||
let dsn = list_reader.read_value::<DsnFile>()?;
|
||||
let mut dsn = list_reader.read_value::<DsnFile>()?;
|
||||
dsn.pcb.structure.layers.append(&mut dsn.pcb.structure.layers_easyeda); // temporary hack
|
||||
|
||||
Ok(Self { pcb: dsn.pcb })
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,12 +72,17 @@ impl SpecctraMesadata {
|
|||
/// layer-to-layer name mappings, net-to-net name mappings, and net class rules.
|
||||
///
|
||||
pub fn from_pcb(pcb: &Pcb) -> Self {
|
||||
let layer_layername = BiHashMap::from_iter(
|
||||
pcb.structure
|
||||
.layers
|
||||
.iter()
|
||||
.map(|layer| (layer.property.index, layer.name.clone())),
|
||||
);
|
||||
let mut highest_layer: usize = 0;
|
||||
let mut layer_layername = BiHashMap::new();
|
||||
|
||||
for layer in &pcb.structure.layers {
|
||||
let index = if layer.property.is_some() {
|
||||
layer.property.as_ref().unwrap().index
|
||||
} else {
|
||||
layer.name.parse().unwrap()
|
||||
};
|
||||
layer_layername.insert(index, layer.name.clone());
|
||||
}
|
||||
|
||||
// keeping this as a separate iter pass because it might be moved into a different struct later?
|
||||
let net_netname = BiHashMap::from_iter(
|
||||
|
|
|
|||
|
|
@ -94,6 +94,10 @@ pub struct Structure {
|
|||
// (in class rules it outputs a single rule with all clearances like KiCad)
|
||||
#[vec("rule")]
|
||||
pub rules: Vec<StructureRule>,
|
||||
// EasyEDA outputs these last...
|
||||
// this is a horrible hack to see what else causes trouble
|
||||
#[vec("layer")]
|
||||
pub layers_easyeda: Vec<Layer>,
|
||||
}
|
||||
|
||||
#[derive(ReadDsn, WriteSes, Debug)]
|
||||
|
|
@ -101,7 +105,7 @@ pub struct Layer {
|
|||
#[anon]
|
||||
pub name: String,
|
||||
pub r#type: String,
|
||||
pub property: Property,
|
||||
pub property: Option<Property>,
|
||||
}
|
||||
|
||||
#[derive(ReadDsn, WriteSes, Debug)]
|
||||
|
|
@ -224,7 +228,7 @@ pub struct Padstack {
|
|||
pub name: String,
|
||||
#[vec("shape")]
|
||||
pub shapes: Vec<Shape>,
|
||||
pub attach: bool,
|
||||
pub attach: Option<bool>,
|
||||
}
|
||||
|
||||
// TODO: derive for enums if more than this single one is needed
|
||||
|
|
|
|||
Loading…
Reference in New Issue