-
Notifications
You must be signed in to change notification settings - Fork 18
pytha.create_polyline_ex
Creates a polyline or a chain of edges.
Similar to the Edges -> Polyline function in the PYTHA user interface.
pytha.create_polyline_ex(type, points [,segments, [,origin [,options]]]) | Parameter | Type | Description |
|---|---|---|
type |
string |
"open" or "closed" indicates whether the polyline is closed |
points |
{{u,v [,w]}, ...} |
Coordinates of the points |
segments |
{segment_1, segment_2, ...} |
Optional: specification of the segments, where each segment may be a table to indicate the following parameters: |
segment.angle |
number |
Angle of the arc, positive for counter-clockwise arcs |
segment.radius |
number |
Radius of the arc (if the radius is given, orientation and select_arc should be used to specify the arc uniquely) |
segment.orientation |
"cw" or "ccw"
|
When radius is specified: clockwise or counter-clockwise orientation |
segment.select_arc |
"small", "large"
|
When radius is specified: selection of the small or large arc with that radius and orientation |
segment.bulge |
number |
Maximum distance between the secant and the arc, positive for counter-clockwise arcs |
segment.normal |
{x,y,z} |
Only relevant for type = "open": Normal direction for the arc |
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 |
| Type | Description |
|---|---|
element_handle |
An element handle of the newly created part |
Entry segments[n] describes the polyline-segment between point points[n] and points[n+1]. For a closed polyline, segments[#points] describes the segment from the last point back to the first. Entries may be omitted (nil or simply absent) for straight segments.
Per segment, exactly one shape specification (angle, radius + (orientation, select_arc), or bulge) should be used; if multiple are present, the first one detected in the order angle, radius, bulge takes precedence.
Closed rounded rectangle in the xy-plane, the four corners specified as 90° arcs by their bulge:
local rounded_rect = pytha.create_polyline_ex(
"closed",
{
{ 0, 10}, { 40, 10}, { 50, 20}, { 50, 30},
{ 40, 40}, { 0, 40}, {-10, 30}, {-10, 20},
},
{
nil, -- straight bottom
{ bulge = 10 }, -- bottom-right corner
nil, -- straight right
{ bulge = 10 }, -- top-right corner
nil, -- straight top
{ bulge = 10 }, -- top-left corner
nil, -- straight left
{ bulge = 10 }, -- bottom-left corner
}
)Open polyline with a single arc segment, defined by radius and arc selection:
local arc_chain = pytha.create_polyline_ex(
"open",
{
{0, 0},
{100, 0},
{100, 50},
},
{
nil,
{ radius = 60, orientation = "ccw", select_arc = "small", segments = 16 },
}
)pytha, element handles, Axes and directions, create_polyline, create_polygon_ex