Newer
Older
.. image:: https://badge.fury.io/py/PyValentina.svg
:target: https://badge.fury.io/py/PyValentina
.. image:: https://img.shields.io/pypi/dm/PyValentina.svg
:target: https://pypi.python.org/pypi/PyValentina
.. image:: https://img.shields.io/pypi/status/PyValentina.svg
:target: https://pypi.python.org/pypi/PyValentina
.. image:: https://img.shields.io/pypi/pyversions/PyValentina.svg
:target: https://pypi.python.org/pypi/PyValentina
.. image:: https://img.shields.io/pypi/l/PyValentina.svg
:target: https://raw.githubusercontent.com/FabriceSalvaire/PyValentina/master/LICENSE.txt
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
.. -*- Mode: rst -*-
..
|PyValentinaUrl|
|PyValentinaHomePage|_
|PyValentinaDoc|_
|PyValentina@github|_
|PyValentina@readthedocs|_
|PyValentina@readthedocs-badge|
|PyValentina@pypi|_
.. |ohloh| image:: https://www.openhub.net/accounts/230426/widgets/account_tiny.gif
:target: https://www.openhub.net/accounts/fabricesalvaire
:alt: Fabrice Salvaire's Ohloh profile
:height: 15px
:width: 80px
.. |PyValentinaUrl| replace:: http://fabricesalvaire.github.io/PyValentina
.. |PyValentinaHomePage| replace:: PyValentina Home Page
.. _PyValentinaHomePage: http://fabricesalvaire.github.io/PyValentina
.. |PyValentinaDoc| replace:: PyValentina Documentation
.. _PyValentinaDoc: http://pyvalentina.readthedocs.org/en/latest
.. |PyValentina@readthedocs-badge| image:: https://readthedocs.org/projects/pyvalentina/badge/?version=latest
:target: http://pyvalentina.readthedocs.org/en/latest
.. |PyValentina@github| replace:: https://github.com/FabriceSalvaire/PyValentina
.. .. _PyValentina@github: https://github.com/FabriceSalvaire/PyValentina
.. |PyValentina@readthedocs| replace:: http://pyvalentina.readthedocs.org
.. .. _PyValentina@readthedocs: http://pyvalentina.readthedocs.org
.. |PyValentina@pypi| replace:: https://pypi.python.org/pypi/PyValentina
.. .. _PyValentina@pypi: https://pypi.python.org/pypi/PyValentina
.. |Build Status| image:: https://travis-ci.org/FabriceSalvaire/PyValentina.svg?branch=master
:target: https://travis-ci.org/FabriceSalvaire/PyValentina
:alt: PyValentina build status @travis-ci.org
.. |Pypi Download| image:: https://img.shields.io/pypi/dm/PyValentina.svg
:target: https://pypi.python.org/pypi/PyValentina
:alt: PyValentina Download per month
.. |Pypi Version| image:: https://img.shields.io/pypi/v/PyValentina.svg
:target: https://pypi.python.org/pypi/PyValentina
:alt: PyValentina last version
.. |Pypi License| image:: https://img.shields.io/pypi/l/PyValentina.svg
:target: https://pypi.python.org/pypi/PyValentina
:alt: PyValentina license
.. |Pypi Format| image:: https://img.shields.io/pypi/format/PyValentina.svg
:target: https://pypi.python.org/pypi/PyValentina
:alt: PyValentina format
.. |Pypi Python Version| image:: https://img.shields.io/pypi/pyversions/PyValentina.svg
:target: https://pypi.python.org/pypi/PyValentina
:alt: PyValentina python version
.. coverage test
.. https://img.shields.io/pypi/status/Django.svg
.. https://img.shields.io/github/stars/badges/shields.svg?style=social&label=Star
.. End
.. -*- Mode: rst -*-
.. |Python| replace:: Python
.. _Python: http://python.org
.. |PyPI| replace:: PyPI
.. _PyPI: https://pypi.python.org/pypi
.. |Numpy| replace:: Numpy
.. _Numpy: http://www.numpy.org
.. |Sphinx| replace:: Sphinx
.. _Sphinx: http://sphinx-doc.org
.. End
============
PyValentina
============
The official PyValentina Home Page is located at |PyValentinaUrl|
The latest documentation build from the git repository is available at readthedocs.org |PyValentina@readthedocs-badge|
Written by `Fabrice Salvaire <http://fabrice-salvaire.pagesperso-orange.fr>`_.
.. -*- Mode: rst -*-
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
=============
Introduction
=============
PyValentina is a python implementation of the `Valentina <http://valentina-project.org/>`_ Pattern
Drafting software, which only focus to the core engine and not to 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. A pattern drafting software only need a good geometrical engine to be designed
efficiently.
Finally, a pattern drafting software requires an efficient graphical user interface so as to be used
by fashion designers and not only by computer scientists. 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 software, in particular the famous open source
3D creation suite `Blender <https://www.blender.org>`_, the parametric 3D modeller `FreeCad
<http://freecadweb.org>`_ as well as the SVG editor `Inkscape <https://inkscape.org/>`_. Moreover
the 3D human model generator `MakeHuman <http://www.makehuman.org>`_ is written in Python.
Python can be easily extended by C libraries using `CFFI <http://cffi.readthedocs.io/en/latest>`_
and C++ libraries using `SWIG <http://www.swig.org>`_.
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.
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
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 <https://www.qt.io>`_ has as a nice binding so called `PyQt
<https://riverbankcomputing.com/software/pyqt/intro>`_ (if we consider Qt is superior to GTK and
WxWidgets).
But up to now Python as of course some drawbacks!
Its main drawback is due to the fact the standard interpreter cannot execute more than one *Python
bytecode* thread in true parallelism (multi-core), this limitation so called Global Interpreter Lock
is required for implementation simplicity. Consequently we can do multi-threading, even on
multi-core in some cases, but less easily than in Java or Cxx11.
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 some 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 a true programming language.
There is several possibilities to generate PDF.
The most disturbing one is to use the `LaTeX <https://en.wikipedia.org/wiki/LaTeX>`_ publishing
system in combination with the `PGF <http://www.texample.net/tikz/examples>`_ package which provide
an amazing graphical language on top of LaTeX. This solution could terrify people, but it do the
job and very well as well as for text and graphics. However user must install a LaTeX environment
from their Linux distribution or using `TexLive <https://www.tug.org/texlive>`_.
A more conventional solution requires a library able to generate PDF from standard graphical
operations. Some libraries able to that are :
* Qt using QPainter API, Valentina solution, see https://wiki.qt.io/Handling_PDF
* `Cairo <https://www.cairographics.org/manual/cairo-PDF-Surfaces.html>`_
* `ReportLab <http://www.reportlab.com/opensource>`_ open-source PDF Toolkit (more commercial and less known)
* `Matplotlib <http://matplotlib.org>`_ (but more oriented to plot)
* and ???
.. -*- Mode: rst -*-
==========
Features
==========
The features of PyValentina are :
* read *.val* and *.vit* file
* `QMuParser <http://beltoforion.de/article.php?a=muparser>`_ expressions are translated to Python and evaluated on the fly
* compute the detail of a pattern
* export the detail to latex/pgf
Missing features:
* write *.val* and *.vit* file
* full operation support
* export to tiled A4 PDF
* Python API to define pattern
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
.. _installation-page:
==============
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:
* |Python|_ 3
* |Numpy|_
Also it is recommanded to have these Python modules:
* pip
* virtualenv
For development, you will need in addition:
* |Sphinx|_
Installation from PyPi Repository
---------------------------------
PyValentina is made available on the |Pypi|_ repository at |PyValentina@pypi|
Run this command to install the last release:
.. code-block:: sh
pip install PyValentina
Installation from Source
------------------------
The PyValentina source code is hosted at |PyValentina@github|
To clone the Git repository, run this command in a terminal:
.. code-block:: sh
git clone git@github.com:FabriceSalvaire/PyValentina.git
Then to build and install PyValentina run these commands:
.. code-block:: sh
python setup.py build
python setup.py install
.. End
.. _bibliography-page:
=============
Bibliography
=============
* `CGAL Computational Geometry Algorithms Library <http://www.cgal.org/>`_
* `David Eberly Geometric Tools web site <https://www.geometrictools.com/index.html>`_