dxfscan 0.1.0

Binary DXF parser with typed entity data and lookup indices
Documentation
// SPDX-License-Identifier: ISC
use crate::point::Point3;
use crate::value::GroupValue;

/// A LINE entity.
#[derive(Debug, Clone, Copy, Default)]
pub struct Line {
    /// Start point.
    pub p1: Point3,
    /// End point.
    pub p2: Point3,
    /// Extrusion thickness.
    pub thickness: f64,
}

impl Line {
    pub(crate) fn feed(&mut self, code: u16, val: &GroupValue) {
        if let Some(v) = val.as_f64() {
            match code {
                10 => self.p1.x = v,
                20 => self.p1.y = v,
                30 => self.p1.z = v,
                11 => self.p2.x = v,
                21 => self.p2.y = v,
                31 => self.p2.z = v,
                39 => self.thickness = v,
                _ => {}
            }
        }
    }
}