pub struct GerberLayerData {
pub layer_type: LayerType,
pub coordinate_format: CoordinateFormat,
pub commands: Vec<Command>,
pub macros: HashMap<String, Vec<MacroContent>>,
pub apertures: HashMap<i32, Aperture>,
/* private fields */
}Expand description
A parsed RS-274X (Extended Gerber) layer, split into its logical components.
Constructed via GerberLayerData::from_type, GerberLayerData::from_commands,
or GerberLayerData::empty. Written back with GerberLayerData::write_to.
The internal unit is always millimetres; GerberLayerData::to_unit performs
conversion if the source file uses inches.
Fields§
§layer_type: LayerTypeLogical role of this layer (copper top, silkscreen bottom, …).
coordinate_format: CoordinateFormatInteger/decimal digit counts used to encode coordinates in the file.
commands: Vec<Command>Draw commands stripped of header/footer boilerplate.
macros: HashMap<String, Vec<MacroContent>>Aperture macros keyed by name.
apertures: HashMap<i32, Aperture>Aperture definitions keyed by D-code number.
Implementations§
Source§impl GerberLayerData
impl GerberLayerData
Sourcepub fn new(ty: LayerType, data: GerberDoc) -> Result<Self, ParseError>
pub fn new(ty: LayerType, data: GerberDoc) -> Result<Self, ParseError>
Creates a new layer from already loaded gerber doc and its layer type
Sourcepub fn from_type<R>(
ty: LayerType,
reader: BufReader<R>,
) -> Result<Self, ParseError>where
R: Read,
pub fn from_type<R>(
ty: LayerType,
reader: BufReader<R>,
) -> Result<Self, ParseError>where
R: Read,
Parses GerberLayer from reader with given type
Sourcepub fn from_commands<R>(reader: BufReader<R>) -> Result<Self, ParseError>where
R: Read,
pub fn from_commands<R>(reader: BufReader<R>) -> Result<Self, ParseError>where
R: Read,
Parses GerberLayer from reader, type will load from FileAttribute
Trait Implementations§
Source§impl Clone for GerberLayerData
impl Clone for GerberLayerData
Source§fn clone(&self) -> GerberLayerData
fn clone(&self) -> GerberLayerData
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GerberLayerData
impl Debug for GerberLayerData
Source§impl From<GerberLayerData> for Board
impl From<GerberLayerData> for Board
Source§fn from(data: GerberLayerData) -> Self
fn from(data: GerberLayerData) -> Self
Creates a board containing a single Gerber layer.
Source§impl From<GerberLayerData> for Layer
impl From<GerberLayerData> for Layer
Source§fn from(data: GerberLayerData) -> Self
fn from(data: GerberLayerData) -> Self
Wraps a GerberLayerData in a Layer.
The name is set to the default file extension for the layer type
(e.g. "gto" for SilkScreenTop). Override layer.name afterwards
if a specific filename is needed.