rhino3dm.Line

class rhino3dm.Line
class Line(from_: Point3d, to: Point3d)
class Line(start: Point3d, span: Vector3d)
class Line(start: Point3d, direction: Vector3d, length: float)
class Line(x0: float, y0: float, z0: float, x1: float, y1: float, z1: float)

Represents the value of start and end points in a single line segment.

ClosestParameter(testPoint: Point3d) → float

Finds the parameter on the infinite line segment that is closest to a test point.

Parameters:

testPoint – Point to project onto the line.

Returns:

The parameter on the line that is closest to testPoint.

ClosestPoint(testPoint: Point3d, limitToFiniteSegment: bool) → Point3d

Finds the point on the (in)finite line segment that is closest to a test point.

Parameters:
  • testPoint – Point to project onto the line.

  • limitToFiniteSegment – If true, the projection is limited to the finite line segment.

Returns:

The point on the (in)finite line that is closest to testPoint.

DistanceTo(testPoint: Point3d, limitToFiniteSegment: bool) → float

Compute the shortest distance between this line segment and a test point.

Parameters:
  • testPoint – Point for distance computation.

  • limitToFiniteSegment – If true, the distance is limited to the finite line segment.

Returns:

The shortest distance between this line segment and testPoint.

EpsilonEquals(other: Line, epsilon: float) → bool

Check that all values in other are within epsilon of the values in this

Equals(other: Line) → bool

Determines whether a line has the same value as this line.

Parameters:

other – A line.

Returns:

true if other has the same coordinates as this; otherwise false.

Extend(startLength: float, endLength: float) → bool

Extend the line by custom distances on both sides.

Parameters:
  • startLength – Distance to extend the line at the start point. Positive distance result in longer lines.

  • endLength – Distance to extend the line at the end point. Positive distance result in longer lines.

Returns:

true on success, false on failure.

ExtendThroughBox(box: BoundingBox) → bool
ExtendThroughBox(box: BoundingBox, additionalLength: float) → bool
ExtendThroughBox(box: Box) → bool
ExtendThroughBox(box: Box, additionalLength: float) → bool

Ensure the line extends all the way through a box. Note, this does not result in the shortest possible line that overlaps the box.

Parameters:
  • box – Box to extend through.

  • additionalLength – Additional length to append at both sides of the line.

Returns:

true on success, false on failure.

Flip() → None

Flip the endpoints of the line segment.

MaximumDistanceTo(testPoint: Point3d) → float
MaximumDistanceTo(testLine: Line) → float

Finds the largest distance between this line as a finite segment and another finite segment.

Parameters:

testLine – A line to test.

Returns:

The maximum distance.

MinimumDistanceTo(testPoint: Point3d) → float
MinimumDistanceTo(testLine: Line) → float

Finds the shortest distance between this line as a finite segment and another finite segment.

Parameters:

testLine – A line to test.

Returns:

The minimum distance.

PointAt(t: float) → Point3d

Evaluates the line at the specified parameter.

Parameters:

t – Parameter to evaluate line segment at. Line parameters are normalized parameters.

Returns:

The point at the specified parameter.

PointAtLength(distance: float) → Point3d

Computes a point located at a specific metric distance from the line origin (From).

If line start and end coincide, then the start point is always returned.

Parameters:

distance – A positive, 0, or a negative value that will be the distance from From.

Returns:

The newly found point.

ToString() → str

Constructs the string representation of this line, in the form “From,To”.

Returns:

A text string.

Transform(xform: Transform) → bool

Transform the line using a Transformation matrix.

Parameters:

xform – Transform to apply to this line.

Returns:

true on success, false on failure.

TryGetPlane() → tuple[bool, Plane]

Gets a plane that contains the line. The origin of the plane is at the start of the line. If possible, a plane parallel to the world XY, YZ, or ZX plane is returned.

Returns:

true on success.

property BoundingBox: BoundingBox

Gets the line’s 3d axis aligned bounding box.

property Direction: Vector3d

Gets the direction of this line segment. The length of the direction vector equals the length of the line segment.

property From: Point3d

Start point of line segment.

property FromX: float

Gets or sets the X coordinate of the line From point.

property FromY: float

Gets or sets the Y coordinate of the line From point.

property FromZ: float

Gets or sets the Z coordinate of the line From point.

property IsValid: bool

Gets a value indicating whether or not this line is valid. Valid lines must have valid start and end points, and the points must not be equal.

property Length: float

Gets or sets the length of this line segment. Note that a negative length will invert the line segment without making the actual length negative. The line From point will remain fixed when a new Length is set.

property To: Point3d

End point of line segment.

property ToX: float

Gets or sets the X coordinate of the line To point.

property ToY: float

Gets or sets the Y coordinate of the line To point.

property ToZ: float

Gets or sets the Z coordinate of the line To point.

property UnitTangent: Vector3d

Gets the tangent of the line segment. Note that tangent vectors are always unit vectors.

Sets only the direction of the line, the length is maintained.

Unset: Line = Ellipsis

object, /) -> Line

Type:

(arg