10.1.8.4. SketchOperation

This module defines all the sketch operations supported by the pattern engine, e.g. the intersection between two lines.

A sketch operation must be build from the corresponding method of the Pattern class.

class Patro.Pattern.SketchOperation.AlongLinePoint(sketch, name, first_point, second_point, length, label_offset, line_style=None, line_color=None, id=None)[source]

Bases: Patro.Pattern.SketchOperation.Point, Patro.Pattern.SketchOperation.LinePropertiesMixin, Patro.Pattern.SketchOperation.FirstSecondPointMixin, Patro.Pattern.SketchOperation.LengthMixin

Construct a point from two points defining a direction and a length

__init__(sketch, name, first_point, second_point, length, label_offset, line_style=None, line_color=None, id=None)[source]

Initialize self. See help(type(self)) for accurate signature.

__repr__()[source]

Return repr(self).

eval_internal()[source]

Code to evaluate the operation in subclasses, i.e. to compute internal states like points.

class Patro.Pattern.SketchOperation.AngleMixin(angle)[source]

Bases: object

__init__(angle)[source]

Initialize self. See help(type(self)) for accurate signature.

angle
class Patro.Pattern.SketchOperation.BasePointMixin(base_point)[source]

Bases: object

__init__(base_point)[source]

Initialize self. See help(type(self)) for accurate signature.

base_point
class Patro.Pattern.SketchOperation.EndLinePoint(sketch, name, base_point, angle, length, label_offset, line_style=None, line_color=None, id=None)[source]

Bases: Patro.Pattern.SketchOperation.Point, Patro.Pattern.SketchOperation.LinePropertiesMixin, Patro.Pattern.SketchOperation.BasePointMixin, Patro.Pattern.SketchOperation.LengthAngleMixin

Construct a point from a base point and a vector defined by an angle and a length

__init__(sketch, name, base_point, angle, length, label_offset, line_style=None, line_color=None, id=None)[source]

Initialize self. See help(type(self)) for accurate signature.

__repr__()[source]

Return repr(self).

eval_internal()[source]

Code to evaluate the operation in subclasses, i.e. to compute internal states like points.

class Patro.Pattern.SketchOperation.FirstSecondPointMixin(first_point, second_point)[source]

Bases: object

__init__(first_point, second_point)[source]

Initialize self. See help(type(self)) for accurate signature.

first_point
second_point
class Patro.Pattern.SketchOperation.LengthAngleMixin(length, angle)[source]

Bases: Patro.Pattern.SketchOperation.LengthMixin, Patro.Pattern.SketchOperation.AngleMixin

__init__(length, angle)[source]

Initialize self. See help(type(self)) for accurate signature.

class Patro.Pattern.SketchOperation.LengthMixin(length)[source]

Bases: object

__init__(length)[source]

Initialize self. See help(type(self)) for accurate signature.

length
class Patro.Pattern.SketchOperation.Line(sketch, first_point, second_point, line_style=<StrokeStyle.SolidLine: 2>, line_color=Color(#000000), id=None)[source]

Bases: Patro.Pattern.SketchOperation.SketchOperation, Patro.Pattern.SketchOperation.LinePropertiesMixin, Patro.Pattern.SketchOperation.FirstSecondPointMixin

Construct a line defined by two points

__init__(sketch, first_point, second_point, line_style=<StrokeStyle.SolidLine: 2>, line_color=Color(#000000), id=None)[source]

Initialize self. See help(type(self)) for accurate signature.

__repr__()[source]

Return repr(self).

eval_internal()[source]

Code to evaluate the operation in subclasses, i.e. to compute internal states like points.

geometry()[source]

Return the geometric object

class Patro.Pattern.SketchOperation.LineIntersectPoint(sketch, name, point1_line1, point2_line1, point1_line2, point2_line2, label_offset, id=None)[source]

Bases: Patro.Pattern.SketchOperation.Point

Construct a point from the intersection of two segments defined by four points

__init__(sketch, name, point1_line1, point2_line1, point1_line2, point2_line2, label_offset, id=None)[source]

Initialize self. See help(type(self)) for accurate signature.

__repr__()[source]

Return repr(self).

eval_internal()[source]

Code to evaluate the operation in subclasses, i.e. to compute internal states like points.

point1_line1
point1_line2
point2_line1
point2_line2
class Patro.Pattern.SketchOperation.LinePropertiesMixin(line_style, line_color)[source]

Bases: object

__init__(line_style, line_color)[source]

Initialize self. See help(type(self)) for accurate signature.

line_color
line_style
class Patro.Pattern.SketchOperation.NormalPoint(sketch, name, first_point, second_point, angle, length, label_offset, line_style=None, line_color=None, id=None)[source]

Bases: Patro.Pattern.SketchOperation.Point, Patro.Pattern.SketchOperation.LinePropertiesMixin, Patro.Pattern.SketchOperation.FirstSecondPointMixin, Patro.Pattern.SketchOperation.LengthAngleMixin

Construct a point at a distance of the first point on the rotated normal of a line defined by two points

__init__(sketch, name, first_point, second_point, angle, length, label_offset, line_style=None, line_color=None, id=None)[source]

Initialize self. See help(type(self)) for accurate signature.

__repr__()[source]

Return repr(self).

eval_internal()[source]

Code to evaluate the operation in subclasses, i.e. to compute internal states like points.

class Patro.Pattern.SketchOperation.Point(sketch, name, label_offset, id=None)[source]

Bases: Patro.Pattern.SketchOperation.SketchOperation

Base class for point.

__init__(sketch, name, label_offset, id=None)[source]

Initialize self. See help(type(self)) for accurate signature.

_post_eval_internal()[source]
geometry()[source]

Return the geometric object

label_offset
name
vector
class Patro.Pattern.SketchOperation.PointOfIntersection(sketch, name, first_point, second_point, label_offset, id=None)[source]

Bases: Patro.Pattern.SketchOperation.Point, Patro.Pattern.SketchOperation.FirstSecondPointMixin

Construct a point from the x coordinate of a fist point and the y coordinate of a second point

__init__(sketch, name, first_point, second_point, label_offset, id=None)[source]

Initialize self. See help(type(self)) for accurate signature.

__repr__()[source]

Return repr(self).

eval_internal()[source]

Code to evaluate the operation in subclasses, i.e. to compute internal states like points.

class Patro.Pattern.SketchOperation.SimpleInteractiveSpline(sketch, first_point, second_point, angle1, length1, angle2, length2, line_style=<StrokeStyle.SolidLine: 2>, line_color=Color(#000000), id=None)[source]

Bases: Patro.Pattern.SketchOperation.SketchOperation, Patro.Pattern.SketchOperation.LinePropertiesMixin, Patro.Pattern.SketchOperation.FirstSecondPointMixin

“Construct a quadratic Bezier curve from two extremity points and two control points

__init__(sketch, first_point, second_point, angle1, length1, angle2, length2, line_style=<StrokeStyle.SolidLine: 2>, line_color=Color(#000000), id=None)[source]

Initialize self. See help(type(self)) for accurate signature.

__repr__()[source]

Return repr(self).

angle1
angle2
control_point1
control_point2
eval_internal()[source]

Code to evaluate the operation in subclasses, i.e. to compute internal states like points.

geometry()[source]

Return the geometric object

length1
length2
class Patro.Pattern.SketchOperation.SinglePoint(sketch, name, x, y, label_offset, id=None)[source]

Bases: Patro.Pattern.SketchOperation.Point

Construct a point from coordinate

__init__(sketch, name, x, y, label_offset, id=None)[source]

Initialize self. See help(type(self)) for accurate signature.

__repr__()[source]

Return repr(self).

eval_internal()[source]

Code to evaluate the operation in subclasses, i.e. to compute internal states like points.

x
y
class Patro.Pattern.SketchOperation.SketchOperation(sketch, id=None)[source]

Bases: Patro.Common.Object.ObjectGlobalIdMixin

Baseclass for sketch operation

__init__(sketch, id=None)[source]

Initialize self. See help(type(self)) for accurate signature.

_connect_ancestor(*points)[source]

Connect point dependencies in the DAG.

_dag
_get_operation(operation)[source]

Return the corresponding SketchOperation object where operation can be SketchOperation instance, an id or a name.

_init_args()[source]
_iter_on_expressions()[source]

Lookup for Expression in the object and yield them.

_logger = <Logger Patro.Pattern.SketchOperation.SketchOperation (WARNING)>
connect_ancestor_for_expressions()[source]

Connect dependencies from expressions in the DAG.

dependencies
eval()[source]
eval_internal()[source]

Code to evaluate the operation in subclasses, i.e. to compute internal states like points.

geometry()[source]

Return the geometric object

sketch
to_python()[source]

Return the Python code for the operation

Patro.Pattern.SketchOperation.quote(x)[source]