Skip to content

pygeo.offset_polyline_ex

fabian-flassig edited this page May 21, 2026 · 1 revision

Offsets a polyline chain by a given distance and returns the result with reconstructed arc segments.

This function is located in the pygeo module.

The input chain may consist of line and arc segments; arcs are detected automatically from the input points using PYTHA's 2D analysis settings. The offset operation is carried out in the local plane of the chain. The returned chain has the same shape as the result of pytha.analyze_polyline_ex and is therefore directly compatible with pytha.create_polyline_ex. For a plain point-only result use pygeo.offset_polyline.

pygeo.offset_polyline_ex(chain, offset [,corner_type [,corner_angle]])
Parameter Type Description
chain {type, points} Input chain. type is "open" or "closed". points is {{x,y,z}, ...}. The format matches the return value of pytha.analyze_polyline.
offset number Offset distance. For closed chains the sign is interpreted such that a positive offset moves the contour outward.
corner_type string Optional: "sharp" (default), "rounded", or "chamfer". Controls how convex corners between segments are treated.
corner_angle number Optional: angle threshold in degrees that controls when the corner treatment is applied. Defaults to 0.

Return value

Type Description
chain {type, points, segments}

Where each chain entry contains:

Field Type Description
type string "open" or "closed" indicates whether the chain is closed.
points {{x,y,z}, ...} Coordinates of the chain points. For a closed chain the first point is not repeated at the end.
segments {segment_1, segment_2, ...} Specification of the segments between consecutive points. A line segment is reported as an empty table {}. An arc segment contains the fields below.
segment.r number Radius of the arc.
segment.orientation "cw" or "ccw" Clockwise or counter-clockwise orientation of the arc.
segment.select_arc "small" or "large" Selection of the small or large arc with that radius and orientation.

Notes:

  • Arc segments are detected from the input point sequence using the 2D analysis tolerance and angle settings of PYTHA.
  • The chain is processed in its local plane; the returned points lie in that same plane.
  • The returned segments table is compatible with the segments parameter of pytha.create_polyline_ex, so an offset chain can be round-tripped directly into geometry.
  • This function does not create any PYTHA geometry by itself.

Version Support:

Minimum PYTHA Version: V26

See also:

pygeo, pygeo.offset_polyline, pytha.analyze_polyline_ex, pytha.create_polyline_ex

Clone this wiki locally