Polyline#
- class cegalprizm.pythontool.Polyline(polyline_set: cegalprizm.pythontool.polylines.PolylineSet, polyline_index: int)#
Represents a single polyline in a
cegalprizm.pythontool.PolylineSet
object.It is an iterable, returning
cegalprizm.pythontool.PolylinePoint
objects.Functions
__init__
(polyline_set, polyline_index)add_point
(point)Adds a point
delete_point
(point)Deletes a point
Returns a tuple([x], [y], [z]), where x is a list of x positions, y is a list of y positions and z is a list of z positions
Properties
A property to check if the polyline closed or open?
'parent_polylineset' has been removed.
A list of the
cegalprizm.pythontool.PolylinePoint
objects making up the polylineReturns the parent 'PolylineSet' of the 'Polyline'
The readonly status of the parent PolylineSet
- add_point(point: cegalprizm.pythontool.primitives.Point) None #
Adds a point
Adds a single point in displayed world co-ordinates to the polyline. Using this method multiple times will be slower than building up a list of
primitives.Point
objects and assigning it to thepoints()
property in one go.Example:
# slower mypolyline.add_point(primitives.Point(100.0, 123.0, 50.3)) mypolyline.add_point(primitives.Point(102.0, 125.3, 50.2)) # faster new_polylinepoints = [primitives.Point(100.0, 123.0, 50.3), primitives.Point(102.0, 125.3, 50.2)] mypolyline.points = new_polylinepoints
- Parameters
point (primitives.Point) – the point to add
- delete_point(point: cegalprizm.pythontool.polylines.PolylinePoint) None #
Deletes a point
Deletes one point from the polyline. Using this method multiple times will be slower than manipulating a list of
cegalprizm.pythontool.PolylinePoint
objects and assigning it to thepoints()
property in one go.Note that
cegalprizm.pythontool.PolylinePoint
objects are compared by reference, not value. In order to delete a point you must refer to the actual PolylinePoint object you wish to delete:Example:
# set up the PointSet new_polylinepoints = [PolylinePoint(100.0, 123.0, 50.3), PolylinePoint(102.0, 125.3, 50.2)] mypolyline.points = new_polylinepoints # delete the second point in a Polyline # mypolyline.delete_point(PolylinePoint(102.0, 125.3, 50.2)) will not work p = mypolyline.points[1] # the 2nd point mypolyline.delete_point(p)
- Parameters
point (cegalprizm.pythontool.PolylinePoint) – the point to delete
- positions() Tuple[List[float], List[float], List[float]] #
Returns a tuple([x], [y], [z]), where x is a list of x positions, y is a list of y positions and z is a list of z positions
- property closed: bool#
A property to check if the polyline closed or open?
- Returns
True if the polyline is closed, False if open
- property parent_polylineset: None#
‘parent_polylineset’ has been removed. Use ‘polylineset’ instead
- Type
DeprecationWarning
- property points: List[Union[cegalprizm.pythontool.polylines.PolylinePoint, cegalprizm.pythontool.primitives.Point]]#
A list of the
cegalprizm.pythontool.PolylinePoint
objects making up the polyline
- property polylineset: cegalprizm.pythontool.polylines.PolylineSet#
Returns the parent ‘PolylineSet’ of the ‘Polyline’
- property readonly: bool#
The readonly status of the parent PolylineSet
- Returns
True if the parent PolylineSet is readonly
- Return type
bool