pub struct PcbEditSession {
pub doc: PcbDoc,
/* private fields */
}Expand description
PCB editing session for comprehensive document modification.
Fields§
§doc: PcbDocThe PCB document being edited.
Implementations§
Source§impl PcbEditSession
impl PcbEditSession
Sourcepub fn save_to_original(&mut self) -> Result<()>
pub fn save_to_original(&mut self) -> Result<()>
Save to the original file (if opened from file).
Sourcepub fn is_modified(&self) -> bool
pub fn is_modified(&self) -> bool
Check if the document has been modified.
Sourcepub fn source_path(&self) -> Option<&str>
pub fn source_path(&self) -> Option<&str>
Get the source file path.
Sourcepub fn set_grid_mm(&mut self, spacing_mm: f64)
pub fn set_grid_mm(&mut self, spacing_mm: f64)
Set grid from spacing in mm.
Sourcepub fn set_default_track_width(&mut self, width: Coord)
pub fn set_default_track_width(&mut self, width: Coord)
Set the default track width.
Sourcepub fn set_default_via_diameter(&mut self, diameter: Coord)
pub fn set_default_via_diameter(&mut self, diameter: Coord)
Set the default via diameter.
Sourcepub fn set_default_via_hole(&mut self, hole: Coord)
pub fn set_default_via_hole(&mut self, hole: Coord)
Set the default via hole size.
Sourcepub fn set_default_layer(&mut self, layer: Layer)
pub fn set_default_layer(&mut self, layer: Layer)
Set the default layer for new primitives.
Sourcepub fn default_layer(&self) -> Layer
pub fn default_layer(&self) -> Layer
Get the default layer.
Sourcepub fn resolve_position(&self, pos: &Position) -> Result<CoordPoint>
pub fn resolve_position(&self, pos: &Position) -> Result<CoordPoint>
Resolve a Position to an absolute CoordPoint.
Sourcepub fn get_board_bounds(&self) -> CoordRect
pub fn get_board_bounds(&self) -> CoordRect
Get the board bounds.
Sourcepub fn add_track(
&mut self,
start: CoordPoint,
end: CoordPoint,
width: Option<Coord>,
layer: Option<Layer>,
net: Option<&str>,
) -> Result<usize>
pub fn add_track( &mut self, start: CoordPoint, end: CoordPoint, width: Option<Coord>, layer: Option<Layer>, net: Option<&str>, ) -> Result<usize>
Add a single track segment.
Sourcepub fn add_track_positioned(
&mut self,
start: &Position,
end: &Position,
width: Option<Coord>,
layer: Option<Layer>,
net: Option<&str>,
) -> Result<usize>
pub fn add_track_positioned( &mut self, start: &Position, end: &Position, width: Option<Coord>, layer: Option<Layer>, net: Option<&str>, ) -> Result<usize>
Add a track using Position specifications.
Sourcepub fn add_track_path(
&mut self,
vertices: &[CoordPoint],
width: Option<Coord>,
layer: Option<Layer>,
net: Option<&str>,
) -> Result<Vec<usize>>
pub fn add_track_path( &mut self, vertices: &[CoordPoint], width: Option<Coord>, layer: Option<Layer>, net: Option<&str>, ) -> Result<Vec<usize>>
Add multiple connected track segments forming a path.
Sourcepub fn add_track_routed(
&mut self,
path: &TrackPath,
width: Option<Coord>,
layer: Option<Layer>,
net: Option<&str>,
) -> Result<Vec<usize>>
pub fn add_track_routed( &mut self, path: &TrackPath, width: Option<Coord>, layer: Option<Layer>, net: Option<&str>, ) -> Result<Vec<usize>>
Add a track path using the TrackPath specification.
Sourcepub fn add_via(
&mut self,
location: CoordPoint,
diameter: Option<Coord>,
hole_size: Option<Coord>,
from_layer: Option<Layer>,
to_layer: Option<Layer>,
net: Option<&str>,
) -> Result<usize>
pub fn add_via( &mut self, location: CoordPoint, diameter: Option<Coord>, hole_size: Option<Coord>, from_layer: Option<Layer>, to_layer: Option<Layer>, net: Option<&str>, ) -> Result<usize>
Add a via at a specific location.
Sourcepub fn add_via_positioned(
&mut self,
position: &Position,
diameter: Option<Coord>,
hole_size: Option<Coord>,
from_layer: Option<Layer>,
to_layer: Option<Layer>,
net: Option<&str>,
) -> Result<usize>
pub fn add_via_positioned( &mut self, position: &Position, diameter: Option<Coord>, hole_size: Option<Coord>, from_layer: Option<Layer>, to_layer: Option<Layer>, net: Option<&str>, ) -> Result<usize>
Add a via using Position specification.
Sourcepub fn add_blind_via(
&mut self,
location: CoordPoint,
from_layer: Layer,
to_layer: Layer,
diameter: Option<Coord>,
hole_size: Option<Coord>,
net: Option<&str>,
) -> Result<usize>
pub fn add_blind_via( &mut self, location: CoordPoint, from_layer: Layer, to_layer: Layer, diameter: Option<Coord>, hole_size: Option<Coord>, net: Option<&str>, ) -> Result<usize>
Add a blind via (connects top/bottom to inner layer).
Sourcepub fn add_through_hole_pad(
&mut self,
location: CoordPoint,
designator: &str,
hole_size: Coord,
pad_size: CoordPoint,
shape: PcbPadShape,
net: Option<&str>,
) -> Result<usize>
pub fn add_through_hole_pad( &mut self, location: CoordPoint, designator: &str, hole_size: Coord, pad_size: CoordPoint, shape: PcbPadShape, net: Option<&str>, ) -> Result<usize>
Add a through-hole pad.
Sourcepub fn add_smd_pad(
&mut self,
location: CoordPoint,
designator: &str,
size: CoordPoint,
shape: PcbPadShape,
layer: Layer,
net: Option<&str>,
) -> Result<usize>
pub fn add_smd_pad( &mut self, location: CoordPoint, designator: &str, size: CoordPoint, shape: PcbPadShape, layer: Layer, net: Option<&str>, ) -> Result<usize>
Add an SMD pad (surface mount).
Sourcepub fn add_arc(
&mut self,
center: CoordPoint,
radius: Coord,
start_angle: f64,
end_angle: f64,
width: Option<Coord>,
layer: Option<Layer>,
net: Option<&str>,
) -> Result<usize>
pub fn add_arc( &mut self, center: CoordPoint, radius: Coord, start_angle: f64, end_angle: f64, width: Option<Coord>, layer: Option<Layer>, net: Option<&str>, ) -> Result<usize>
Add an arc.
Sourcepub fn add_circle(
&mut self,
center: CoordPoint,
radius: Coord,
width: Option<Coord>,
layer: Option<Layer>,
) -> Result<usize>
pub fn add_circle( &mut self, center: CoordPoint, radius: Coord, width: Option<Coord>, layer: Option<Layer>, ) -> Result<usize>
Add a full circle arc.
Sourcepub fn add_arc_positioned(
&mut self,
center: &Position,
radius: Coord,
start_angle: f64,
end_angle: f64,
width: Option<Coord>,
layer: Option<Layer>,
net: Option<&str>,
) -> Result<usize>
pub fn add_arc_positioned( &mut self, center: &Position, radius: Coord, start_angle: f64, end_angle: f64, width: Option<Coord>, layer: Option<Layer>, net: Option<&str>, ) -> Result<usize>
Add an arc using Position specification.
Sourcepub fn add_fill(
&mut self,
corner1: CoordPoint,
corner2: CoordPoint,
layer: Option<Layer>,
rotation: Option<f64>,
net: Option<&str>,
) -> Result<usize>
pub fn add_fill( &mut self, corner1: CoordPoint, corner2: CoordPoint, layer: Option<Layer>, rotation: Option<f64>, net: Option<&str>, ) -> Result<usize>
Add a solid fill (copper rectangle).
Sourcepub fn add_fill_positioned(
&mut self,
corner1: &Position,
corner2: &Position,
layer: Option<Layer>,
rotation: Option<f64>,
net: Option<&str>,
) -> Result<usize>
pub fn add_fill_positioned( &mut self, corner1: &Position, corner2: &Position, layer: Option<Layer>, rotation: Option<f64>, net: Option<&str>, ) -> Result<usize>
Add a fill with Position specifications.
Sourcepub fn add_text(
&mut self,
text: &str,
location: CoordPoint,
height: Coord,
layer: Option<Layer>,
rotation: Option<f64>,
_justification: Option<PcbTextJustification>,
) -> Result<usize>
pub fn add_text( &mut self, text: &str, location: CoordPoint, height: Coord, layer: Option<Layer>, rotation: Option<f64>, _justification: Option<PcbTextJustification>, ) -> Result<usize>
Add text annotation.
Sourcepub fn add_text_positioned(
&mut self,
text: &str,
position: &Position,
height: Coord,
layer: Option<Layer>,
rotation: Option<f64>,
justification: Option<PcbTextJustification>,
) -> Result<usize>
pub fn add_text_positioned( &mut self, text: &str, position: &Position, height: Coord, layer: Option<Layer>, rotation: Option<f64>, justification: Option<PcbTextJustification>, ) -> Result<usize>
Add text using Position specification.
Sourcepub fn add_region(
&mut self,
vertices: &[CoordPoint],
layer: Layer,
is_keepout: bool,
net: Option<&str>,
) -> Result<usize>
pub fn add_region( &mut self, vertices: &[CoordPoint], layer: Layer, is_keepout: bool, net: Option<&str>, ) -> Result<usize>
Add a region (copper area or keepout).
Sourcepub fn add_rectangular_region(
&mut self,
corner1: CoordPoint,
corner2: CoordPoint,
layer: Layer,
is_keepout: bool,
net: Option<&str>,
) -> Result<usize>
pub fn add_rectangular_region( &mut self, corner1: CoordPoint, corner2: CoordPoint, layer: Layer, is_keepout: bool, net: Option<&str>, ) -> Result<usize>
Add a rectangular region.
Sourcepub fn add_polygon(
&mut self,
vertices: &[CoordPoint],
layer: Layer,
net_name: &str,
hatch_style: HatchStyle,
pour_over_same_net: bool,
remove_dead_copper: bool,
) -> Result<usize>
pub fn add_polygon( &mut self, vertices: &[CoordPoint], layer: Layer, net_name: &str, hatch_style: HatchStyle, pour_over_same_net: bool, remove_dead_copper: bool, ) -> Result<usize>
Add a polygon (copper pour).
Sourcepub fn add_rectangular_polygon(
&mut self,
corner1: CoordPoint,
corner2: CoordPoint,
layer: Layer,
net_name: &str,
hatch_style: HatchStyle,
) -> Result<usize>
pub fn add_rectangular_polygon( &mut self, corner1: CoordPoint, corner2: CoordPoint, layer: Layer, net_name: &str, hatch_style: HatchStyle, ) -> Result<usize>
Add a rectangular copper pour.
Sourcepub fn delete_primitive(&mut self, index: usize) -> Result<()>
pub fn delete_primitive(&mut self, index: usize) -> Result<()>
Delete a primitive by index.
Sourcepub fn delete_primitives_where<F>(&mut self, filter: F) -> Result<usize>
pub fn delete_primitives_where<F>(&mut self, filter: F) -> Result<usize>
Delete all primitives matching a filter.
Sourcepub fn delete_tracks_on_layer(&mut self, layer: Layer) -> Result<usize>
pub fn delete_tracks_on_layer(&mut self, layer: Layer) -> Result<usize>
Delete all tracks on a layer.
Sourcepub fn delete_all_vias(&mut self) -> Result<usize>
pub fn delete_all_vias(&mut self) -> Result<usize>
Delete all vias.
Sourcepub fn ensure_net_exists(&mut self, net_name: &str)
pub fn ensure_net_exists(&mut self, net_name: &str)
Ensure a net exists in the document.
Sourcepub fn polygons(&self) -> impl Iterator<Item = (usize, &PcbPolygon)>
pub fn polygons(&self) -> impl Iterator<Item = (usize, &PcbPolygon)>
Get all polygons.
Sourcepub fn tracks_on_layer(
&self,
layer: Layer,
) -> impl Iterator<Item = (usize, &PcbTrack)>
pub fn tracks_on_layer( &self, layer: Layer, ) -> impl Iterator<Item = (usize, &PcbTrack)>
Get tracks on a specific layer.
Sourcepub fn count_primitives(&self) -> PrimitiveCount
pub fn count_primitives(&self) -> PrimitiveCount
Count primitives by type.
Sourcepub fn clear_history(&mut self)
pub fn clear_history(&mut self)
Clear all history.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PcbEditSession
impl RefUnwindSafe for PcbEditSession
impl Send for PcbEditSession
impl Sync for PcbEditSession
impl Unpin for PcbEditSession
impl UnwindSafe for PcbEditSession
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more