design: make layout import resolve via names

This commit is contained in:
Tomasz Cichoń 2024-02-23 03:41:07 +01:00
parent c005337ea8
commit 53fd88f408
1 changed files with 8 additions and 3 deletions

View File

@ -10,6 +10,7 @@ use super::{
structure::Pcb, structure::Pcb,
}; };
#[derive(Debug)]
pub struct DsnDesign { pub struct DsnDesign {
pcb: Pcb, pcb: Pcb,
} }
@ -45,9 +46,13 @@ impl DsnDesign {
let net_id = net_ids.get(&via.net.0).unwrap(); let net_id = net_ids.get(&via.net.0).unwrap();
let continent = layout.add_continent(*net_id as i64); let continent = layout.add_continent(*net_id as i64);
// no way to resolve the name or layer support yet // find the padstack referenced by this via placement
// pick the first layer of the first object found let padstack = &self.pcb.library.padstacks.iter().find(|padstack| {
let circle = &self.pcb.library.padstacks[0].shapes[0].0; padstack.name == via.name
}).unwrap();
// no layer support yet, pick the first one
let circle = &padstack.shapes[0].0;
let circle = Circle { let circle = Circle {
pos: (via.x as f64 / 100.0, -via.y as f64 / 100.0).into(), pos: (via.x as f64 / 100.0, -via.y as f64 / 100.0).into(),
r: circle.radius as f64 / 100.0, r: circle.radius as f64 / 100.0,