Skip to main content

Overview

The Line primitive represents a straight line segment in 3D space, defined by a start point and an end point. It is the simplest 2D primitive in OpenGeometry and is suitable for creating linear segments, edges, and simple geometric constructions. Use Cases:
  • Drawing straight line segments
  • Creating basic geometric shapes
  • Defining edges in technical drawings
  • Path offset operations for parallel lines

Constructor

Rust Constructor Parameters

id
String
required
Unique identifier for the line instance

TypeScript Constructor Parameters

options
ILineOptions
Configuration options for the line
options.ogid
string
Optional unique identifier (auto-generated if not provided)
options.start
Vector3
required
Starting point of the line
options.end
Vector3
required
Ending point of the line
options.color
number
required
Line color as a hexadecimal number (e.g., 0x000000 for black)
options.fatLines
boolean
default:"false"
Enable thick line rendering using Line2
options.width
number
default:"20"
Line width when fatLines is enabled

Methods

set_config

Updates the line’s start and end points.

generate_geometry

Generates the BREP (Boundary Representation) geometry for the line, creating vertices and edges.

get_geometry_serialized

Returns serialized vertex buffer data as a JSON string.

get_offset_serialized

Generates an offset path parallel to the line at the specified distance.
distance
number
required
Distance to offset the line (positive or negative)
acuteThresholdDegrees
number
default:"35.0"
Angle threshold for beveling acute corners
bevel
boolean
default:"true"
Enable beveling at acute angles

get_brep_serialized

Returns the complete BREP representation as JSON.

Properties

id
String
Unique identifier for the line instance
start
Vector3
Starting point of the line (Rust only)
end
Vector3
Ending point of the line (Rust only)
brep
Brep
Internal BREP representation containing vertices and edges
color
number
Line color (TypeScript only, settable)

Code Examples

Creating a Basic Line

Generating Offset Lines

Using Fat Lines

Updating Line Configuration

Live Demo

Line Demo

Try the Line primitive in the browser

See Also

Polyline

Connected line segments

Arc

Circular arc segments

Curve

Smooth curves through control points
Last modified on March 14, 2026