Skip to content

pytha.create_polyline

fabian-flassig edited this page May 28, 2026 · 18 revisions

Creates a polyline or chain of edges in PYTHA as new part.

Similar to the Edges -> Polyline function in the PYTHA user interface.

Note: If the polyline contains arcs, use the create_polyline_ex function instead.

pytha.create_polyline(type, points [,origin [,options]]]) 
Parameter Type Description
type string "open" or "closed" indicates whether the polyline is closed.
points {{u,v [,w]}, ...} Coordinates of the points. Note: for a closed poyline, do not supply the initial point twice. Closing is automatic
origin {x,y,z} Optional: offset for the whole polyline
options {...} Optional: a table that may contain the following options:
options.u_axis {x,y,z} Local coordinate u-axis for the orientation of the plane
options.v_axis {x,y,z} Local coordinate v-axis for the orientation of the plane
options.w_axis {x,y,z} Local coordinate w-axis for the orientation of the plane-normal

Return value

Type Description
element_handle An element handle of the newly created part

Example:

Open polyline (zig-zag) in the xy-plane:

local zigzag = pytha.create_polyline("open", {
    {0, 0},
    {1, 1},
    {2, 0},
    {3, 1},
})

Closed triangle outline (note: the first point is not repeated):

local triangle = pytha.create_polyline("closed", {
    {0, 0},
    {1, 0},
    {0.5, 1},
})

See also:

pytha, element handles, Axes and directions, create_polyline_ex, create_polygon

Clone this wiki locally