mirror of https://codeberg.org/topola/topola.git
dsn: implement loading pins from components
This commit is contained in:
parent
5ba56963ee
commit
bbc89a3c94
|
|
@ -36,6 +36,58 @@ impl DsnDesign {
|
||||||
.map(|(id, net)| (net.clone(), id)),
|
.map(|(id, net)| (net.clone(), id)),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let continent100 = layout.add_continent(100); // TODO: remove this placeholder.
|
||||||
|
|
||||||
|
// add pins from components
|
||||||
|
//self.pcb.placement.components.iter().map(|component| {
|
||||||
|
for component in &self.pcb.placement.components {
|
||||||
|
for place in &component.places {
|
||||||
|
let image = self
|
||||||
|
.pcb
|
||||||
|
.library
|
||||||
|
.images
|
||||||
|
.iter()
|
||||||
|
.find(|image| image.name == component.name)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
for pin in &image.pins {
|
||||||
|
//let pin_name = format!("{}-{}", place.name, pin.id);
|
||||||
|
/*let net = self
|
||||||
|
.pcb
|
||||||
|
.network
|
||||||
|
.nets
|
||||||
|
.unwrap()
|
||||||
|
.find(|net| net.pins[0].ids.contains(&pin_name));
|
||||||
|
let net_id = net_ids.get(&net).unwrap();
|
||||||
|
let continent = layout.add_continent(*net_id as i64);*/
|
||||||
|
//let continent = layout.add_continent(*net_id as i64);
|
||||||
|
|
||||||
|
let padstack = &self
|
||||||
|
.pcb
|
||||||
|
.library
|
||||||
|
.padstacks
|
||||||
|
.iter()
|
||||||
|
.find(|padstack| padstack.name == pin.name)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
// no layer support yet, pick the first one
|
||||||
|
let circle = &padstack.shapes[0].0;
|
||||||
|
let circle = Circle {
|
||||||
|
pos: (place.x as f64 / 100.0, -place.y as f64 / 100.0).into(),
|
||||||
|
r: circle.diameter as f64 / 200.0,
|
||||||
|
};
|
||||||
|
|
||||||
|
layout
|
||||||
|
.add_fixed_dot(FixedDotWeight {
|
||||||
|
continent: continent100,
|
||||||
|
circle,
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//})
|
||||||
|
|
||||||
// add vias to layout and save indices of dots in the order they appear in the file
|
// add vias to layout and save indices of dots in the order they appear in the file
|
||||||
let _dot_indices: Vec<_> = self
|
let _dot_indices: Vec<_> = self
|
||||||
.pcb
|
.pcb
|
||||||
|
|
@ -59,7 +111,7 @@ impl DsnDesign {
|
||||||
let circle = &padstack.shapes[0].0;
|
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.diameter as f64 / 200.0,
|
||||||
};
|
};
|
||||||
|
|
||||||
layout
|
layout
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ pub struct Shape(pub Circle);
|
||||||
#[serde(rename = "circle")]
|
#[serde(rename = "circle")]
|
||||||
pub struct Circle {
|
pub struct Circle {
|
||||||
pub layer: String,
|
pub layer: String,
|
||||||
pub radius: u32,
|
pub diameter: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug)]
|
#[derive(Deserialize, Debug)]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue