inkex.paths package#

Submodules#

Module contents#

Paths module.

Most of the functions derivative, unit_tangent, curvature, point, split, length, ilength for the individual path commands are ported from mathandy/svgpathtools (MIT licensed)

class inkex.paths.Path(path_d=None)[source]#

Bases: list

A list of segment commands which combine to draw a shape

callback: Optional[Callable] = None#
class PathCommandProxy(command: inkex.paths.interfaces.PathCommand, first_point: Union[complex, inkex.transforms.Vector2d], previous_end_point: Union[complex, inkex.transforms.Vector2d], prev2_control_point: Union[complex, inkex.transforms.Vector2d])[source]#

Bases: object

A handy class for Path traverse and coordinate access

Reduces number of arguments in user code compared to bare PathCommand methods

property first_point: inkex.transforms.Vector2d#

First point of the current subpath

property previous_end_point: inkex.transforms.Vector2d#

End point of the previous command

property prev2_control_point: inkex.transforms.Vector2d#

Last control point of the previous command

property name: str#

The full name of the segment (i.e. Line, Arc, etc)

property letter: str#

The single letter representation of this command (i.e. L, A, etc)

property next_command#

The implicit next command.

property is_relative: bool#

Whether the command is defined in relative coordinates, i.e. relative to the previous endpoint (lower case path command letter)

property is_absolute: bool#

Whether the command is defined in absolute coordinates (upper case path command letter)

property args: List[float]#

Returns path command arguments as tuple of floats

property control_points: List[inkex.transforms.Vector2d]#

Returns list of path command control points

property end_point: inkex.transforms.Vector2d#

Returns last control point of path command

property cend_point: complex#

Returns last control point of path command (in complex form)

reverse() inkex.paths.interfaces.PathCommand[source]#

Reverse path command

to_curve() inkex.paths.curves.Curve[source]#

Convert command to Curve Curve().to_curve() returns a copy

to_curves() List[inkex.paths.curves.Curve][source]#

Convert command to list of Curve commands

to_absolute() inkex.paths.interfaces.AbsolutePathCommand[source]#

Return relative counterpart for relative commands or copy for absolute

to_non_shorthand() inkex.paths.interfaces.AbsolutePathCommand[source]#

Returns an absolute non-shorthand command

New in version 1.4.

split(time) Tuple[inkex.paths.path.Path.PathCommandProxy, inkex.paths.path.Path.PathCommandProxy][source]#

Split this path command into two PathCommandProxy segments. Raises ValueError for Move commands.

New in version 1.4.

cpoint(time) complex[source]#

Returns the coordinates of the Bezier curve evaluated at t as complex number.

New in version 1.4.

point(time) inkex.transforms.Vector2d[source]#

Returns the coordinates of the Bezier curve evaluated at t as Vector2d.

New in version 1.4.

length(t0=0, t1=1, settings=LengthSettings()) float[source]#

Get the length of the command between t0 and t1 in user units

New in version 1.4.

ilength(length, settings=ILengthSettings()) float[source]#

Tries to compute the time t at which the path segment has the given length along its trajectory

New in version 1.4.

cunit_tangent(t) complex[source]#

Returns the unit tangent at t as complex number

New in version 1.4.

unit_tangent(t) inkex.transforms.Vector2d[source]#

Returns the unit tangent at t as inkex.Vector2D

New in version 1.4.

classmethod parse_string(path_d)[source]#

Parse a path string and generate segment objects

bounding_box() Optional[inkex.transforms.BoundingBox][source]#

Return bounding box of the Path

append(cmd)[source]#

Append a command to this path.

translate(x, y, inplace=False)[source]#

Move all coords in this path by the given amount

scale(x, y, inplace=False)[source]#

Scale all coords in this path by the given amounts

rotate(deg, center=None, inplace=False)[source]#

Rotate the path around the given point

property control_points: Iterator[inkex.transforms.Vector2d]#

Returns all control points of the Path

property cend_points: Iterator[complex]#

Complex version of end_points

property end_points: Iterator[inkex.transforms.Vector2d]#

Returns all endpoints of all path commands (i.e. the nodes)

transform(transform, inplace=False)[source]#

Convert to new path

reverse()[source]#

Returns a reversed path

break_apart() List[inkex.paths.path.Path][source]#

Breaks apart a path into its subpaths

New in version 1.3.

close()[source]#

Attempt to close the last path segment

proxy_iterator() Iterator[PathCommandProxy][source]#

Yields AugmentedPathIterator

Return type

Iterator[ Path.PathCommandProxy ]

to_absolute()[source]#

Convert this path to use only absolute coordinates

to_non_shorthand() inkex.paths.path.Path[source]#

Convert this path to use only absolute non-shorthand coordinates

New in version 1.1.

_to_absolute(shorthand: bool) inkex.paths.path.Path[source]#

Make entire Path absolute.

Parameters

shorthand (bool) – If false, then convert all shorthand commands to non-shorthand.

Returns

the input path, converted to absolute coordinates.

Return type

Path

to_relative()[source]#

Convert this path to use only relative coordinates

to_arrays()[source]#

Returns path in format of parsePath output, returning arrays of absolute command data

Deprecated since version 1.0: This is compatibility function for older API. Should not be used in new code

to_superpath()[source]#

Convert this path into a cubic super path

copy()[source]#

Make a copy

class inkex.paths.CubicSuperPath(items)[source]#

Bases: list

A conversion of a path into a predictable list of cubic curves which can be operated on as a list of simplified instructions.

When converting back into a path, all lines, arcs etc will be converted to curve instructions.

Structure is held as [SubPath[(point_a, bezier, point_b), …], …]

append_node_with_handles(command: List[Tuple[float, float]])[source]#

First item: left handle, second item: node coords, third item: right handle

append_path_command(command: inkex.paths.interfaces.PathCommand)[source]#

Append a path command.

For ordinary commands:

..code

old last entry -> [[.., ..], [.., ..], [x1, y1]]
new last entry -> [[x2, y2], [x3, y3], [x3, y3]]

The last tuple is duplicated (retracted handle): either it’s the last command of the subpath, then the handle will stay retracted, or it will be replaced with the next path command.

append(item)[source]#

Append a segment/node to the superpath and update the internal state.

item may be specified in any of the following formats:

  • PathCommand

  • [str, List[float]] - A path command letter and its arguments

  • [[float, float], [float, float], [float, float]] - Incoming handle, node,

    outgoing handle.

  • List[[float, float], [float, float], [float, float]] - An entire subpath.

_clean(lst)[source]#

Recursively clean lists so they have the same type

property _first#
to_path(curves_only=False, rtol=1e-5, atol=1e-8)[source]#

Convert the super path back to an svg path

Arguments: see to_segments() for parameters

to_segments(curves_only=False, rtol=1e-5, atol=1e-8)[source]#

Generate a set of segments for this cubic super path

Parameters
transform(transform)[source]#

Apply a transformation matrix to this super path

static is_on(pt_a, pt_b, pt_c, tol=1e-8)[source]#

Checks if point pt_a is on the line between points pt_b and pt_c

New in version 1.2.

static collinear(pt_a, pt_b, pt_c, tol=1e-8)[source]#

Checks if points pt_a, pt_b, pt_c lie on the same line, i.e. that the cross product (b-a) x (c-a) < tol

New in version 1.2.

static within(val_b, val_a, val_c)[source]#

Checks if float val_b is between val_a and val_c

New in version 1.2.

static is_line(previous, segment, rtol=1e-5, atol=1e-8)[source]#

Check whether csp segment (two points) can be expressed as a line has retracted handles or the handles can be retracted without loss of information (i.e. both handles lie on the line)

Changed in version 1.2: Previously, it was only checked if both control points have retracted handles. Now it is also checked if the handles can be retracted without (visible) loss of information (i.e. both handles lie on the line connecting the nodes).

Parameters
class inkex.paths.PathCommand[source]#

Bases: abc.ABC

Base class of all path commands

letter = ''#
nargs = -1#
name = 'PathCommand'#
next_command[source]#

alias of inkex.paths.interfaces.PathCommand

property is_relative: bool#

Whether the command is defined in relative coordinates, i.e. relative to the previous endpoint (lower case path command letter)

property is_absolute: bool#

Whether the command is defined in absolute coordinates (upper case path command letter)

to_relative(prev: Union[complex, inkex.transforms.Vector2d]) inkex.paths.interfaces.RelativePathCommand[source]#

Return absolute counterpart for absolute commands or copy for relative

to_absolute(prev: Union[complex, inkex.transforms.Vector2d]) inkex.paths.interfaces.AbsolutePathCommand[source]#

Return relative counterpart for relative commands or copy for absolute

reverse(first: Union[complex, inkex.transforms.Vector2d], prev: Union[complex, inkex.transforms.Vector2d]) inkex.paths.interfaces.PathCommand[source]#

Reverse path command

New in version 1.1.

to_non_shorthand(prev: Union[complex, inkex.transforms.Vector2d], prev_control: Union[complex, inkex.transforms.Vector2d]) inkex.paths.interfaces.AbsolutePathCommand[source]#

Return an absolute non-shorthand command

New in version 1.1.

number_template = '{:.6g}'#
_letter_to_class: Dict[str, Type[Any]] = {'A': <class 'inkex.paths.arc.Arc'>, 'C': <class 'inkex.paths.curves.Curve'>, 'H': <class 'inkex.paths.lines.Horz'>, 'L': <class 'inkex.paths.lines.Line'>, 'M': <class 'inkex.paths.lines.Move'>, 'Q': <class 'inkex.paths.quadratic.Quadratic'>, 'S': <class 'inkex.paths.curves.Smooth'>, 'T': <class 'inkex.paths.quadratic.TepidQuadratic'>, 'V': <class 'inkex.paths.lines.Vert'>, 'Z': <class 'inkex.paths.lines.ZoneClose'>, 'a': <class 'inkex.paths.arc.arc'>, 'c': <class 'inkex.paths.curves.curve'>, 'h': <class 'inkex.paths.lines.horz'>, 'l': <class 'inkex.paths.lines.line'>, 'm': <class 'inkex.paths.lines.move'>, 'q': <class 'inkex.paths.quadratic.quadratic'>, 's': <class 'inkex.paths.curves.smooth'>, 't': <class 'inkex.paths.quadratic.tepidQuadratic'>, 'v': <class 'inkex.paths.lines.vert'>, 'z': <class 'inkex.paths.lines.zoneClose'>}#
static letter_to_class(letter)[source]#

Returns class for given path command letter

abstract property args: List[float]#

Returns path command arguments as tuple of floats

control_points(first: Union[complex, inkex.transforms.Vector2d], prev: Union[complex, inkex.transforms.Vector2d], prev_prev: Union[complex, inkex.transforms.Vector2d]) Generator[inkex.transforms.Vector2d, None, None][source]#

Returns list of path command control points

abstract ccontrol_points(first: complex, prev: complex, prev_prev: complex) Tuple[complex, ...][source]#

Returns list of path command control points

classmethod _argt(sep)[source]#
abstract cend_point(first: complex, prev: complex) complex[source]#

Complex version of end_point

end_point(first: Union[complex, inkex.transforms.Vector2d], prev: Union[complex, inkex.transforms.Vector2d]) inkex.transforms.Vector2d[source]#

Returns last control point of path command

abstract update_bounding_box(first: complex, last_two_points: List[complex], bbox: inkex.transforms.BoundingBox)[source]#

Enlarges given bbox to contain path element.

Parameters
  • first (complex) – first point of path. Required to calculate Z segment

  • last_two_points (List[complex]) – list with last two control points in abs coords.

  • bbox (BoundingBox) – bounding box to update

to_curve(prev: Union[complex, Vector2d], prev_prev: Union[complex, Vector2d] = 0) inkex.paths.curves.Curve#

Convert command to Curve

Curve().to_curve() returns a copy

to_curves(prev: ComplexLike, prev_prev: ComplexLike = 0) List[Curve][source]#

Convert command to list of Curve commands

to_line(prev: Union[complex, Vector2d]) inkex.paths.lines.Line#

Converts this segment to a line (copies if already a line)

abstract ccurve_points(first: complex, prev: complex, prev_prev: complex) Tuple[complex, ...][source]#

Converts the path element into a single cubic bezier

__check_t(t: Optional[float], allow_none=True)#
cderivative(first: complex, prev: complex, prev_control: complex, t: Optional[float] = None, n: int = 1) complex[source]#

Returns the nth derivative of the segment at t as a complex number.

New in version 1.4.

derivative(first: Union[complex, inkex.transforms.Vector2d], prev: Union[complex, inkex.transforms.Vector2d], prev_control: Union[complex, inkex.transforms.Vector2d], t: Optional[float] = None, n: int = 1) inkex.transforms.Vector2d[source]#

Returns the nth derivative of the segment at t as a Vector2D.

New in version 1.4.

abstract _cderivative(first: complex, prev: complex, prev_control: complex, t: float, n: int = 1) complex[source]#
cunit_tangent(first: complex, prev: complex, prev_control: complex, t: Optional[float] = None) complex[source]#

Returns the unit tangent of the segment at t as a complex number.

..versionadded:: 1.4

unit_tangent(first: Union[complex, inkex.transforms.Vector2d], prev: Union[complex, inkex.transforms.Vector2d], prev_control: Union[complex, inkex.transforms.Vector2d], t: Optional[float] = None) inkex.transforms.Vector2d[source]#

Returns the unit tangent of the segment at t as a Vector2D.

..versionadded:: 1.4

_cunit_tangent(first: complex, prev: complex, prev_control: complex, t: float) complex[source]#
cnormal(first: complex, prev: complex, prev_control: complex, t: Optional[float] = None) complex[source]#

Returns the (right-hand-rule) normal vector of the segment at t as a complex number.

..versionadded:: 1.4

normal(first: Union[complex, inkex.transforms.Vector2d], prev: Union[complex, inkex.transforms.Vector2d], prev_control: Union[complex, inkex.transforms.Vector2d], t: Optional[float] = None) inkex.transforms.Vector2d[source]#

Returns the (right-hand-rule) normal vector of the segment at t as Vector2D.

..versionadded:: 1.4

curvature(first: Union[complex, inkex.transforms.Vector2d], prev: Union[complex, inkex.transforms.Vector2d], prev_control: Union[complex, inkex.transforms.Vector2d], t: Optional[float] = None) float[source]#

Returns the curvature of the segment at t.

..versionadded:: 1.4

abstract _curvature(first: complex, prev: complex, prev_control: complex, t: float) float[source]#
cpoint(first: complex, prev: complex, prev_control: complex, t: float) complex[source]#

Returns the coordinates of the Bezier curve evaluated at t as complex number.

New in version 1.4.

point(first: Union[complex, inkex.transforms.Vector2d], prev: Union[complex, inkex.transforms.Vector2d], prev_control: Union[complex, inkex.transforms.Vector2d], t: float) inkex.transforms.Vector2d[source]#

Returns the coordinates of the Bezier curve evaluated at t as Vector2d.

New in version 1.4.

abstract _cpoint(first: complex, prev: complex, prev_control: complex, t: float) complex[source]#
split(first: Union[complex, inkex.transforms.Vector2d], prev: Union[complex, inkex.transforms.Vector2d], prev_control: Union[complex, inkex.transforms.Vector2d], t: float) Tuple[inkex.paths.interfaces.PathCommand, inkex.paths.interfaces.PathCommand][source]#

Returns two segments, whose union is this segment and which join at self.point(t).

New in version 1.4.

abstract _split(first: complex, prev: complex, prev_control: complex, t: float) Tuple[inkex.paths.interfaces.PathCommand, inkex.paths.interfaces.PathCommand][source]#
length(first: Union[complex, inkex.transforms.Vector2d], prev: Union[complex, inkex.transforms.Vector2d], prev_control: Union[complex, inkex.transforms.Vector2d], t0: float = 0, t1: float = 1, settings=LengthSettings()) float[source]#

Returns the length of the segment between t0 and t1.

New in version 1.4.

abstract _length(first: complex, prev: complex, prev_control: complex, t0: float = 0, t1: float = 1, settings=LengthSettings()) float[source]#
ilength(first: Union[complex, inkex.transforms.Vector2d], prev: Union[complex, inkex.transforms.Vector2d], prev_control: Union[complex, inkex.transforms.Vector2d], length: float, settings: inkex.paths.interfaces.ILengthSettings = ILengthSettings())[source]#

Returns a float t, such that self.length(0, t) is approximately length.

New in version 1.4.

abstract _ilength(first: complex, prev: complex, prev_control: complex, length: float, settings: inkex.paths.interfaces.ILengthSettings = ILengthSettings())[source]#
_abc_impl = <_abc._abc_data object>#
class inkex.paths.AbsolutePathCommand[source]#

Bases: inkex.paths.interfaces.PathCommand

Absolute path command. Unlike RelativePathCommand can be transformed directly.

property is_relative#

Whether the command is defined in relative coordinates, i.e. relative to the previous endpoint (lower case path command letter)

property is_absolute#

Whether the command is defined in absolute coordinates (upper case path command letter)

to_absolute(prev: Union[complex, inkex.transforms.Vector2d]) inkex.paths.interfaces.AbsolutePathCommand[source]#

Return relative counterpart for relative commands or copy for absolute

abstract transform(transform: inkex.transforms.Transform) inkex.paths.interfaces.AbsolutePathCommand[source]#

Returns new transformed segment

Parameters

transform – a transformation to apply

rotate(degrees: float, center: inkex.transforms.Vector2d) inkex.paths.interfaces.AbsolutePathCommand[source]#

Returns new transformed segment

Parameters
  • degrees – rotation angle in degrees

  • center – invariant point of rotation

translate(dr: inkex.transforms.Vector2d) inkex.paths.interfaces.AbsolutePathCommand[source]#

Translate or scale this path command by dr

scale(factor: Union[float, Tuple[float, float]]) inkex.paths.interfaces.AbsolutePathCommand[source]#

Returns new transformed segment

Parameters

factor – scale or (scale_x, scale_y)

_abc_impl = <_abc._abc_data object>#
class inkex.paths.RelativePathCommand[source]#

Bases: inkex.paths.interfaces.PathCommand

Abstract base class for relative path commands.

Implements most of methods of PathCommand through conversion to AbsolutePathCommand

property is_relative#

Whether the command is defined in relative coordinates, i.e. relative to the previous endpoint (lower case path command letter)

property is_absolute#

Whether the command is defined in absolute coordinates (upper case path command letter)

to_relative(prev: Union[complex, inkex.transforms.Vector2d]) inkex.paths.interfaces.RelativePathCommand[source]#

Return absolute counterpart for absolute commands or copy for relative

update_bounding_box(first, last_two_points, bbox)[source]#

Enlarges given bbox to contain path element.

Parameters
  • first (complex) – first point of path. Required to calculate Z segment

  • last_two_points (List[complex]) – list with last two control points in abs coords.

  • bbox (BoundingBox) – bounding box to update

_abc_impl = <_abc._abc_data object>#
class inkex.paths.Line(x: ComplexLike)[source]#
class inkex.paths.Line(x: float, y: float)

Bases: inkex.paths.lines.LineMixin, inkex.paths.interfaces.AbsolutePathCommand

Line segment

letter = 'L'#
nargs = 2#
property x#

x coordinate of the line’s (absolute) end point.

property y#

y coordinate of the line’s (absolute) end point.

property args#

Returns path command arguments as tuple of floats

arg1: complex#

The (absolute) end points of the line.

update_bounding_box(first, last_two_points, bbox)[source]#

Enlarges given bbox to contain path element.

Parameters
  • first (complex) – first point of path. Required to calculate Z segment

  • last_two_points (List[complex]) – list with last two control points in abs coords.

  • bbox (BoundingBox) – bounding box to update

to_relative(prev: ComplexLike) line[source]#

Return absolute counterpart for absolute commands or copy for relative

transform(transform) inkex.paths.lines.Line[source]#

Returns new transformed segment

Parameters

transform – a transformation to apply

cend_point(first: complex, prev: complex) complex[source]#

Complex version of end_point

reverse(first: ComplexLike, prev: ComplexLike) Line[source]#

Reverse path command

New in version 1.1.

_split(first: complex, prev: complex, prev_control: complex, t: float) Tuple[inkex.paths.lines.Line, inkex.paths.lines.Line][source]#
_abc_impl = <_abc._abc_data object>#
class inkex.paths.line(dx: ComplexLike)[source]#
class inkex.paths.line(dx: float, dy: float)

Bases: inkex.paths.lines.LineMixin, inkex.paths.interfaces.RelativePathCommand

Relative line segment

letter = 'l'#
nargs = 2#
property dx#

x coordinate of the line’s (relative) end point.

property dy#

y coordinate of the line’s (relative) end point.

property args#

Returns path command arguments as tuple of floats

arg1: complex#

The (relative) end points of the line.

to_absolute(prev: ComplexLike) Line[source]#

Return relative counterpart for relative commands or copy for absolute

cend_point(first: complex, prev: complex) complex[source]#

Complex version of end_point

reverse(first: ComplexLike, prev: ComplexLike) line[source]#

Reverse path command

New in version 1.1.

to_curve(prev: ComplexLike, prev_prev: Optional[ComplexLike] = 0j) Curve[source]#

Convert command to Curve

Curve().to_curve() returns a copy

_split(first: complex, prev: complex, prev_control: complex, t: float) Tuple[inkex.paths.lines.line, inkex.paths.lines.line][source]#
_abc_impl = <_abc._abc_data object>#
class inkex.paths.Move(x: ComplexLike)[source]#
class inkex.paths.Move(x: float, y: float)

Bases: inkex.paths.lines.MoveMixin, inkex.paths.interfaces.AbsolutePathCommand

Move pen segment without a line

letter = 'M'#
nargs = 2#
next_command#

alias of inkex.paths.lines.Line

property x#

x coordinate of the Moves’s (absolute) end point.

property y#

y coordinate of the Move’s (absolute) end point.

property args#

Returns path command arguments as tuple of floats

arg1: complex#

The (absolute) end points of the Move command

update_bounding_box(first, last_two_points, bbox)[source]#

Enlarges given bbox to contain path element.

Parameters
  • first (complex) – first point of path. Required to calculate Z segment

  • last_two_points (List[complex]) – list with last two control points in abs coords.

  • bbox (BoundingBox) – bounding box to update

ccurve_points(first: complex, prev: complex, prev_prev: complex)[source]#

Converts the path element into a single cubic bezier

ccontrol_points(first: complex, prev: complex, prev_prev: complex) Tuple[complex, ...][source]#

Returns list of path command control points

to_relative(prev: ComplexLike) move[source]#

Return absolute counterpart for absolute commands or copy for relative

transform(transform: inkex.transforms.Transform) inkex.paths.lines.Move[source]#

Returns new transformed segment

Parameters

transform – a transformation to apply

cend_point(first: complex, prev: complex) complex[source]#

Complex version of end_point

to_curve(prev: ComplexLike, prev_prev: Optional[ComplexLike] = 0j) Curve[source]#

Convert command to Curve

Curve().to_curve() returns a copy

reverse(first: ComplexLike, prev: ComplexLike) Move[source]#

Reverse path command

New in version 1.1.

_abc_impl = <_abc._abc_data object>#
class inkex.paths.move(dx: ComplexLike)[source]#
class inkex.paths.move(dx: float, dy: float)

Bases: inkex.paths.lines.MoveMixin, inkex.paths.interfaces.RelativePathCommand

Relative move segment

letter = 'm'#
nargs = 2#
next_command#

alias of inkex.paths.lines.line

property dx#

x coordinate of the moves’s (relative) end point.

property dy#

y coordinate of the move’s (relative) end point.

property args#

Returns path command arguments as tuple of floats

ccurve_points(first: complex, prev: complex, prev_prev: complex)[source]#

Converts the path element into a single cubic bezier

ccontrol_points(first: complex, prev: complex, prev_prev: complex) Tuple[complex, ...][source]#

Returns list of path command control points

cend_point(first: complex, prev: complex) complex[source]#

Complex version of end_point

to_absolute(prev: ComplexLike) Move[source]#

Return relative counterpart for relative commands or copy for absolute

reverse(first: ComplexLike, prev: ComplexLike) move[source]#

Reverse path command

New in version 1.1.

to_curve(prev: ComplexLike, prev_prev: Optional[ComplexLike] = 0j) Curve[source]#

Convert command to Curve

Curve().to_curve() returns a copy

_abc_impl = <_abc._abc_data object>#
class inkex.paths.ZoneClose[source]#

Bases: inkex.paths.lines.LineMixin, inkex.paths.interfaces.AbsolutePathCommand

Close segment to finish a path

letter = 'Z'#
nargs = 0#
next_command#

alias of inkex.paths.lines.Move

property args#

Returns path command arguments as tuple of floats

update_bounding_box(first, last_two_points, bbox)[source]#

Enlarges given bbox to contain path element.

Parameters
  • first (complex) – first point of path. Required to calculate Z segment

  • last_two_points (List[complex]) – list with last two control points in abs coords.

  • bbox (BoundingBox) – bounding box to update

transform(transform: inkex.transforms.Transform) inkex.paths.lines.ZoneClose[source]#

Returns new transformed segment

Parameters

transform – a transformation to apply

to_relative(prev: ComplexLike) zoneClose[source]#

Return absolute counterpart for absolute commands or copy for relative

cend_point(first: complex, prev: complex) complex[source]#

Complex version of end_point

to_curve(prev: ComplexLike, prev_prev: Optional[ComplexLike] = 0j) Curve[source]#

Convert command to Curve

Curve().to_curve() returns a copy

reverse(first: ComplexLike, prev: ComplexLike) Line[source]#

Reverse path command

New in version 1.1.

_split(first: complex, prev: complex, prev_control: complex, t: float) Tuple[inkex.paths.lines.Line, inkex.paths.lines.ZoneClose][source]#
_abc_impl = <_abc._abc_data object>#
class inkex.paths.zoneClose[source]#

Bases: inkex.paths.lines.LineMixin, inkex.paths.interfaces.RelativePathCommand

Same as above (svg says no difference)

letter = 'z'#
nargs = 0#
next_command#

alias of inkex.paths.lines.Move

property args#

Returns path command arguments as tuple of floats

to_absolute(prev: ComplexLike)[source]#

Return relative counterpart for relative commands or copy for absolute

reverse(first: ComplexLike, prev: ComplexLike) line[source]#

Reverse path command

New in version 1.1.

cend_point(first: complex, prev: complex) complex[source]#

Complex version of end_point

to_curve(prev: ComplexLike, prev_prev: Optional[ComplexLike] = 0j) Curve[source]#

Convert command to Curve

Curve().to_curve() returns a copy

_split(first: complex, prev: complex, prev_control: complex, t: float) Tuple[inkex.paths.lines.line, inkex.paths.lines.zoneClose][source]#
_abc_impl = <_abc._abc_data object>#
class inkex.paths.Horz(x)[source]#

Bases: inkex.paths.lines.LineMixin, inkex.paths.interfaces.AbsolutePathCommand

Horizontal Line segment

letter = 'H'#
nargs = 1#
property args#

Returns path command arguments as tuple of floats

update_bounding_box(first, last_two_points, bbox)[source]#

Enlarges given bbox to contain path element.

Parameters
  • first (complex) – first point of path. Required to calculate Z segment

  • last_two_points (List[complex]) – list with last two control points in abs coords.

  • bbox (BoundingBox) – bounding box to update

to_relative(prev: ComplexLike) horz[source]#

Return absolute counterpart for absolute commands or copy for relative

to_non_shorthand(prev: ComplexLike, prev_control: ComplexLike) Line[source]#

Return an absolute non-shorthand command

New in version 1.1.

transform(transform: inkex.transforms.Transform) inkex.paths.interfaces.AbsolutePathCommand[source]#

Returns new transformed segment

Parameters

transform – a transformation to apply

cend_point(first: complex, prev: complex) complex[source]#

Complex version of end_point

reverse(first: ComplexLike, prev: ComplexLike) Horz[source]#

Reverse path command

New in version 1.1.

_split(first: complex, prev: complex, prev_control: complex, t: float) Tuple[inkex.paths.lines.Horz, inkex.paths.lines.Horz][source]#
_abc_impl = <_abc._abc_data object>#
class inkex.paths.horz(dx)[source]#

Bases: inkex.paths.lines.LineMixin, inkex.paths.interfaces.RelativePathCommand

Relative horz line segment

letter = 'h'#
nargs = 1#
property args#

Returns path command arguments as tuple of floats

to_absolute(prev: ComplexLike) Horz[source]#

Return relative counterpart for relative commands or copy for absolute

to_non_shorthand(prev: ComplexLike, prev_control: ComplexLike) Line[source]#

Return an absolute non-shorthand command

New in version 1.1.

cend_point(first: complex, prev: complex) complex[source]#

Complex version of end_point

reverse(first: ComplexLike, prev: ComplexLike) horz[source]#

Reverse path command

New in version 1.1.

_split(first: complex, prev: complex, prev_control: complex, t: float) Tuple[inkex.paths.lines.horz, inkex.paths.lines.horz][source]#
_abc_impl = <_abc._abc_data object>#
class inkex.paths.Vert(y)[source]#

Bases: inkex.paths.lines.LineMixin, inkex.paths.interfaces.AbsolutePathCommand

Vertical Line segment

letter = 'V'#
nargs = 1#
property args#

Returns path command arguments as tuple of floats

_abc_impl = <_abc._abc_data object>#
update_bounding_box(first, last_two_points, bbox)[source]#

Enlarges given bbox to contain path element.

Parameters
  • first (complex) – first point of path. Required to calculate Z segment

  • last_two_points (List[complex]) – list with last two control points in abs coords.

  • bbox (BoundingBox) – bounding box to update

transform(transform: inkex.transforms.Transform) inkex.paths.interfaces.AbsolutePathCommand[source]#

Returns new transformed segment

Parameters

transform – a transformation to apply

to_non_shorthand(prev: ComplexLike, prev_control: ComplexLike) Line[source]#

Return an absolute non-shorthand command

New in version 1.1.

to_relative(prev: ComplexLike) vert[source]#

Return absolute counterpart for absolute commands or copy for relative

cend_point(first: complex, prev: complex) complex[source]#

Complex version of end_point

reverse(first: ComplexLike, prev: ComplexLike) Vert[source]#

Reverse path command

New in version 1.1.

_split(first: complex, prev: complex, prev_control: complex, t: float) Tuple[inkex.paths.lines.Vert, inkex.paths.lines.Vert][source]#
class inkex.paths.vert(dy)[source]#

Bases: inkex.paths.lines.LineMixin, inkex.paths.interfaces.RelativePathCommand

Relative vertical line segment

_abc_impl = <_abc._abc_data object>#
letter = 'v'#
nargs = 1#
property args#

Returns path command arguments as tuple of floats

to_absolute(prev: ComplexLike) Vert[source]#

Return relative counterpart for relative commands or copy for absolute

to_non_shorthand(prev: ComplexLike, prev_control: ComplexLike) Line[source]#

Return an absolute non-shorthand command

New in version 1.1.

cend_point(first: complex, prev: complex) complex[source]#

Complex version of end_point

reverse(first: ComplexLike, prev: ComplexLike) vert[source]#

Reverse path command

New in version 1.1.

_split(first: complex, prev: complex, prev_control: complex, t: float) Tuple[inkex.paths.lines.vert, inkex.paths.lines.vert][source]#
class inkex.paths.Curve(x2: Union[complex, inkex.transforms.Vector2d], x3: Union[complex, inkex.transforms.Vector2d], x4: Union[complex, inkex.transforms.Vector2d])[source]#
class inkex.paths.Curve(x2: float, y2: float, x3: float, y3: float, x4: float, y4: float)

Bases: inkex.paths.curves.CurveMixin, inkex.paths.interfaces.AbsolutePathCommand

Absolute Curved Line segment

letter = 'C'#
nargs = 6#
property x2: float#

x coordinate of the (absolute) first control point

property y2: float#

y coordinate of the (absolute) first control point

property x3: float#

x coordinate of the (absolute) second control point

property y3: float#

y coordinate of the (absolute) second control point

property x4: float#

x coordinate of the (absolute) end point

property y4: float#

y coordinate of the (absolute) end point

property args#

Returns path command arguments as tuple of floats

arg1: complex#

The (absolute) first control point

arg2: complex#

The (absolute) second control point

arg3: complex#

The (absolute) end point

update_bounding_box(first, last_two_points, bbox)[source]#

Enlarges given bbox to contain path element.

Parameters
  • first (complex) – first point of path. Required to calculate Z segment

  • last_two_points (List[complex]) – list with last two control points in abs coords.

  • bbox (BoundingBox) – bounding box to update

transform(transform: inkex.transforms.Transform) inkex.paths.curves.Curve[source]#

Returns new transformed segment

Parameters

transform – a transformation to apply

ccontrol_points(first: complex, prev: complex, prev_prev: complex) Tuple[complex, ...][source]#

Returns list of path command control points

to_relative(prev: Union[complex, inkex.transforms.Vector2d]) inkex.paths.curves.curve[source]#

Return absolute counterpart for absolute commands or copy for relative

cend_point(first: complex, prev: complex) complex[source]#

Complex version of end_point

reverse(first: Union[complex, inkex.transforms.Vector2d], prev: Union[complex, inkex.transforms.Vector2d]) inkex.paths.curves.Curve[source]#

Reverse path command

New in version 1.1.

to_bez()[source]#

Convert to [[c1x, c1y], [c2x, c2y], [end_x, end_y]]

_split(first: complex, prev: complex, prev_control: complex, t: float) Tuple[inkex.paths.curves.Curve, inkex.paths.curves.Curve][source]#
_abc_impl = <_abc._abc_data object>#
class inkex.paths.curve(dx2: Union[complex, inkex.transforms.Vector2d], dx3: Union[complex, inkex.transforms.Vector2d], dx4: Union[complex, inkex.transforms.Vector2d])[source]#
class inkex.paths.curve(dx2: float, dy2: float, dx3: float, dy3: float, dx4: float, dy4: float)

Bases: inkex.paths.curves.CurveMixin, inkex.paths.interfaces.RelativePathCommand

Relative curved line segment

letter = 'c'#
nargs = 6#
property dx2: float#

x coordinate of the (relative) first control point

property dy2: float#

y coordinate of the (relative) first control point

property dx3: float#

x coordinate of the (relative) second control point

property dy3: float#

y coordinate of the (relative) second control point

property dx4: float#

x coordinate of the (relative) end point

property dy4: float#

y coordinate of the (relative) end point

arg1: complex#

The (relative) first control point

arg2: complex#

The (relative) second control point

arg3: complex#

The (relative) end point

property args#

Returns path command arguments as tuple of floats

to_absolute(prev: Union[complex, inkex.transforms.Vector2d]) inkex.paths.curves.Curve[source]#

Return relative counterpart for relative commands or copy for absolute

cend_point(first: complex, prev: complex) complex[source]#

Complex version of end_point

reverse(first: Union[complex, inkex.transforms.Vector2d], prev: Union[complex, inkex.transforms.Vector2d]) inkex.paths.curves.curve[source]#

Reverse path command

New in version 1.1.

ccontrol_points(first: complex, prev: complex, prev_prev: complex) Tuple[complex, ...][source]#

Returns list of path command control points

_split(first: complex, prev: complex, prev_control: complex, t: float) Tuple[inkex.paths.curves.curve, inkex.paths.curves.curve][source]#
_abc_impl = <_abc._abc_data object>#
class inkex.paths.Smooth(x3: Union[complex, inkex.transforms.Vector2d], x4: Union[complex, inkex.transforms.Vector2d])[source]#
class inkex.paths.Smooth(x3: float, y3: float, x4: float, y4: float)

Bases: inkex.paths.curves.CurveMixin, inkex.paths.interfaces.AbsolutePathCommand

Absolute Smoothed Curved Line segment

letter = 'S'#
nargs = 4#
property x3: float#

x coordinate of the (absolute) control point

property y3: float#

y coordinate of the (absolute) control point

property x4: float#

x coordinate of the (absolute) end point

property y4: float#

y coordinate of the (absolute) end point

property args#

Returns path command arguments as tuple of floats

_abc_impl = <_abc._abc_data object>#
arg1: complex#

The (absolute) control point

arg2: complex#

The (absolute) end point

update_bounding_box(first, last_two_points, bbox)[source]#

Enlarges given bbox to contain path element.

Parameters
  • first (complex) – first point of path. Required to calculate Z segment

  • last_two_points (List[complex]) – list with last two control points in abs coords.

  • bbox (BoundingBox) – bounding box to update

ccontrol_points(first: complex, prev: complex, prev_prev: complex) Tuple[complex, ...][source]#

Returns list of path command control points

to_non_shorthand(prev: Union[complex, inkex.transforms.Vector2d], prev_control: Union[complex, inkex.transforms.Vector2d]) inkex.paths.curves.Curve[source]#

Return an absolute non-shorthand command

New in version 1.1.

to_relative(prev: Union[complex, inkex.transforms.Vector2d]) inkex.paths.curves.smooth[source]#

Return absolute counterpart for absolute commands or copy for relative

transform(transform: inkex.transforms.Transform) inkex.paths.curves.Smooth[source]#

Returns new transformed segment

Parameters

transform – a transformation to apply

cend_point(first: complex, prev: complex) complex[source]#

Complex version of end_point

reverse(first: Union[complex, inkex.transforms.Vector2d], prev: Union[complex, inkex.transforms.Vector2d]) inkex.paths.curves.Smooth[source]#

Reverse path command

New in version 1.1.

_split(first: complex, prev: complex, prev_control: complex, t: float) Tuple[inkex.paths.curves.Curve, inkex.paths.curves.Curve][source]#
class inkex.paths.smooth(dx3: Union[complex, inkex.transforms.Vector2d], dx4: Union[complex, inkex.transforms.Vector2d])[source]#
class inkex.paths.smooth(dx3: float, dy3: float, dx4: float, dy4: float)

Bases: inkex.paths.curves.CurveMixin, inkex.paths.interfaces.RelativePathCommand

Relative smoothed curved line segment

_abc_impl = <_abc._abc_data object>#
letter = 's'#
nargs = 4#
property dx3: float#

x coordinate of the (relative) control point

property dy3: float#

y coordinate of the (relative) control point

property dx4: float#

x coordinate of the (relative) end point

property dy4: float#

y coordinate of the (relative) end point

property args#

Returns path command arguments as tuple of floats

arg1: complex#

The (absolute) control point

arg2: complex#

The (absolute) end point

to_absolute(prev: Union[complex, inkex.transforms.Vector2d]) inkex.paths.curves.Smooth[source]#

Return relative counterpart for relative commands or copy for absolute

cend_point(first: complex, prev: complex) complex[source]#

Complex version of end_point

to_non_shorthand(prev: Union[complex, inkex.transforms.Vector2d], prev_control: Union[complex, inkex.transforms.Vector2d]) inkex.paths.curves.Curve[source]#

Return an absolute non-shorthand command

New in version 1.1.

reverse(first: Union[complex, inkex.transforms.Vector2d], prev: Union[complex, inkex.transforms.Vector2d])[source]#

Reverse path command

New in version 1.1.

ccontrol_points(first: complex, prev: complex, prev_prev: complex) Tuple[complex, ...][source]#

Returns list of path command control points

_split(first: complex, prev: complex, prev_control: complex, t: float) Tuple[inkex.paths.curves.curve, inkex.paths.curves.curve][source]#
class inkex.paths.Quadratic(x2: ComplexLike, x3: ComplexLike)[source]#
class inkex.paths.Quadratic(x2: float, y2: float, x3: float, y3: float)

Bases: inkex.paths.quadratic.QuadraticMixin, inkex.paths.interfaces.AbsolutePathCommand

Absolute Quadratic Curved Line segment

letter = 'Q'#
nargs = 4#
property x2: float#

x coordinate of the (absolute) control point

property y2: float#

y coordinate of the (absolute) control point

property x3: float#

x coordinate of the (absolute) end point

property y3: float#

y coordinate of the (absolute) end point

property args#

Returns path command arguments as tuple of floats

arg1: complex#

The (absolute) control point

arg2: complex#

The (absolute) end point

update_bounding_box(first, last_two_points, bbox)[source]#

Enlarges given bbox to contain path element.

Parameters
  • first (complex) – first point of path. Required to calculate Z segment

  • last_two_points (List[complex]) – list with last two control points in abs coords.

  • bbox (BoundingBox) – bounding box to update

ccontrol_points(first: complex, prev: complex, prev_prev: complex) Tuple[complex, ...][source]#

Returns list of path command control points

to_relative(prev: ComplexLike) quadratic[source]#

Return absolute counterpart for absolute commands or copy for relative

transform(transform: inkex.transforms.Transform) inkex.paths.quadratic.Quadratic[source]#

Returns new transformed segment

Parameters

transform – a transformation to apply

cend_point(first: complex, prev: complex) complex[source]#

Complex version of end_point

ccurve_points(first: complex, prev: complex, prev_prev: complex) Tuple[complex, ...][source]#

Converts the path element into a single cubic bezier

reverse(first: ComplexLike, prev: ComplexLike) Quadratic[source]#

Reverse path command

New in version 1.1.

_split(first: complex, prev: complex, prev_control: complex, t: float) Tuple[inkex.paths.quadratic.Quadratic, inkex.paths.quadratic.Quadratic][source]#
_abc_impl = <_abc._abc_data object>#
class inkex.paths.quadratic(dx2: ComplexLike, dx3: ComplexLike)[source]#
class inkex.paths.quadratic(dx2: float, dy2: float, dx3: float, dy3: float)

Bases: inkex.paths.quadratic.QuadraticMixin, inkex.paths.interfaces.RelativePathCommand

Relative quadratic line segment

letter = 'q'#
nargs = 4#
property dx2: float#

x coordinate of the (relative) control point

property dy2: float#

y coordinate of the (relative) control point

property dx3: float#

x coordinate of the (relative) end point

property dy3: float#

y coordinate of the (relative) end point

property args#

Returns path command arguments as tuple of floats

arg1: complex#

The (relative) control point

arg2: complex#

The (relative) end point

ccontrol_points(first: complex, prev: complex, prev_prev: complex) Tuple[complex, ...][source]#

Returns list of path command control points

to_absolute(prev: ComplexLike) Quadratic[source]#

Return relative counterpart for relative commands or copy for absolute

ccurve_points(first: complex, prev: complex, prev_prev: complex) Tuple[complex, ...][source]#

Converts the path element into a single cubic bezier

cend_point(first: complex, prev: complex) complex[source]#

Complex version of end_point

reverse(first: ComplexLike, prev: ComplexLike) quadratic[source]#

Reverse path command

New in version 1.1.

_split(first: complex, prev: complex, prev_control: complex, t: float) Tuple[inkex.paths.quadratic.quadratic, inkex.paths.quadratic.quadratic][source]#
_abc_impl = <_abc._abc_data object>#
class inkex.paths.TepidQuadratic(x3: ComplexLike)[source]#
class inkex.paths.TepidQuadratic(x3: float, y3: float)

Bases: inkex.paths.quadratic.QuadraticMixin, inkex.paths.interfaces.AbsolutePathCommand

Continued Quadratic Line segment

letter = 'T'#
nargs = 2#
property x3: float#

x coordinate of the (absolute) end point

property y3: float#

y coordinate of the (absolute) end point

property args#

Returns path command arguments as tuple of floats

arg1: complex#

The (absolute) control point

update_bounding_box(first, last_two_points, bbox)[source]#

Enlarges given bbox to contain path element.

Parameters
  • first (complex) – first point of path. Required to calculate Z segment

  • last_two_points (List[complex]) – list with last two control points in abs coords.

  • bbox (BoundingBox) – bounding box to update

ccontrol_points(first: complex, prev: complex, prev_prev: complex) Tuple[complex, ...][source]#

Returns list of path command control points

to_non_shorthand(prev: ComplexLike, prev_control: ComplexLike) Quadratic[source]#

Return an absolute non-shorthand command

New in version 1.1.

to_relative(prev: ComplexLike) tepidQuadratic[source]#

Return absolute counterpart for absolute commands or copy for relative

_abc_impl = <_abc._abc_data object>#
transform(transform: inkex.transforms.Transform) inkex.paths.quadratic.TepidQuadratic[source]#

Returns new transformed segment

Parameters

transform – a transformation to apply

ccurve_points(first: complex, prev: complex, prev_prev: complex) Tuple[complex, ...][source]#

Converts the path element into a single cubic bezier

cend_point(first: complex, prev: complex) complex[source]#

Complex version of end_point

to_quadratic(prev: ComplexLike, prev_prev: ComplexLike) Quadratic[source]#

Convert this continued quadratic into a full quadratic

reverse(first: ComplexLike, prev: ComplexLike) TepidQuadratic[source]#

Reverse path command

New in version 1.1.

_split(first: complex, prev: complex, prev_control: complex, t: float) Tuple[inkex.paths.quadratic.Quadratic, inkex.paths.quadratic.Quadratic][source]#
class inkex.paths.tepidQuadratic(dx3: ComplexLike)[source]#
class inkex.paths.tepidQuadratic(dx3: float, dy3: float)

Bases: inkex.paths.quadratic.QuadraticMixin, inkex.paths.interfaces.RelativePathCommand

Relative continued quadratic line segment

_abc_impl = <_abc._abc_data object>#
letter = 't'#
nargs = 2#
property dx3: float#

x coordinate of the (relative) end point

property dy3: float#

y coordinate of the (relative) end point

property args#

Returns path command arguments as tuple of floats

arg1: complex#

The (relative) control point

ccontrol_points(first: complex, prev: complex, prev_prev: complex) Tuple[complex, ...][source]#

Returns list of path command control points

ccurve_points(first: complex, prev: complex, prev_prev: complex) Tuple[complex, ...][source]#

Converts the path element into a single cubic bezier

to_absolute(prev: ComplexLike) TepidQuadratic[source]#

Return relative counterpart for relative commands or copy for absolute

to_non_shorthand(prev: ComplexLike, prev_control: ComplexLike) Quadratic[source]#

Return an absolute non-shorthand command

New in version 1.1.

cend_point(first: complex, prev: complex) complex[source]#

Complex version of end_point

reverse(first: ComplexLike, prev: ComplexLike) tepidQuadratic[source]#

Reverse path command

New in version 1.1.

_split(first: complex, prev: complex, prev_control: complex, t: float) Tuple[inkex.paths.quadratic.quadratic, inkex.paths.quadratic.quadratic][source]#
class inkex.paths.Arc(radius: Union[complex, inkex.transforms.Vector2d], x_axis_rotation: float, large_arc: bool | int, sweep: bool | int, endpoint: Union[complex, inkex.transforms.Vector2d])[source]#
class inkex.paths.Arc(rx: float, ry: float, x_axis_rotation: float, large_arc: bool | int, sweep: bool | int, x: float, y: float)

Bases: inkex.paths.interfaces.BezierArcComputationMixin, inkex.paths.interfaces.AbsolutePathCommand

Special Arc segment

letter = 'A'#
nargs = 7#
property rx: float#

x radius of the Arc

property ry: float#

y radius of the Arc

property x: float#

x coordinate of the (absolute) endpoint of the Arc

property y: float#

x coordinate of the (relative) endpoint of the Arc

property args#

Returns path command arguments as tuple of floats

property cargs#

Set of arguments in complex form

radius: complex#

Radius of the Arc

x_axis_rotation: float#
large_arc: bool#
sweep: bool#
endpoint: complex#

Endpoint (absolute) of the Arc

parametrize(prev)[source]#
Return the parametrisation of the arc:

(radius, phi, rot_matrix, center, theta1, deltatheta)

See http://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes

New in version 1.4.

update_bounding_box(first, last_two_points, bbox)[source]#

Enlarges given bbox to contain path element.

Parameters
  • first (complex) – first point of path. Required to calculate Z segment

  • last_two_points (List[complex]) – list with last two control points in abs coords.

  • bbox (BoundingBox) – bounding box to update

ccontrol_points(first: complex, prev: complex, prev_prev: complex) Tuple[complex, ...][source]#

Returns list of path command control points

ccurve_points(first: complex, prev: complex, prev_prev: complex) Tuple[complex, ...][source]#

Converts the path element into a single cubic bezier

to_curves(prev: ComplexLike, prev_prev: ComplexLike = 0j) List[Curve][source]#

Convert this arc into bezier curves

transform(transform: inkex.transforms.Transform) inkex.paths.arc.Arc[source]#

Returns new transformed segment

Parameters

transform – a transformation to apply

to_relative(prev: Union[complex, inkex.transforms.Vector2d]) inkex.paths.interfaces.RelativePathCommand[source]#

Return absolute counterpart for absolute commands or copy for relative

cend_point(first: complex, prev: complex) complex[source]#

Complex version of end_point

reverse(first: Union[complex, inkex.transforms.Vector2d], prev: Union[complex, inkex.transforms.Vector2d]) inkex.paths.arc.Arc[source]#

Reverse path command

New in version 1.1.

_cpoint(first: complex, prev: complex, prev_control: complex, t: float) complex[source]#
_cderivative(first: complex, prev: complex, prev_control: complex, t: float, n: int = 1) complex[source]#

returns the nth derivative of the segment at t.

_split(first: complex, prev: complex, prev_control: complex, t: float) Tuple[inkex.paths.arc.Arc, inkex.paths.arc.Arc][source]#

returns two segments, whose union is this segment and which join at self.point(t).

_ilength(first: complex, prev: complex, prev_control: complex, length: float, settings: inkex.paths.interfaces.ILengthSettings = ILengthSettings())[source]#
_abc_impl = <_abc._abc_data object>#
class inkex.paths.arc(radius: Union[complex, inkex.transforms.Vector2d], x_axis_rotation: float, large_arc: bool, sweep: bool, endpoint: Union[complex, inkex.transforms.Vector2d])[source]#
class inkex.paths.arc(rx: float, ry: float, x_axis_rotation: float, large_arc: bool, sweep: bool, dx: float, dy: float)

Bases: inkex.paths.interfaces.RelativePathCommand, inkex.paths.arc.Arc

Relative Arc line segment

letter = 'a'#
nargs = 7#
property rx: float#

x radius of the arc

property ry: float#

y radius of the arc

property dx: float#

x coordinate of the (relative) endpoint of the arc

property dy: float#

x coordinate of the (relative) endpoint of the arc

_abc_impl = <_abc._abc_data object>#
property args#

Returns path command arguments as tuple of floats

endpoint: complex#

Endpoint (relative) of the arc

to_absolute(prev: Union[complex, inkex.transforms.Vector2d]) inkex.paths.arc.Arc[source]#

Return relative counterpart for relative commands or copy for absolute

cend_point(first: complex, prev: complex) complex[source]#

Complex version of end_point

ccontrol_points(first: complex, prev: complex, prev_prev: complex) Tuple[complex, ...][source]#

Returns list of path command control points

ccurve_points(first: complex, prev: complex, prev_prev: complex) Tuple[complex, ...][source]#

Converts the path element into a single cubic bezier

reverse(first: Union[complex, inkex.transforms.Vector2d], prev: Union[complex, inkex.transforms.Vector2d]) inkex.paths.arc.arc[source]#

Reverse path command

New in version 1.1.

to_curves(prev: ComplexLike, prev_prev: ComplexLike = 0j) List[Curve][source]#

Convert command to list of Curve commands

exception inkex.paths.InvalidPath[source]#

Bases: ValueError

Raised when given an invalid path string

class inkex.paths.LengthSettings(min_depth: int = 5, error: float = 1e-05)[source]#

Bases: object

Settings for PathCommand.length()

New in version 1.4.

min_depth: int = 5#
error: float = 1e-05#
class inkex.paths.ILengthSettings(min_depth: int = 5, error: float = 1e-05, length_tol: float = 1e-05, maxits: int = 10000)[source]#

Bases: object

Settings for PathCommand.ilength()

New in version 1.4.

min_depth: int = 5#
error: float = 1e-05#

Error tolerance for the computations of the test segment that is performed for each iteration.

The defaults from svgpathtools are ILENGTH_ERROR=ILENGTH_LENGTH_TOL=1e-12. This is rather slow, particularly _length (which then subdivides the path into 2^12 or more segments and adds up the length). For visual editing, this is rather irrelevant (and a lot more accurate than the previous methods).

length_tol: float = 1e-05#

Total (absolute) tolerance of the resulting s value.

maxits: int = 10000#