Skip to content

pytha.analyze_polyline_ex

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

Analyzes the edges of a part and returns them as one or more polyline chains, reconstructing arcs as arc segments.

This is the inverse operation to create_polyline_ex: the connected edges of the given part are grouped into chains and analyzed in 2D for arc segments. Each chain is reported as either "open" or "closed" together with its points and segment specifications.

pytha.analyze_polyline_ex(element)
Parameter Type Description
element element_handle Element handle of a part whose edges shall be analyzed.

Return value

Type Description
chains A table of chains. Each entry has the form {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. The arc analysis is carried out in the local u/w plane, so the returned points lie in that plane (v = 0).
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:

  • The arc detection uses PYTHA's 2D analysis tolerance and angle settings.
  • The segments table is compatible with the segments parameter of create_polyline_ex, so a chain can be round-tripped between analysis and creation.
  • For a closed chain, the first point is not duplicated as the last point.

Version Support:

Minimum PYTHA Version: V27

See also:

pytha, element handles, analyze_polyline, create_polyline_ex, create_polyline

Clone this wiki locally