Overview
The Polyline primitive represents a connected sequence of line segments in 3D space. It is defined by a series of points and can be either open or closed. When the first and last points coincide, the polyline automatically detects and creates a closed loop. Use Cases:- Creating complex paths and contours
- Defining irregular shapes
- Profile curves for extrusion
- Offset operations for parallel paths
- Closed polygons and open paths
Constructor
- Rust
- TypeScript
Rust Constructor Parameters
Unique identifier for the polyline instance
TypeScript Constructor Parameters
Configuration options for the polyline
Optional unique identifier (auto-generated if not provided)
Array of points defining the polyline path
Polyline color as a hexadecimal number (e.g., 0x00ff00 for green)
Enable thick line rendering using Line2
Line width when fatLines is enabled
Methods
set_config
- Rust
- TypeScript
add_point
- Rust
- TypeScript
add_multiple_points
- Rust
generate_geometry
- Rust
- TypeScript
get_geometry_serialized
- Rust
- TypeScript
get_offset_serialized
- Rust
- TypeScript
Distance to offset the polyline (positive or negative)
Angle threshold for beveling acute corners
Enable beveling at acute angles
is_closed
- Rust
- TypeScript
get_points
- Rust
get_brep_serialized
- Rust
- TypeScript
Properties
Unique identifier for the polyline instance
Array of points defining the polyline path
Whether the polyline forms a closed loop (automatically detected)
Internal BREP representation containing vertices, edges, and optionally a face for closed polylines
Indicates if the polyline is closed (TypeScript property)
Polyline color (TypeScript only, settable)
Code Examples
Creating an Open Polyline
- Rust
- TypeScript
Creating a Closed Polygon
- Rust
- TypeScript
Adding Points Incrementally
- Rust
- TypeScript
Generating Offset Polylines
- Rust
- TypeScript
Using Fat Lines
- TypeScript
Complex Path Example
- TypeScript
Live Demo
Polyline Demo
Try the Polyline primitive in the browser
See Also
Line
Straight line segments
Arc
Circular arc segments
Curve
Smooth curves through control points

