pub struct EditSession {
pub doc: SchDoc,
/* private fields */
}Expand description
An editing session for a schematic document.
Fields§
§doc: SchDocThe schematic document being edited.
Implementations§
Source§impl EditSession
impl EditSession
Sourcepub fn open<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn open<P: AsRef<Path>>(path: P) -> Result<Self>
Open an existing schematic file for editing.
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 layout(&self) -> &LayoutEngine
pub fn layout(&self) -> &LayoutEngine
Get the layout engine.
Sourcepub fn layout_mut(&mut self) -> &mut LayoutEngine
pub fn layout_mut(&mut self) -> &mut LayoutEngine
Get mutable access to the layout engine.
Sourcepub fn library(&self) -> &LibraryManager
pub fn library(&self) -> &LibraryManager
Get the library manager.
Sourcepub fn library_mut(&mut self) -> &mut LibraryManager
pub fn library_mut(&mut self) -> &mut LibraryManager
Get mutable access to the library manager.
Sourcepub fn load_library<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
pub fn load_library<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
Load a SchLib library file.
Sourcepub fn add_component(
&mut self,
lib_reference: &str,
location: CoordPoint,
orientation: Orientation,
designator: Option<&str>,
) -> Result<usize>
pub fn add_component( &mut self, lib_reference: &str, location: CoordPoint, orientation: Orientation, designator: Option<&str>, ) -> Result<usize>
Add a component from a loaded library.
Sourcepub fn suggest_component_placement(
&self,
lib_reference: &str,
near_component: Option<&str>,
) -> Vec<PlacementSuggestion>
pub fn suggest_component_placement( &self, lib_reference: &str, near_component: Option<&str>, ) -> Vec<PlacementSuggestion>
Find the best position for a new component.
Sourcepub fn move_component(
&mut self,
index: usize,
new_location: CoordPoint,
) -> Result<()>
pub fn move_component( &mut self, index: usize, new_location: CoordPoint, ) -> Result<()>
Move a component to a new location.
Sourcepub fn delete_component(&mut self, index: usize) -> Result<()>
pub fn delete_component(&mut self, index: usize) -> Result<()>
Delete a component and all its child primitives.
Sourcepub fn add_wire(&mut self, vertices: &[CoordPoint]) -> Result<usize>
pub fn add_wire(&mut self, vertices: &[CoordPoint]) -> Result<usize>
Add a wire with specified vertices.
Sourcepub fn route_wire(
&mut self,
start: CoordPoint,
end: CoordPoint,
) -> Result<usize>
pub fn route_wire( &mut self, start: CoordPoint, end: CoordPoint, ) -> Result<usize>
Route a wire between two points automatically.
Sourcepub fn connect_pins(
&mut self,
component1: &str,
pin1: &str,
component2: &str,
pin2: &str,
) -> Result<usize>
pub fn connect_pins( &mut self, component1: &str, pin1: &str, component2: &str, pin2: &str, ) -> Result<usize>
Connect two component pins with automatic routing.
Sourcepub fn delete_wire(&mut self, index: usize) -> Result<()>
pub fn delete_wire(&mut self, index: usize) -> Result<()>
Delete a wire by index.
Sourcepub fn add_bus(&mut self, vertices: &[CoordPoint]) -> Result<usize>
pub fn add_bus(&mut self, vertices: &[CoordPoint]) -> Result<usize>
Add a bus with specified vertices.
Sourcepub fn add_bus_entry(
&mut self,
bus_point: CoordPoint,
wire_point: CoordPoint,
) -> Result<usize>
pub fn add_bus_entry( &mut self, bus_point: CoordPoint, wire_point: CoordPoint, ) -> Result<usize>
Add a bus entry connecting a bus to a wire.
bus_point- Point on the bus where the entry connectswire_point- Point where the wire will connect (typically 10 mil offset)
Sourcepub fn find_buses(&self) -> Vec<(usize, &SchBus)>
pub fn find_buses(&self) -> Vec<(usize, &SchBus)>
Find buses in the document.
Sourcepub fn find_bus_at(&self, point: CoordPoint) -> Option<(usize, &SchBus)>
pub fn find_bus_at(&self, point: CoordPoint) -> Option<(usize, &SchBus)>
Find a bus that contains or is near a point.
Sourcepub fn route_to_bus(
&mut self,
wire_start: CoordPoint,
bus_point: CoordPoint,
) -> Result<(usize, usize)>
pub fn route_to_bus( &mut self, wire_start: CoordPoint, bus_point: CoordPoint, ) -> Result<(usize, usize)>
Route a wire to a bus, automatically creating a bus entry.
Creates a bus entry at the nearest point on the bus to the wire endpoint, then routes the wire to the bus entry’s wire-side point.
Sourcepub fn add_net_label(
&mut self,
name: &str,
location: CoordPoint,
) -> Result<usize>
pub fn add_net_label( &mut self, name: &str, location: CoordPoint, ) -> Result<usize>
Add a net label at a location.
Sourcepub fn add_power_port(
&mut self,
net_name: &str,
location: CoordPoint,
style: PowerObjectStyle,
orientation: TextOrientations,
) -> Result<usize>
pub fn add_power_port( &mut self, net_name: &str, location: CoordPoint, style: PowerObjectStyle, orientation: TextOrientations, ) -> Result<usize>
Add a power port at a location.
Sourcepub fn smart_wire_pin(
&mut self,
component: &str,
pin: &str,
net_name: &str,
power_style: Option<PowerObjectStyle>,
wire_length_mils: f64,
) -> Result<(usize, usize)>
pub fn smart_wire_pin( &mut self, component: &str, pin: &str, net_name: &str, power_style: Option<PowerObjectStyle>, wire_length_mils: f64, ) -> Result<(usize, usize)>
Smart-wire a pin: create a wire stub from the pin endpoint and attach a net label or power port.
Returns (wire_index, label_or_power_index).
Sourcepub fn add_junction(&mut self, location: CoordPoint) -> Result<usize>
pub fn add_junction(&mut self, location: CoordPoint) -> Result<usize>
Add a junction at a location.
Sourcepub fn add_port(
&mut self,
name: &str,
location: CoordPoint,
io_type: PortIoType,
) -> Result<usize>
pub fn add_port( &mut self, name: &str, location: CoordPoint, io_type: PortIoType, ) -> Result<usize>
Add a port at a location.
Sourcepub fn build_netlist(&self) -> Netlist
pub fn build_netlist(&self) -> Netlist
Build the netlist for the current document.
Sourcepub fn find_unconnected_pins(&self) -> Vec<(String, String, (i32, i32))>
pub fn find_unconnected_pins(&self) -> Vec<(String, String, (i32, i32))>
Find unconnected pins.
Sourcepub fn find_missing_junctions(&self) -> Vec<(i32, i32)>
pub fn find_missing_junctions(&self) -> Vec<(i32, i32)>
Find missing junctions.
Sourcepub fn add_missing_junctions(&mut self) -> Result<usize>
pub fn add_missing_junctions(&mut self) -> Result<usize>
Add missing junctions automatically.
Sourcepub fn validate(&self) -> Vec<ValidationError>
pub fn validate(&self) -> Vec<ValidationError>
Validate the schematic and return any errors.
Sourcepub fn history_count(&self) -> usize
pub fn history_count(&self) -> usize
Get the number of operations in history.
Sourcepub fn recent_operations(&self, count: usize) -> Vec<String>
pub fn recent_operations(&self, count: usize) -> Vec<String>
Get a summary of recent operations.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EditSession
impl RefUnwindSafe for EditSession
impl Send for EditSession
impl Sync for EditSession
impl Unpin for EditSession
impl UnwindSafe for EditSession
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