Welcome to the PyValentina documentation!

Note

The official Home Page of PyValentina is located at http://fabricesalvaire.github.io/PyValentina

If you are at http://readthedocs.org then you are reading the so called latest documentation.

The latest documentation PyValentina@readthedocs-badge is automatically built from the git repository after each commit.

As opposite the PyValentina Home Page is built manually and is thus less prone to errors.

Introduction

PyValentina is a python implementation of the Valentina Pattern Making software, which only focus to implement the core engine and not the graphical user interface.

A pattern in flat pattern design is build from geometrical operations which can be turned to a computer program and is thus a field of applications of Computer Aided Design. It corresponds more precisely to parametric modelling with dedicated features to fashion modelling and manufacturing.

What is the requirements of a pattern drafting software ?

The core functionality of a CAD system for pattern drafting consists of these two software components :

  • an open file format to store and exchange the pattern,
  • a geometrical engine to compute the pattern, e.g. to generate the layout of each fabric’s piece of a clothe.

The XML language is a natural candidate to define an open file format to store and exchange the pattern. Valentina uses XML to sore measurements in .vit files and patterns in .val files.

Another solution to define and store a pattern is to use a programming language, it can be a dedicated language or any programming language associated to a dedicated API. Many graphical languages was invented for specific usages, e.g. PostScript for printer, Metafont and MetaPost for publishing, G-code for machining etc.

Usually the geometrical operations of a pattern are simple in comparison to the requirements of a mechanical or electronic CAD software. In first hand it is only 2D and the number of operations should be handled smoothly by a computer of these days, whereas it is still challenging for other domains.

Finally, a pattern drafting software requires an efficient graphical user interface so as to be used by fashion designers and not only by hackers. This software component is more challenging in therms of software engineering, i.e. in therms of design and cost.

Why Python is a good language for this library ?

The Python language has a large audience in engineering, due to its canonical syntax and richness of its ecosystem (scientific libraries).

Python is a high level language and thus more productive.

Python is used as scripting language to extend many softwares, in particular the famous open source 3D creation suite Blender, the parametric 3D modeller FreeCad as well as the SVG editor Inkscape. Moreover the 3D human model generator MakeHuman is written in Python.

Python can be easily extended by C libraries using CFFI and C++ libraries using SWIG.

Python as other dynamic languages is able to evaluate code on the fly which provide an expression evaluator for free. And this feature is even more pertinent in our case because of the canonical nature of the syntax of Python which is natural to somebody initiated to a basic mathematical language level.

What is the purpose of this library ?

This library could serve several purposes :

  • help to experiment core features for pattern drafting,
  • plug Valentina to software featuring a Python plugin mechanism like Blender, FreeCad etc.

Could we implement a full software using Python ?

The answer is yes we can! since Qt has as a nice binding so called PyQt.

But up to now Python has of course some drawbacks!

Its main drawback is due to the fact the standard interpreter cannot execute more than one Python bytecode thread at once, this limitation so called Global Interpreter Lock is required for implementation simplicity.

Despite a GUI implemented in PyQt is almost of the time more faster than the human perception on a computer of these days. It can be sometime difficult to overcome latency arising from the software stack. Thus yes we can do it, but it could requires some tricks to achieve the performance of a C++ application.

How to generate drawings in standard format like PDF or SVG ?

SVG is not difficult to generate from Python since it is based on XML. However the PDF format is more challenging, for efficiency reason PDF is a binary format and is thus much more complicated than PostScript which is a true programming language.

There is several possibilities to generate PDF.

The most disturbing one is to use the LaTeX publishing system in combination with the PGF package which provide an amazing graphical language on top of LaTeX. This solution could terrify many peoples, but it do the job very well for text and graphics. However user must install a LaTeX environment from their Linux distribution or using the TexLive distribution.

A more conventional solution requires a library that can generate PDF from standard graphical operations. Some libraries featuring that are :

Features

The features of PyValentina are :

  • read/write .val and .vit file
  • QMuParser expressions are translated to Python and evaluated on the fly
  • API to define patterns
  • compute the detail of a pattern
  • export the detail to latex/pgf as A0 or tiled A4 paper

Missing features:

  • full operation support
  • direct PDF export
  • SVG export

Installation

The procedure to install PyValentina is described in the Installation Manual.

Documentation

The best way to know what we can do with PyValentina and learn it, is to start with the examples.

Overview

Installation

The installation of PyValentina by itself is quite simple. However it will be easier to get the dependencies on a Linux desktop.

Dependencies

PyValentina requires the following dependencies:

Also it is recommanded to have these Python modules:

  • pip
  • virtualenv

For development, you will need in addition:

Installation from PyPi Repository

PyValentina is made available on the PyPI repository at https://pypi.python.org/pypi/PyValentina

Run this command to install the last release:

pip install PyValentina

Installation from Source

The PyValentina source code is hosted at https://github.com/FabriceSalvaire/PyValentina

To clone the Git repository, run this command in a terminal:

git clone git@github.com:FabriceSalvaire/PyValentina.git

Then to build and install PyValentina run these commands:

python setup.py build
python setup.py install

API Documentation

This is the auto-generated API documentation for the PyValentina library.

Warning

The API documentation is automatically generated from the docstrings in the source using the Sphinx tool. This way to produce the documentation is know to be perfectible actually, but not too bad.

Contents:

Valentina

FileFormat

Measurements
class Valentina.FileFormat.Measurements.VitFile(path)[source]

Bases: Valentina.Xml.XmlFile.XmlFileMixin

measurements
class Valentina.FileFormat.Measurements.XmlMeasurement(*args, **kwargs)[source]

Bases: Valentina.Xml.Objectivity.XmlObjectAdaptator

description
full_name
name
value
Pattern

This module implements the val XML file format and is designed so as to decouple the XML details and the calculation API.

The purpose of each XmlObjectAdaptator sub-classes is to serve as a bidirectional adaptor between the XML format and the API.

class Valentina.FileFormat.Pattern.AlongLinePoint(*args, **kwargs)[source]

Bases: Valentina.FileFormat.Pattern.PointLinePropertiesMixin, Valentina.FileFormat.Pattern.FirstSecondPointMixin, Valentina.FileFormat.Pattern.LengthMixin, Valentina.Xml.Objectivity.XmlObjectAdaptator

first_point
id
length
line_color
line_style
mx
my
name
second_point
class Valentina.FileFormat.Pattern.AngleMixin[source]

Bases: object

class Valentina.FileFormat.Pattern.BasePointMixin[source]

Bases: object

class Valentina.FileFormat.Pattern.BissectorPoint(*args, **kwargs)[source]

Bases: Valentina.FileFormat.Pattern.PointLinePropertiesMixin, Valentina.FileFormat.Pattern.FirstSecondThirdPointMixin, Valentina.FileFormat.Pattern.LengthMixin, Valentina.Xml.Objectivity.XmlObjectAdaptator

first_point
id
length
line_color
line_style
mx
my
name
second_point
third_point
class Valentina.FileFormat.Pattern.CalculationDispatcher[source]

Bases: object

from_calculation(calculation)[source]
from_xml(element)[source]
class Valentina.FileFormat.Pattern.CalculationMixin[source]

Bases: object

call_calculation_function(pattern, kwargs)[source]
classmethod from_calculation(calculation)[source]
to_calculation(pattern)[source]
class Valentina.FileFormat.Pattern.CalculationTypeMixin[source]

Bases: Valentina.FileFormat.Pattern.CalculationMixin

to_xml()[source]
class Valentina.FileFormat.Pattern.Detail(modeling, *args, **kwargs)[source]

Bases: Valentina.FileFormat.Pattern.MxMyMixin, Valentina.Xml.Objectivity.XmlObjectAdaptator

append_node(node)[source]
forbidFlipping
id
inLayout
iter_on_nodes()[source]
mx
my
name
seamAllowance
united
version
width
class Valentina.FileFormat.Pattern.DetailData(*args, **kwargs)[source]

Bases: Valentina.FileFormat.Pattern.HeightWidthMixin, Valentina.FileFormat.Pattern.MxMyMixin, Valentina.FileFormat.Pattern.FontSizeMixin, Valentina.FileFormat.Pattern.VisibleRotationMixin, Valentina.Xml.Objectivity.XmlObjectAdaptator

fontSize
height
letter
mx
my
rotation
visible
width
class Valentina.FileFormat.Pattern.DetailDispatcher[source]

Bases: Valentina.FileFormat.Pattern.Dispatcher

class Valentina.FileFormat.Pattern.DetailGrainline(*args, **kwargs)[source]

Bases: Valentina.FileFormat.Pattern.MxMyMixin, Valentina.FileFormat.Pattern.VisibleRotationMixin, Valentina.Xml.Objectivity.XmlObjectAdaptator

arrows
length
mx
my
rotation
visible
class Valentina.FileFormat.Pattern.DetailNode(*args, **kwargs)[source]

Bases: Valentina.Xml.Objectivity.XmlObjectAdaptator

object_id
reverse
type
class Valentina.FileFormat.Pattern.DetailPatternInfo(*args, **kwargs)[source]

Bases: Valentina.FileFormat.Pattern.HeightWidthMixin, Valentina.FileFormat.Pattern.MxMyMixin, Valentina.FileFormat.Pattern.FontSizeMixin, Valentina.FileFormat.Pattern.VisibleRotationMixin, Valentina.Xml.Objectivity.XmlObjectAdaptator

fontSize
height
mx
my
rotation
visible
width
class Valentina.FileFormat.Pattern.Dispatcher[source]

Bases: object

from_xml(element)[source]
class Valentina.FileFormat.Pattern.EndLinePoint(*args, **kwargs)[source]

Bases: Valentina.FileFormat.Pattern.PointLinePropertiesMixin, Valentina.FileFormat.Pattern.BasePointMixin, Valentina.FileFormat.Pattern.LengthAngleMixin, Valentina.Xml.Objectivity.XmlObjectAdaptator

angle
base_point
id
length
line_color
line_style
mx
my
name
class Valentina.FileFormat.Pattern.FirstSecondPointMixin[source]

Bases: object

class Valentina.FileFormat.Pattern.FirstSecondThirdPointMixin[source]

Bases: Valentina.FileFormat.Pattern.FirstSecondPointMixin

class Valentina.FileFormat.Pattern.FontSizeMixin[source]

Bases: object

class Valentina.FileFormat.Pattern.HeightPoint(*args, **kwargs)[source]

Bases: Valentina.FileFormat.Pattern.PointLinePropertiesMixin, Valentina.FileFormat.Pattern.BasePointMixin, Valentina.FileFormat.Pattern.Line1Mixin, Valentina.Xml.Objectivity.XmlObjectAdaptator

base_point
id
line_color
line_style
mx
my
name
point1_line1
point2_line1
class Valentina.FileFormat.Pattern.HeightWidthMixin[source]

Bases: object

class Valentina.FileFormat.Pattern.LengthAngleMixin[source]

Bases: Valentina.FileFormat.Pattern.LengthMixin, Valentina.FileFormat.Pattern.AngleMixin

class Valentina.FileFormat.Pattern.LengthMixin[source]

Bases: object

class Valentina.FileFormat.Pattern.Line(*args, **kwargs)[source]

Bases: Valentina.FileFormat.Pattern.CalculationMixin, Valentina.FileFormat.Pattern.LinePropertiesMixin, Valentina.FileFormat.Pattern.FirstSecondPointMixin, Valentina.Xml.Objectivity.XmlObjectAdaptator

first_point
classmethod from_calculation(calculation)[source]
id
line_color
line_style
second_point
to_calculation(pattern)[source]
class Valentina.FileFormat.Pattern.Line12Mixin[source]

Bases: Valentina.FileFormat.Pattern.Line1Mixin, Valentina.FileFormat.Pattern.Line2Mixin

class Valentina.FileFormat.Pattern.Line1Mixin[source]

Bases: object

class Valentina.FileFormat.Pattern.Line2Mixin[source]

Bases: object

class Valentina.FileFormat.Pattern.LineIntersectAxisPoint(*args, **kwargs)[source]

Bases: Valentina.FileFormat.Pattern.PointLinePropertiesMixin, Valentina.FileFormat.Pattern.BasePointMixin, Valentina.FileFormat.Pattern.Line1Mixin, Valentina.FileFormat.Pattern.AngleMixin, Valentina.Xml.Objectivity.XmlObjectAdaptator

angle
base_point
id
line_color
line_style
mx
my
name
point1_line1
point2_line1
class Valentina.FileFormat.Pattern.LineIntersectPoint(*args, **kwargs)[source]

Bases: Valentina.FileFormat.Pattern.PointMixin, Valentina.FileFormat.Pattern.Line12Mixin, Valentina.Xml.Objectivity.XmlObjectAdaptator

id
mx
my
name
point1_line1
point1_line2
point2_line1
point2_line2
class Valentina.FileFormat.Pattern.LinePropertiesMixin[source]

Bases: object

class Valentina.FileFormat.Pattern.Modeling[source]

Bases: object

append(item)[source]
class Valentina.FileFormat.Pattern.ModelingDispatcher[source]

Bases: Valentina.FileFormat.Pattern.Dispatcher

class Valentina.FileFormat.Pattern.ModelingItemMixin[source]

Bases: object

class Valentina.FileFormat.Pattern.ModelingPoint(*args, **kwargs)[source]

Bases: Valentina.FileFormat.Pattern.ModelingItemMixin, Valentina.FileFormat.Pattern.MxMyMixin, Valentina.Xml.Objectivity.XmlObjectAdaptator

id
in_use
mx
my
object_id
type
class Valentina.FileFormat.Pattern.ModelingSpline(*args, **kwargs)[source]

Bases: Valentina.FileFormat.Pattern.ModelingItemMixin, Valentina.Xml.Objectivity.XmlObjectAdaptator

id
in_use
object_id
type
class Valentina.FileFormat.Pattern.MxMyMixin[source]

Bases: object

class Valentina.FileFormat.Pattern.NormalPoint(*args, **kwargs)[source]

Bases: Valentina.FileFormat.Pattern.PointLinePropertiesMixin, Valentina.FileFormat.Pattern.FirstSecondPointMixin, Valentina.FileFormat.Pattern.LengthAngleMixin, Valentina.Xml.Objectivity.XmlObjectAdaptator

angle
first_point
id
length
line_color
line_style
mx
my
name
second_point
class Valentina.FileFormat.Pattern.Point[source]

Bases: object

class Valentina.FileFormat.Pattern.PointLinePropertiesMixin[source]

Bases: Valentina.FileFormat.Pattern.PointMixin, Valentina.FileFormat.Pattern.LinePropertiesMixin

class Valentina.FileFormat.Pattern.PointMixin[source]

Bases: Valentina.FileFormat.Pattern.CalculationTypeMixin, Valentina.FileFormat.Pattern.MxMyMixin

classmethod from_calculation(calculation)[source]
to_calculation(pattern)[source]
class Valentina.FileFormat.Pattern.PointOfIntersection(*args, **kwargs)[source]

Bases: Valentina.FileFormat.Pattern.PointMixin, Valentina.FileFormat.Pattern.FirstSecondPointMixin, Valentina.Xml.Objectivity.XmlObjectAdaptator

first_point
id
mx
my
name
second_point
class Valentina.FileFormat.Pattern.ShoulderPoint(*args, **kwargs)[source]

Bases: Valentina.FileFormat.Pattern.PointLinePropertiesMixin, Valentina.FileFormat.Pattern.Line1Mixin, Valentina.FileFormat.Pattern.LengthMixin, Valentina.Xml.Objectivity.XmlObjectAdaptator

id
length
line_color
line_style
mx
my
name
point1_line1
point2_line1
shoulder_point
class Valentina.FileFormat.Pattern.SimpleInteractiveSpline(*args, **kwargs)[source]

Bases: Valentina.FileFormat.Pattern.SplineMixin, Valentina.Xml.Objectivity.XmlObjectAdaptator

angle1
angle2
first_point
classmethod from_calculation(calculation)[source]
id
length1
length2
line_color
second_point
to_calculation(pattern)[source]
class Valentina.FileFormat.Pattern.SinglePoint(*args, **kwargs)[source]

Bases: Valentina.FileFormat.Pattern.PointMixin, Valentina.FileFormat.Pattern.XyMixin, Valentina.Xml.Objectivity.XmlObjectAdaptator

id
mx
my
name
x
y
class Valentina.FileFormat.Pattern.Spline[source]

Bases: object

class Valentina.FileFormat.Pattern.SplineMixin[source]

Bases: Valentina.FileFormat.Pattern.CalculationTypeMixin

class Valentina.FileFormat.Pattern.ValFile(path=None)[source]

Bases: Valentina.Xml.XmlFile.XmlFileMixin

Write(path, vit_file, pattern)[source]
measurements
pattern
write(path=None)[source]
class Valentina.FileFormat.Pattern.VisibleRotationMixin[source]

Bases: object

class Valentina.FileFormat.Pattern.XyMixin[source]

Bases: object

This subpackage implements reader and writer for .val and .vit Valentina file formats.

It is designed so as to hide Valentina file format implementation details and to act as a bridge with the Pattern API.

Geometry

Bezier
class Valentina.Geometry.Bezier.CubicBezier2D(p0, p1, p2, p3)[source]

Bases: Valentina.Geometry.Bezier.QuadraticBezier2D

2D Cubic Bezier Curve

Construct a Segment2D from three points.

InterpolationPrecision = 0.001
adaptive_length_approximation()[source]
bounding_box()[source]
clone()[source]
end_point
length
mid_point_quadratic_approximation()[source]
p3
point_at_t(t)[source]
q_length()[source]
reverse()[source]
split_at_t(t)[source]
tangent1
tangent_at(t)[source]
class Valentina.Geometry.Bezier.QuadraticBezier2D(p0, p1, p2)[source]

Bases: Valentina.Geometry.Primitive.Primitive2D, Valentina.Geometry.Primitive.ReversablePrimitiveMixin

2D Quadratic Bezier Curve

Construct a Segment2D from three points.

LineInterpolationPrecision = 0.05
bounding_box()[source]
clone()[source]
end_point
interpolated_length()[source]
length
normal0
p0
p1
p2
point_at_t(t)[source]
reverse()[source]
split_at_t(t)[source]
start_point
tangent0
tangent1
tangent_at(t)[source]
Conic
class Valentina.Geometry.Conic.Circle2D(center, radius, domain)[source]

Bases: Valentina.Geometry.Primitive.Primitive2D

2D Conic

bounding_box()[source]
center
domain
eccentricity
radius
class Valentina.Geometry.Conic.Conic2D(x_radius, y_radius, center, angle, domain)[source]

Bases: Valentina.Geometry.Primitive.Primitive2D

2D Conic

angle
center
domain
eccentricity
matrix()[source]
x_radius
y_radius
Line
class Valentina.Geometry.Line.Line2D(point, vector)[source]

Bases: Valentina.Geometry.Primitive.Primitive2D

2D Line

Construct a Line2D from a point and a vector.

clone()[source]
compute_distance(s_list)[source]

Compute distance between a set of abscissae

compute_distance_between_abscissae(s0, s1)[source]

Compute distance between two abscissae

distance_and_abscissa_to_line(point)[source]

Return the distance of a point to the line

distance_to_line(point)[source]

Return the distance of a point to the line

static from_two_points(p0, p1)[source]

Construct a Line2D from two points.

get_x_from_y(y)[source]

Return x corresponding to y

get_x_y_from_bounding_box(interval)[source]

Return the bounding box build on the intersection of the input bounding box with the line

get_y_from_x(x)[source]

Return y corresponding to x

intersection(other)[source]

Return the intersection Point between self and other

intersection_abscissae(l1, l2)[source]

Return the intersection abscissae between l1 and l2

is_orthogonal(other)[source]

Self is orthogonal to other

is_parallel(other)[source]

Self is parallel to other

orthogonal_line_at_abscissa(s)[source]

Return the orthogonal line at abscissa s

point_at_s(s)[source]

Return the Point corresponding to the curvilinear abscissa s

projected_abscissa(point)[source]

Return the abscissa corresponding to the perpendicular projection of a point to the line

shifted_parallel_line(shift)[source]

Return the shifted parallel line

Primitive
class Valentina.Geometry.Primitive.Primitive[source]

Bases: object

bounding_box()[source]
clone()[source]
is_reversable
reverse()[source]
class Valentina.Geometry.Primitive.Primitive2D[source]

Bases: object

class Valentina.Geometry.Primitive.ReversablePrimitiveMixin[source]

Bases: object

end_point
is_reversable
iter_on_points()[source]
reverse()[source]
start_point
Valentina.Geometry.Primitive.bounding_box_from_points(points)[source]
Segment
class Valentina.Geometry.Segment.Segment2D(p0, p1)[source]

Bases: Valentina.Geometry.Primitive.Primitive2D, Valentina.Geometry.Primitive.ReversablePrimitiveMixin

2D Segment

Construct a Segment2D between two points.

bounding_box()[source]
center
clone()[source]
end_point
intersect(segment2)[source]

Checks if the line segments intersect. return 1 if there is an intersection 0 otherwise

length
p0
p1
point_at_t(t)[source]
reverse()[source]
start_point
to_line()[source]
vector
Valentina.Geometry.Segment.interpolate_two_points(p0, p1, t)[source]
Valentina.Geometry.Segment.triangle_orientation(p0, p1, p2)[source]
Transformation
class Valentina.Geometry.Transformation.AffineTransformation(obj)[source]

Bases: Valentina.Geometry.Transformation.Transformation

classmethod Rotation(angle)[source]
classmethod RotationAt(center, angle)[source]
classmethod Translation(vector)[source]
matrix_part
translation_part
class Valentina.Geometry.Transformation.AffineTransformation2D(obj)[source]

Bases: Valentina.Geometry.Transformation.AffineTransformation

class Valentina.Geometry.Transformation.Transformation(obj)[source]

Bases: object

classmethod Identity()[source]
array
dimension
same_dimension(other)[source]
size
class Valentina.Geometry.Transformation.Transformation2D(obj)[source]

Bases: Valentina.Geometry.Transformation.Transformation

classmethod Parity()[source]
classmethod Rotation(angle)[source]
classmethod Scale(x_scale, y_scale)[source]
classmethod XReflection()[source]
classmethod YReflection()[source]
Vector
class Valentina.Geometry.Vector.HomogeneousVector2D(vector)[source]

Bases: Valentina.Geometry.Vector.Vector2D

2D Homogeneous Coordinate Vector

to_vector()[source]
v
w
class Valentina.Geometry.Vector.NormalisedVector2D(*args)[source]

Bases: Valentina.Geometry.Vector.Vector2DFloatBase

2D Normalised Vector

class Valentina.Geometry.Vector.Vector2D(*args)[source]

Bases: Valentina.Geometry.Vector.Vector2DFloatBase

2D Vector

Example of usage:

Vector(1, 3)
Vector((1, 3))
Vector([1, 3])
Vector(iterable)
Vector(vector)
static from_angle(angle)[source]

Create the unitary vector (cos(angle), sin(angle)). The angle is in degree.

static middle(p0, p1)[source]

Return the middle point.

normalise()[source]

Normalise the vector

rint()[source]
to_normalised()[source]

Return a normalised vector

class Valentina.Geometry.Vector.Vector2DBase(*args)[source]

Bases: Valentina.Geometry.Primitive.Primitive2D

Example of usage:

Vector(1, 3)
Vector((1, 3))
Vector([1, 3])
Vector(iterable)
Vector(vector)
clone()[source]
copy()[source]

Return a copy of self

to_int_list()[source]
v
x
y
class Valentina.Geometry.Vector.Vector2DFloatBase(*args)[source]

Bases: Valentina.Geometry.Vector.Vector2DBase

Example of usage:

Vector(1, 3)
Vector((1, 3))
Vector([1, 3])
Vector(iterable)
Vector(vector)
almost_equal(v1, v2, rtol=1e-05, atol=1e-08, equal_nan=False)[source]

self ~= other

anti_normal()[source]

Return a new vector equal to self rotated of 90 degree in the clockwise direction

bounding_box()[source]
cos_with(direction)[source]

Return the cosinus of self with direction

cross(other)[source]

Return the cross product of self with other

deviation_with(direction)[source]

Return the deviation of self with other

dot(other)[source]

Return the dot product of self with other

inverse_tan()[source]

Return the inverse tangent

is_orthogonal(other)[source]

Self is orthogonal with other

is_parallel(other)[source]

Self is parallel with other

magnitude()[source]

Return the magnitude of the vector

magnitude_square()[source]

Return the square of the magnitude of the vector

normal()[source]

Return a new vector equal to self rotated of 90 degree in the counter clockwise direction

orientation()[source]

Return the orientation in degree

orientation_with(direction)[source]

Return the angle of self on direction

parity()[source]

Return a new vector equal to self rotated of 180 degree

projection_on(direction)[source]

Return the projection of self on direction

rotate(angle, counter_clockwise=True)[source]

Return a new vector equal to self rotated of angle degree in the counter clockwise direction

sin_with(direction)[source]

Return the sinus of self with other

tan()[source]

Return the tangent

class Valentina.Geometry.Vector.Vector2DInt(*args)[source]

Bases: Valentina.Geometry.Vector.Vector2DBase

Example of usage:

Vector(1, 3)
Vector((1, 3))
Vector([1, 3])
Vector(iterable)
Vector(vector)
bounding_box()[source]

This subpackage implements geometry primitives like line, segment and Bezier curve.

Graph

DirectedAcyclicGraph
class Valentina.Graph.DirectedAcyclicGraph.DirectedAcyclicGraph[source]

Bases: object

add_edge(ancestor, descendant)[source]
add_node(node_id, **kwargs)[source]
leafs()[source]
roots()[source]
topological_sort()[source]
class Valentina.Graph.DirectedAcyclicGraph.DirectedAcyclicGraphNode(node_id, data=None)[source]

Bases: object

ancestor
connect_ancestor(node)[source]
data
descendants
disconnect_ancestor(node)[source]
is_leaf
is_root
node_id

This subpackage implements graph algorithms.

GraphicScene

GraphicItem
class Valentina.GraphicScene.GraphicItem.CircleItem(position, radius, path_style)[source]

Bases: Valentina.GraphicScene.GraphicItem.PathItem, Valentina.GraphicScene.GraphicItem.PositionMixin

radius
class Valentina.GraphicScene.GraphicItem.CoordinateItem(name, position)[source]

Bases: Valentina.GraphicScene.GraphicItem.GraphicItem, Valentina.GraphicScene.GraphicItem.PositionMixin

name
class Valentina.GraphicScene.GraphicItem.CubicBezierItem(position1, position2, position3, position4, path_style)[source]

Bases: Valentina.GraphicScene.GraphicItem.PathItem, Valentina.GraphicScene.GraphicItem.FourPositionMixin

class Valentina.GraphicScene.GraphicItem.FourPositionMixin(position1, position2, position3, position4)[source]

Bases: Valentina.GraphicScene.GraphicItem.TwoPositionMixin

position3
position4
positions
class Valentina.GraphicScene.GraphicItem.GraphicItem[source]

Bases: object

class Valentina.GraphicScene.GraphicItem.PathItem(path_style)[source]

Bases: object

path_style
class Valentina.GraphicScene.GraphicItem.PathStyle(stroke_style=None, line_width=None, stroke_color=None, fill_color=None)[source]

Bases: object

fill_color
line_width
stroke_color
stroke_style
class Valentina.GraphicScene.GraphicItem.PositionMixin(position)[source]

Bases: object

position
positions
class Valentina.GraphicScene.GraphicItem.SegmentItem(position1, position2, path_style)[source]

Bases: Valentina.GraphicScene.GraphicItem.PathItem, Valentina.GraphicScene.GraphicItem.TwoPositionMixin

class Valentina.GraphicScene.GraphicItem.TextItem(position, text)[source]

Bases: Valentina.GraphicScene.GraphicItem.GraphicItem, Valentina.GraphicScene.GraphicItem.PositionMixin

text
class Valentina.GraphicScene.GraphicItem.TwoPositionMixin(position1, position2)[source]

Bases: object

position1
position2
positions
Scene
class Valentina.GraphicScene.Scene.GraphicScene[source]

Bases: object

add_circle(*args, **kwargs)[source]
add_coordinate(*args, **kwargs)[source]
add_cubic_bezier(*args, **kwargs)[source]
add_scope(*args, **kwargs)[source]
add_segment(*args, **kwargs)[source]
add_text(*args, **kwargs)[source]
bounding_box
root_scope
class Valentina.GraphicScene.Scene.GraphicSceneScope(transformation=None)[source]

Bases: object

add_circle(*args, **kwargs)[source]
add_coordinate(*args, **kwargs)[source]
add_cubic_bezier(*args, **kwargs)[source]
add_scope(*args, **kwargs)[source]
add_segment(*args, **kwargs)[source]
add_text(*args, **kwargs)[source]
transformation

This subpackage implements a graphic scene which serve to describe a vector drawing to be rendered by a painter implementation.

Logging

Basic

This subpackage implements logging facilities.

Math

Functions
Valentina.Math.Functions.ceil_int(f)[source]
Valentina.Math.Functions.cmp(a, b)[source]
Valentina.Math.Functions.epsilon_float(a, b, epsilon=0.001)[source]
Valentina.Math.Functions.is_in_trignometric_range(x)[source]
Valentina.Math.Functions.middle(a, b)[source]
Valentina.Math.Functions.rint(f)[source]
Valentina.Math.Functions.sign(x)[source]
Valentina.Math.Functions.trignometric_clamp(x)[source]

Clamp x in the range [-1.,1].

This subpackage implements math facilities.

Painter

Painter
class Valentina.Painter.Painter.Painter(scene)[source]

Bases: object

paint()[source]
paint_CircleItem(item)[source]
paint_CoordinateItem(item)[source]
paint_CubicBezierItem(item)[source]
paint_SegmentItem(item)[source]
paint_TextItem(item)[source]
scene
class Valentina.Painter.Painter.Tiler(bounding_box, paper)[source]

Bases: object

Paper
class Valentina.Painter.Paper.PaperSize(size_name, orientation, margin)[source]

Bases: object

height
margin
orientation
size_name
width
TexPainter
class Valentina.Painter.TexPainter.TexPainter(path, scene, paper)[source]

Bases: Valentina.Painter.Painter.Painter

add_detail_figure()[source]
add_tiled_detail_figure()[source]
margin
paint_CircleItem(item)[source]
paint_CoordinateItem(item)[source]
paint_CubicBezierItem(item)[source]
paint_SegmentItem(item)[source]
paint_TextItem(item)[source]
paper_name

This subpackage implements painters for a graphic scene.

Pattern

Calculation

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

class Valentina.Pattern.Calculation.AlongLinePoint(pattern, name, first_point, second_point, length, label_offset, line_style=None, line_color=None, id=None)[source]

Bases: Valentina.Pattern.Calculation.Point, Valentina.Pattern.Calculation.LinePropertiesMixin, Valentina.Pattern.Calculation.FirstSecondPointMixin, Valentina.Pattern.Calculation.LengthMixin

eval_internal()[source]
class Valentina.Pattern.Calculation.AngleMixin(angle)[source]

Bases: object

angle
class Valentina.Pattern.Calculation.BasePointMixin(base_point)[source]

Bases: object

base_point
class Valentina.Pattern.Calculation.Calculation(pattern, id=None)[source]

Bases: object

connect_ancestor_for_expressions()[source]
dependencies
eval()[source]
eval_internal()[source]
geometry()[source]
id
pattern
to_python()[source]
class Valentina.Pattern.Calculation.CalculationMetaClass(class_name, super_classes, class_attribute_dict)[source]

Bases: object

class Valentina.Pattern.Calculation.EndLinePoint(pattern, name, base_point, angle, length, label_offset, line_style=None, line_color=None, id=None)[source]

Bases: Valentina.Pattern.Calculation.Point, Valentina.Pattern.Calculation.LinePropertiesMixin, Valentina.Pattern.Calculation.BasePointMixin, Valentina.Pattern.Calculation.LengthAngleMixin

eval_internal()[source]
class Valentina.Pattern.Calculation.FirstSecondPointMixin(first_point, second_point)[source]

Bases: object

first_point
second_point
class Valentina.Pattern.Calculation.LengthAngleMixin(length, angle)[source]

Bases: Valentina.Pattern.Calculation.LengthMixin, Valentina.Pattern.Calculation.AngleMixin

class Valentina.Pattern.Calculation.LengthMixin(length)[source]

Bases: object

length
class Valentina.Pattern.Calculation.Line(pattern, first_point, second_point, line_style='solid', line_color='black', id=None)[source]

Bases: Valentina.Pattern.Calculation.Calculation, Valentina.Pattern.Calculation.LinePropertiesMixin, Valentina.Pattern.Calculation.FirstSecondPointMixin

eval_internal()[source]
geometry()[source]
class Valentina.Pattern.Calculation.LineIntersectPoint(pattern, name, point1_line1, point2_line1, point1_line2, point2_line2, label_offset, id=None)[source]

Bases: Valentina.Pattern.Calculation.Point

eval_internal()[source]
point1_line1
point1_line2
point2_line1
point2_line2
class Valentina.Pattern.Calculation.LinePropertiesMixin(line_style, line_color)[source]

Bases: object

line_color
line_style
class Valentina.Pattern.Calculation.NormalPoint(pattern, name, first_point, second_point, angle, length, label_offset, line_style=None, line_color=None, id=None)[source]

Bases: Valentina.Pattern.Calculation.Point, Valentina.Pattern.Calculation.LinePropertiesMixin, Valentina.Pattern.Calculation.FirstSecondPointMixin, Valentina.Pattern.Calculation.LengthAngleMixin

eval_internal()[source]
class Valentina.Pattern.Calculation.Point(pattern, name, label_offset, id=None)[source]

Bases: Valentina.Pattern.Calculation.Calculation

geometry()[source]
label_offset
name
vector
class Valentina.Pattern.Calculation.PointOfIntersection(pattern, name, first_point, second_point, label_offset, id=None)[source]

Bases: Valentina.Pattern.Calculation.Point, Valentina.Pattern.Calculation.FirstSecondPointMixin

eval_internal()[source]
class Valentina.Pattern.Calculation.SimpleInteractiveSpline(pattern, first_point, second_point, angle1, length1, angle2, length2, line_style='solid', line_color='black', id=None)[source]

Bases: Valentina.Pattern.Calculation.Calculation, Valentina.Pattern.Calculation.LinePropertiesMixin, Valentina.Pattern.Calculation.FirstSecondPointMixin

angle1
angle2
control_point1
control_point2
eval_internal()[source]
geometry()[source]
length1
length2
class Valentina.Pattern.Calculation.SinglePoint(pattern, name, x, y, label_offset, id=None)[source]

Bases: Valentina.Pattern.Calculation.Point

eval_internal()[source]
x
y
Valentina.Pattern.Calculation.quote(x)[source]
Calculator
class Valentina.Pattern.Calculator.Calculator(measurements)[source]

Bases: object

add_point(point)[source]
cache
dag
measurements
set_current_segment(vector)[source]
unset_current_segment()[source]
class Valentina.Pattern.Calculator.Expression(expression, calculator=None)[source]

Bases: object

dependencies
eval()[source]
expression
is_float()[source]
set_dirty()[source]
value
class Valentina.Pattern.Calculator.NamedExpression(name, expression, calculator=None)[source]

Bases: Valentina.Pattern.Calculator.Expression

name
class Valentina.Pattern.Calculator.NodeVisitor(calculator)[source]

Bases: ast.NodeVisitor

dependencies
visit_Call(node)[source]
Measurement
class Valentina.Pattern.Measurement.Measurement(measurements, name, value, full_name='', description='')[source]

Bases: Valentina.Pattern.Calculator.NamedExpression

description
eval()[source]
full_name
is_custom()[source]
valentina_name
class Valentina.Pattern.Measurement.Measurements[source]

Bases: object

add(*args, **kgwars)[source]
calculator
dump()[source]
eval()[source]
pattern_makin_system
personal
unit
class Valentina.Pattern.Measurement.Personal(first_name=None, last_name=None, birth_date=None, gender=None, email=None)[source]

Bases: object

birth_date
email
first_name
gender
last_name
Pattern
class Valentina.Pattern.Pattern.Pattern(measurements, unit)[source]

Bases: object

AlongLinePoint(*args, **kwargs)
Calculation(*args, **kwargs)
EndLinePoint(*args, **kwargs)
Line(*args, **kwargs)
LineIntersectPoint(*args, **kwargs)
NormalPoint(*args, **kwargs)
Point(*args, **kwargs)
PointOfIntersection(*args, **kwargs)
SimpleInteractiveSpline(*args, **kwargs)
SinglePoint(*args, **kwargs)
bounding_box()[source]
calculations
calculator
detail_scene()[source]

Generate a graphic scene for the detail mode

dump()[source]
eval()[source]
get_calculation(id)[source]
get_calculation_id()[source]
get_point(name)[source]
has_calculation_id(id)[source]
measurements
unit
Valentina.Pattern.Pattern.vector_to_interval2d(vector)[source]

This subpackage implements the core engine for pattern.

TeX

Buffer
class Valentina.TeX.Buffer.Buffer[source]

Bases: object

append(data, deepcopy=False)[source]
clear()[source]
Document
class Valentina.TeX.Document.Document(filename, class_name, class_options='')[source]

Bases: object

content
newpage()[source]
output_directory
pdf_filename
preambule
run_pdflatex()[source]
tex_filename
write()[source]
Environment
class Valentina.TeX.Environment.Center[source]

Bases: Valentina.TeX.Environment.Environment

class Valentina.TeX.Environment.Environment(name, options='')[source]

Bases: Valentina.TeX.Buffer.Buffer

Tikz
class Valentina.TeX.Tikz.TikzFigure(options='')[source]

Bases: Valentina.TeX.Environment.Environment

static format_path_style(path_syle)[source]

This subpackage implements LaTeX facilities.

Tools

IterTools
class Valentina.Tools.IterTools.PairWiseManipulator[source]

Bases: object

This class is a template to manipulate an iterable with a pair wise iterator concept.

The method do() must be implemented in super-class.

apply(iterable)[source]

Iterate over the iterable and call the method do() at each iteration until the last position is reached. The index position is incremented if the method return True.

del_item()[source]

Delete the item at the current index position.

del_next_item()[source]

Delete the item at the next index position.

do()[source]

Method called by method apply() to manipulate the list. Must return a boolean.

end()[source]

Test if the index position is at the end of the list.

next()[source]

Increment the index position.

pair()[source]

Return the pair from the current index position.

Valentina.Tools.IterTools.accumulate(iterable)[source]

Accumulate the values of an iterable to a new array.

Valentina.Tools.IterTools.closed_pairwise(iterable)[source]

Return a generator which generate a closed pair wise list from an iterable. s -> (s[0],s[1]), (s[1],s[2]), ... (s[N], s[0])

Valentina.Tools.IterTools.multiwise(iterable, n=2)[source]

Return a generator which generate a multi wise list from an iterable. s -> (s[0],s[1],s[2],...), (s[1],s[2],s[3],...), ... (...,s[N-2],s[N-1],s[N])

Examples:

a = (1,2,3,4,5)

list(multiwise(a, n=1))
# [(1,), (2,), (3,), (4,), (5,)]

list(multiwise(a, n=2))
# [(1, 2), (2, 3), (3, 4), (4, 5)]

list(multiwise(a, n=3))
# [(1, 2, 3), (2, 3, 4), (3, 4, 5)]

# list(multiwise(a, n=4))
# [(1, 2, 3, 4), (2, 3, 4, 5)]

list(multiwise(a, n=5))
# [(1, 2, 3, 4, 5)]

list(multiwise(a, n=6))
# []

list(multiwise(a, n=0))
# []
Valentina.Tools.IterTools.multiwise_interval(iterable_size, n=2)[source]
Valentina.Tools.IterTools.pairwise(iterable)[source]

Return a generator which generate a pair wise list from an iterable. s -> (s[0],s[1]), (s[1],s[2]), ... (s[N-1],s[N])

This subpackage implements diverse facilities.

Xml

Objectivity
class Valentina.Xml.Objectivity.Attribute(py_attribute, xml_attribute=None, default=None)[source]

Bases: object

default
from_xml(value)[source]
get_attribute(instance)[source]
py_attribute
py_cls_attribute
set_attribute(instance, value)[source]
set_property(cls)[source]
xml_attribute
class Valentina.Xml.Objectivity.BoolAttribute(py_attribute, xml_attribute=None, default=None)[source]

Bases: Valentina.Xml.Objectivity.Attribute

from_xml(value)[source]
class Valentina.Xml.Objectivity.FloatAttribute(py_attribute, xml_attribute=None, default=None)[source]

Bases: Valentina.Xml.Objectivity.Attribute

from_xml(value)[source]
class Valentina.Xml.Objectivity.IntAttribute(py_attribute, xml_attribute=None, default=None)[source]

Bases: Valentina.Xml.Objectivity.Attribute

from_xml(value)[source]
class Valentina.Xml.Objectivity.StringAttribute(py_attribute, xml_attribute=None, default=None)[source]

Bases: Valentina.Xml.Objectivity.Attribute

from_xml(value)[source]
class Valentina.Xml.Objectivity.XmlObjectAdaptator(*args, **kwargs)[source]

Bases: object

classmethod get_dict(instance, exclude=())[source]
to_dict(exclude=())[source]
to_xml(**kwargs)[source]
to_xml_string()[source]
class Valentina.Xml.Objectivity.XmlObjectAdaptatorMetaClass(class_name, super_classes, class_attribute_dict)[source]

Bases: type

register_from_super_class(super_classes)[source]
XmlFile
class Valentina.Xml.XmlFile.XmlFileMixin(path)[source]

Bases: object

path

This subpackage implements XML facilities.