lc_plugin::entity contains read-only wrappers for geometry, layers, and cells passed to export plugins. Writer entity callbacks receive these types when WriterController::render_cell() or WriterController::render_cell_in_layer_order() renders drawing content.
The Python database API exposes equivalent geometry objects in linkcad.v1.db, with additional direct database creation and mutation methods for scripting.
Purpose
Entity wrappers provide safe, typed access to host-owned drawing objects during export. They are lightweight views over native LinkCAD objects. Plugin code should read values from them and write output data; it should not store them beyond the callback that provided them.
Geometry Types
Polygon
Method
Description
vertex_count() -> usize
Number of polygon vertices.
vertices() -> Vec<Point>
Polygon vertices in database units.
is_box() -> bool
Whether the polygon is a rectangular box.
has_bulges() -> bool
Whether any edge has a bulge value.
bulges() -> Vec<f64>
Per-edge bulge values, or an empty vector.
layer() -> Layer
Owning layer.
Polyline
Method
Description
vertex_count() -> usize
Number of path vertices.
vertices() -> Vec<Point>
Path vertices in database units.
width() -> Coord
Path width.
is_closed() -> bool
Whether the path is closed.
layer() -> Layer
Owning layer.
Arc
Method
Description
center() -> Point
Arc center.
radius() -> Coord
Radius.
width() -> Coord
Stroke width.
start_angle() -> Angle
Start angle.
end_angle() -> Angle
End angle.
layer() -> Layer
Owning layer.
Ellipse
Method
Description
center() -> Point
Center point.
diameter() -> Coord
Diameter.
layer() -> Layer
Owning layer.
Donut
Method
Description
center() -> Point
Center point.
mean_diameter() -> Coord
Mean diameter of the annulus.
width() -> Coord
Ring width.
layer() -> Layer
Owning layer.
Text
Method
Description
position() -> Point
Text position.
height() -> f64
Text height.
width_factor() -> f64
Horizontal scale factor.
text() -> String
Text content.
font() -> String
Font name.
rotation() -> Angle
Text rotation.
mirrored_in_x() -> bool
Whether text is mirrored in X.
mirrored_in_y() -> bool
Whether text is mirrored in Y.
layer() -> Layer
Owning layer.
real_property(name: &str) -> Option<f64>
Read a real-valued text property.
bool_property(name: &str) -> Option<bool>
Read a boolean text property.
Nurbs
Method
Description
degree() -> i32
Curve degree.
width() -> Coord
Stroke width.
knots() -> Vec<f64>
Knot vector.
ctrl_points() -> Vec<Point>
Control points.
is_rational() -> bool
Whether weights are present.
weights() -> Vec<f64>
Weight vector, or an empty vector for non-rational curves.
is_periodic() -> bool
Whether the curve is periodic.
layer() -> Layer
Owning layer.
Ref
Method
Description
cell_name() -> String
Referenced cell name.
transformation() -> Xform
Reference transform.
columns() -> i32
Reference-array column count.
rows() -> i32
Reference-array row count.
column_spacing() -> Coord
Reference-array column spacing.
row_spacing() -> Coord
Reference-array row spacing.
layer() -> Layer
Owning layer.
Layer and Cell Types
Layer
Method
Description
name() -> String
Layer name.
color() -> Color
Display color.
enabled() -> bool
Whether the layer is enabled.
Layer properties that require drawing context, such as polarity group, comment, and export number, are available on WriterController.
// Write vertices and layer_name to the output format.
let_= (vertices, layer_name, fill_rule);
true
}
}
Units and Geometry Primitives
Entity methods return lc_types values such as Point, Angle, Color, Xform, Coord, and Resolution. Coordinates and distances are in LinkCAD database units; convert file-format units at the import/export boundary.