Skip to main content

EntityKind

Enum EntityKind 

Source
#[non_exhaustive]
pub enum EntityKind {
Show 20 variants Point { position: Point3, }, Line { start: Point3, end: Point3, }, Polyline { vertices: Vec<Vertex>, closed: bool, normal: Vec3, }, Circle { center: Point3, radius: f64, normal: Vec3, }, Arc { center: Point3, radius: f64, start_angle: f64, end_angle: f64, normal: Vec3, }, Ellipse { center: Point3, major_axis: Vec3, ratio: f64, start_param: f64, end_param: f64, normal: Vec3, }, Spline { degree: u32, knots: Vec<f64>, control_points: Vec<Point3>, weights: Vec<f64>, fit_points: Vec<Point3>, closed: bool, }, Text { position: Point3, end_point: Option<Point3>, height: f64, rotation: f64, width_factor: f64, oblique: f64, value: String, style: Option<String>, halign: HAlign, valign: VAlign, normal: Vec3, }, MText { position: Point3, height: f64, width: f64, rotation: f64, value: String, plain: String, style: Option<String>, attachment: Attachment, line_spacing: f64, normal: Vec3, }, Insert { block: String, position: Point3, scale: Vec3, rotation: f64, normal: Vec3, columns: u32, rows: u32, column_spacing: f64, row_spacing: f64, }, Hatch { loops: Vec<HatchLoop>, solid: bool, pattern: Option<String>, pattern_scale: f64, pattern_angle: f64, normal: Vec3, }, Dimension { dimension_type: DimensionType, points: Vec<Point3>, text_position: Option<Point3>, measurement: Option<f64>, text: Option<String>, block: Option<String>, style: Option<String>, }, Face { points: Vec<Point3>, filled: bool, }, Polygon { exterior: Vec<Point3>, interiors: Vec<Vec<Point3>>, }, Leader { vertices: Vec<Point3>, arrowhead: bool, }, Image { path: Option<String>, position: Point3, u_vector: Vec3, v_vector: Vec3, size_px: Option<[u32; 2]>, }, Viewport { center: Point3, width: f64, height: f64, view_center: Point3, view_height: f64, }, Mesh { vertices: Vec<Point3>, faces: Vec<Vec<u32>>, }, Group { group_kind: GroupKind, name: Option<String>, origin: Option<Point3>, children: Vec<Entity>, }, Unknown { type_name: String, },
}
Expand description

Geometry and type-specific data of an Entity.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Point

A point.

Fields

§position: Point3

Location.

§

Line

A straight segment.

Fields

§start: Point3

Start point.

§end: Point3

End point.

§

Polyline

Connected segments, optionally with arc segments (bulge) and widths. Covers DWG LWPOLYLINE/POLYLINE and DGN line string / shape.

Fields

§vertices: Vec<Vertex>

Vertices in order.

§closed: bool

Last vertex connects back to the first.

§normal: Vec3

Plane normal; bulge arcs turn counter-clockwise about it. +Z for plain 2D data and for non-planar 3D polylines (which have no bulges).

§

Circle

A full circle.

Fields

§center: Point3

Center.

§radius: f64

Radius.

§normal: Vec3

Plane normal.

§

Arc

A circular arc from start_angle counter-clockwise to end_angle.

Fields

§center: Point3

Center.

§radius: f64

Radius.

§start_angle: f64

Start angle in radians.

§end_angle: f64

End angle in radians.

§normal: Vec3

Plane normal.

§

Ellipse

An ellipse or elliptical arc.

Fields

§center: Point3

Center.

§major_axis: Vec3

Vector from the center to the end of the major axis (its length is the semi-major axis).

§ratio: f64

Minor / major axis ratio, in (0, 1].

§start_param: f64

Start parameter in radians (0 for a full ellipse).

§end_param: f64

End parameter in radians (2π for a full ellipse).

§normal: Vec3

Plane normal.

§

Spline

A B-spline / NURBS curve.

Fields

§degree: u32

Degree.

§knots: Vec<f64>

Knot vector (may be empty when only fit points are known).

§control_points: Vec<Point3>

Control points.

§weights: Vec<f64>

Weights; empty for non-rational curves.

§fit_points: Vec<Point3>

Fit points, if stored.

§closed: bool

Curve is closed / periodic.

§

Text

Single-line text.

Fields

§position: Point3

Anchor point implied by halign/valign: the baseline start for left/baseline text, otherwise the justification point (DXF/DWG second alignment point, group 11). For Aligned/Fit text: the baseline start.

§end_point: Option<Point3>

Baseline end for Aligned/Fit text; None for every other alignment.

§height: f64

Character height.

§rotation: f64

Rotation in radians.

§width_factor: f64

Width factor (1.0 = normal).

§oblique: f64

Oblique angle in radians.

§value: String

Decoded text.

§style: Option<String>

Text style name.

§halign: HAlign

Horizontal alignment.

§valign: VAlign

Vertical alignment.

§normal: Vec3

Plane normal.

§

MText

Multi-line, formatted text. DGN text nodes map to this when they only hold text.

Fields

§position: Point3

Insertion point.

§height: f64

Character height.

§width: f64

Reference rectangle width, 0 when unconstrained.

§rotation: f64

Rotation in radians.

§value: String

Text including format codes as stored.

§plain: String

Text with format codes removed, lines separated by \n.

§style: Option<String>

Text style name.

§attachment: Attachment

Attachment point.

§line_spacing: f64

Line spacing factor.

§normal: Vec3

Plane normal.

§

Insert

A placed block (DWG INSERT, DGN shared cell instance). Attribute values live in Entity::attributes.

Fields

§block: String

Block name.

§position: Point3

Insertion point.

§scale: Vec3

Scale factors.

§rotation: f64

Rotation in radians.

§normal: Vec3

Plane normal.

§columns: u32

Array columns (1 = no array).

§rows: u32

Array rows (1 = no array).

§column_spacing: f64

Column spacing.

§row_spacing: f64

Row spacing.

§

Hatch

A filled or patterned area.

Fields

§loops: Vec<HatchLoop>

Boundary loops; the first is usually the outer one.

§solid: bool

Solid fill.

§pattern: Option<String>

Pattern name, if patterned.

§pattern_scale: f64

Pattern scale.

§pattern_angle: f64

Pattern angle in radians.

§normal: Vec3

Plane normal.

§

Dimension

A dimension annotation.

Fields

§dimension_type: DimensionType

Kind of dimension.

§points: Vec<Point3>

Definition points in format order (see props for their roles).

§text_position: Option<Point3>

Text middle point.

§measurement: Option<f64>

Measured value in drawing units (or radians for angular).

§text: Option<String>

Text override.

§block: Option<String>

Anonymous block holding the rendered dimension, if any.

§style: Option<String>

Dimension style name.

§

Face

A planar 3- or 4-sided face (DWG SOLID/TRACE/3DFACE).

Fields

§points: Vec<Point3>

Corner points (3 or 4).

§filled: bool

The face is filled (SOLID/TRACE) rather than a wire face.

§

Polygon

A planar surface with optional holes, in world coordinates (WCS) and drawing units. Each ring is explicitly closed by repeating its first point as its last point.

Fields

§exterior: Vec<Point3>

Closed outer boundary ring containing at least four positions.

§interiors: Vec<Vec<Point3>>

Closed hole rings inside the exterior boundary.

§

Leader

A leader line.

Fields

§vertices: Vec<Point3>

Vertices from arrow tip to the end.

§arrowhead: bool

Draws an arrowhead at the first vertex.

§

Image

A raster image reference (DWG IMAGE, DGN raster attachment).

Fields

§path: Option<String>

Image file path as stored.

§position: Point3

Lower-left corner.

§u_vector: Vec3

Vector along the image bottom edge, covering the full width.

§v_vector: Vec3

Vector along the image left edge, covering the full height.

§size_px: Option<[u32; 2]>

Pixel size, when known.

§

Viewport

A paper-space viewport.

Fields

§center: Point3

Center on the sheet.

§width: f64

Width on the sheet.

§height: f64

Height on the sheet.

§view_center: Point3

Model-space point shown at the center.

§view_height: f64

Model-space height shown.

§

Mesh

A polygon mesh or polyface.

Fields

§vertices: Vec<Point3>

Vertex positions.

§faces: Vec<Vec<u32>>

Faces as vertex indices (0-based).

§

Group

Entities that belong together: DGN complex chains/shapes, cells, text nodes, groups. Children are in the same coordinate space as the group.

Fields

§group_kind: GroupKind

What kind of grouping this is.

§name: Option<String>

Name (cell name, group name).

§origin: Option<Point3>

Origin (cell origin, text node origin).

§children: Vec<Entity>

Member entities.

§

Unknown

A record the reader recognized but does not model; see props / raw.

Fields

§type_name: String

Native type name or code, e.g. "dgn.type_94" or "dwg.ACAD_TABLE".

Implementations§

Source§

impl EntityKind

Source

pub fn type_name(&self) -> &'static str

Stable lowercase name of the variant (matches the JSON type tag).

Trait Implementations§

Source§

impl Clone for EntityKind

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EntityKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for EntityKind

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for EntityKind

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for EntityKind

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for EntityKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.