Skip to content
README.html 20.5 KiB
Newer Older
Fabrice Salvaire's avatar
Fabrice Salvaire committed
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" />
<title></title>
<style type="text/css">

/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.

See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/

/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
  border: 0 }

table.borderless td, table.borderless th {
  /* Override padding for "table.docutils td" with "! important".
     The right padding separates the table cells. */
  padding: 0 0.5em 0 0 ! important }

.first {
  /* Override more specific margin styles with "! important". */
  margin-top: 0 ! important }

.last, .with-subtitle {
  margin-bottom: 0 ! important }

.hidden {
  display: none }

.subscript {
  vertical-align: sub;
  font-size: smaller }

.superscript {
  vertical-align: super;
  font-size: smaller }

a.toc-backref {
  text-decoration: none ;
  color: black }

blockquote.epigraph {
  margin: 2em 5em ; }

dl.docutils dd {
  margin-bottom: 0.5em }

object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
  overflow: hidden;
}

/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
  font-weight: bold }
*/

div.abstract {
  margin: 2em 5em }

div.abstract p.topic-title {
  font-weight: bold ;
  text-align: center }

div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
  margin: 2em ;
  border: medium outset ;
  padding: 1em }

div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
  font-weight: bold ;
  font-family: sans-serif }

div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
  color: red ;
  font-weight: bold ;
  font-family: sans-serif }

/* Uncomment (and remove this text!) to get reduced vertical space in
   compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
  margin-bottom: 0.5em }

div.compound .compound-last, div.compound .compound-middle {
  margin-top: 0.5em }
*/

div.dedication {
  margin: 2em 5em ;
  text-align: center ;
  font-style: italic }

div.dedication p.topic-title {
  font-weight: bold ;
  font-style: normal }

div.figure {
  margin-left: 2em ;
  margin-right: 2em }

div.footer, div.header {
  clear: both;
  font-size: smaller }

div.line-block {
  display: block ;
  margin-top: 1em ;
  margin-bottom: 1em }

div.line-block div.line-block {
  margin-top: 0 ;
  margin-bottom: 0 ;
  margin-left: 1.5em }

div.sidebar {
  margin: 0 0 0.5em 1em ;
  border: medium outset ;
  padding: 1em ;
  background-color: #ffffee ;
  width: 40% ;
  float: right ;
  clear: right }

div.sidebar p.rubric {
  font-family: sans-serif ;
  font-size: medium }

div.system-messages {
  margin: 5em }

div.system-messages h1 {
  color: red }

div.system-message {
  border: medium outset ;
  padding: 1em }

div.system-message p.system-message-title {
  color: red ;
  font-weight: bold }

div.topic {
  margin: 2em }

h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
  margin-top: 0.4em }

h1.title {
  text-align: center }

h2.subtitle {
  text-align: center }

hr.docutils {
  width: 75% }

img.align-left, .figure.align-left, object.align-left, table.align-left {
  clear: left ;
  float: left ;
  margin-right: 1em }

img.align-right, .figure.align-right, object.align-right, table.align-right {
  clear: right ;
  float: right ;
  margin-left: 1em }

img.align-center, .figure.align-center, object.align-center {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

table.align-center {
  margin-left: auto;
  margin-right: auto;
}

.align-left {
  text-align: left }

.align-center {
  clear: both ;
  text-align: center }

.align-right {
  text-align: right }

/* reset inner alignment in figures */
div.align-right {
  text-align: inherit }

/* div.align-center * { */
/*   text-align: left } */

.align-top    {
  vertical-align: top }

.align-middle {
  vertical-align: middle }

.align-bottom {
  vertical-align: bottom }

ol.simple, ul.simple {
  margin-bottom: 1em }

ol.arabic {
  list-style: decimal }

ol.loweralpha {
  list-style: lower-alpha }

ol.upperalpha {
  list-style: upper-alpha }

ol.lowerroman {
  list-style: lower-roman }

ol.upperroman {
  list-style: upper-roman }

p.attribution {
  text-align: right ;
  margin-left: 50% }

p.caption {
  font-style: italic }

p.credits {
  font-style: italic ;
  font-size: smaller }

p.label {
  white-space: nowrap }

p.rubric {
  font-weight: bold ;
  font-size: larger ;
  color: maroon ;
  text-align: center }

p.sidebar-title {
  font-family: sans-serif ;
  font-weight: bold ;
  font-size: larger }

p.sidebar-subtitle {
  font-family: sans-serif ;
  font-weight: bold }

p.topic-title {
  font-weight: bold }

pre.address {
  margin-bottom: 0 ;
  margin-top: 0 ;
  font: inherit }

pre.literal-block, pre.doctest-block, pre.math, pre.code {
  margin-left: 2em ;
  margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}

span.classifier {
  font-family: sans-serif ;
  font-style: oblique }

span.classifier-delimiter {
  font-family: sans-serif ;
  font-weight: bold }

span.interpreted {
  font-family: sans-serif }

span.option {
  white-space: nowrap }

span.pre {
  white-space: pre }

span.problematic {
  color: red }

span.section-subtitle {
  /* font-size relative to parent (h1..h6 element) */
  font-size: 80% }

table.citation {
  border-left: solid 1px gray;
  margin-left: 1px }

table.docinfo {
  margin: 2em 4em }

table.docutils {
  margin-top: 0.5em ;
  margin-bottom: 0.5em }

table.footnote {
  border-left: solid 1px black;
  margin-left: 1px }

table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
  padding-left: 0.5em ;
  padding-right: 0.5em ;
  vertical-align: top }

table.docutils th.field-name, table.docinfo th.docinfo-name {
  font-weight: bold ;
  text-align: left ;
  white-space: nowrap ;
  padding-left: 0 }

/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
  border: 0px;
  border-top: 2px solid;
  border-bottom: 2px solid;
  border-collapse: collapse;
}
table.docutils.booktabs * {
  border: 0px;
}
table.docutils.booktabs th {
  border-bottom: thin solid;
  text-align: left;
}

h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
  font-size: 100% }

ul.auto-toc {
  list-style-type: none }

</style>
</head>
<body>
<div class="document">


<!-- -*- Mode: rst -*- -->
<a class="reference external image-reference" href="https://badge.fury.io/py/PyValentina"><object data="https://badge.fury.io/py/PyValentina.svg" type="image/svg+xml">https://badge.fury.io/py/PyValentina.svg</object></a>
<a class="reference external image-reference" href="https://pypi.python.org/pypi/PyValentina"><object data="https://img.shields.io/pypi/dm/PyValentina.svg" type="image/svg+xml">https://img.shields.io/pypi/dm/PyValentina.svg</object></a>
<a class="reference external image-reference" href="https://pypi.python.org/pypi/PyValentina"><object data="https://img.shields.io/pypi/status/PyValentina.svg" type="image/svg+xml">https://img.shields.io/pypi/status/PyValentina.svg</object></a>
<a class="reference external image-reference" href="https://pypi.python.org/pypi/PyValentina"><object data="https://img.shields.io/pypi/pyversions/PyValentina.svg" type="image/svg+xml">https://img.shields.io/pypi/pyversions/PyValentina.svg</object></a>
<a class="reference external image-reference" href="https://raw.githubusercontent.com/FabriceSalvaire/PyValentina/master/LICENSE.txt"><object data="https://img.shields.io/pypi/l/PyValentina.svg" type="image/svg+xml">https://img.shields.io/pypi/l/PyValentina.svg</object></a>
<!-- -*- Mode: rst -*- -->
<!-- |PyValentinaUrl|
|PyValentinaHomePage|_
|PyValentinaDoc|_
|PyValentina@github|_
|PyValentina@readthedocs|_
|PyValentina@readthedocs-badge|
|PyValentina@pypi|_ -->
<!-- .. _PyValentina@github: https://github.com/FabriceSalvaire/PyValentina -->
<!-- .. _PyValentina@readthedocs: http://pyvalentina.readthedocs.org -->
<!-- .. _PyValentina@pypi: https://pypi.python.org/pypi/PyValentina -->
<!-- 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 -*- -->
<!-- End -->
<div class="section" id="pyvalentina">
<h1>PyValentina</h1>
Fabrice Salvaire's avatar
Fabrice Salvaire committed
<p>PyValentina Home Page is located at <a class="reference external" href="http://fabricesalvaire.github.io/PyValentina">http://fabricesalvaire.github.io/PyValentina</a></p>
Fabrice Salvaire's avatar
Fabrice Salvaire committed
<p>The latest documentation build from the git repository is available at readthedocs.org <a class="reference external" href="http://pyvalentina.readthedocs.org/en/latest"><img alt="PyValentina&#64;readthedocs-badge" src="https://readthedocs.org/projects/pyvalentina/badge/?version=latest" /></a></p>
Fabrice Salvaire's avatar
Fabrice Salvaire committed
<p>Authored by <a class="reference external" href="http://fabrice-salvaire.pagesperso-orange.fr">Fabrice Salvaire</a>.</p>
<!-- -*- Mode: rst -*- -->
</div>
<div class="section" id="features">
<h1>Features</h1>
<p>The features of PyValentina are :</p>
<ul class="simple">
<li>read/write <em>.val</em> and <em>.vit</em> file</li>
<li><a class="reference external" href="http://beltoforion.de/article.php?a=muparser">QMuParser</a> expressions are translated to Python and evaluated on the fly</li>
<li>API to define patterns</li>
<li>compute the detail of a pattern</li>
<li>export the detail to latex/pgf as A0 or tiled A4 paper</li>
</ul>
<p>Missing features:</p>
<ul class="simple">
<li>full operation support</li>
<li>direct PDF export</li>
<li>SVG export</li>
</ul>
<img alt="https://raw.github.com/FabriceSalvaire/PyValentina/master/test/output/pattern-a0.png" src="https://raw.github.com/FabriceSalvaire/PyValentina/master/test/output/pattern-a0.png" style="height: 600px;" />
<img alt="https://raw.github.com/FabriceSalvaire/PyValentina/master/test/output/pattern-a4.png" src="https://raw.github.com/FabriceSalvaire/PyValentina/master/test/output/pattern-a4.png" style="height: 600px;" />
Fabrice Salvaire's avatar
Fabrice Salvaire committed
<!-- -*- Mode: rst -*- -->
Fabrice Salvaire's avatar
Fabrice Salvaire committed
</div>
<div class="section" id="introduction">
<h1>Introduction</h1>
<p>PyValentina is a python implementation of the <a class="reference external" href="http://valentina-project.org/">Valentina</a> Pattern
Fabrice Salvaire's avatar
Fabrice Salvaire committed
Making software, which only focus to implement the core engine and not the graphical user interface.</p>
Fabrice Salvaire's avatar
Fabrice Salvaire committed
<p>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.</p>
<div class="section" id="what-is-the-requirements-of-a-pattern-drafting-software">
<h2>What is the requirements of a pattern drafting software ?</h2>
<p>The core functionality of a CAD system for pattern drafting consists of these two software components :</p>
<ul class="simple">
Fabrice Salvaire's avatar
Fabrice Salvaire committed
<li>an <strong>open</strong> file format to store and exchange the pattern,</li>
Fabrice Salvaire's avatar
Fabrice Salvaire committed
<li>a geometrical engine to compute the pattern, e.g. to generate the layout of each fabric's piece of a clothe.</li>
</ul>
<p>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 <em>.vit</em> files and patterns in <em>.val</em> files.</p>
<p>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.</p>
<p>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
Fabrice Salvaire's avatar
Fabrice Salvaire committed
domains.</p>
<!-- A pattern drafting software only need a good geometrical engine to be designed efficiently. -->
Fabrice Salvaire's avatar
Fabrice Salvaire committed
<p>Finally, a pattern drafting software requires an efficient graphical user interface so as to be used
Fabrice Salvaire's avatar
Fabrice Salvaire committed
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.</p>
Fabrice Salvaire's avatar
Fabrice Salvaire committed
</div>
<div class="section" id="why-python-is-a-good-language-for-this-library">
<h2>Why Python is a good language for this library ?</h2>
<p>The Python language has a large audience in engineering, due to its canonical syntax and richness of
its ecosystem (scientific libraries).</p>
<p>Python is a high level language and thus more productive.</p>
Fabrice Salvaire's avatar
Fabrice Salvaire committed
<p>Python is used as scripting language to extend many softwares, in particular the famous open source
Fabrice Salvaire's avatar
Fabrice Salvaire committed
3D creation suite <a class="reference external" href="https://www.blender.org">Blender</a>, the parametric 3D modeller <a class="reference external" href="http://freecadweb.org">FreeCad</a> as well as the SVG editor <a class="reference external" href="https://inkscape.org/">Inkscape</a>.  Moreover
the 3D human model generator <a class="reference external" href="http://www.makehuman.org">MakeHuman</a> is written in Python.</p>
<p>Python can be easily extended by C libraries using <a class="reference external" href="http://cffi.readthedocs.io/en/latest">CFFI</a>
and C++ libraries using <a class="reference external" href="http://www.swig.org">SWIG</a>.</p>
Fabrice Salvaire's avatar
Fabrice Salvaire committed
<p>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.</p>
Fabrice Salvaire's avatar
Fabrice Salvaire committed
</div>
<div class="section" id="what-is-the-purpose-of-this-library">
<h2>What is the purpose of this library ?</h2>
<p>This library could serve several purposes :</p>
<ul class="simple">
<li>help to experiment core features for pattern drafting,</li>
<li>plug Valentina to software featuring a Python plugin mechanism like Blender, FreeCad etc.</li>
</ul>
</div>
<div class="section" id="could-we-implement-a-full-software-using-python">
<h2>Could we implement a full software using Python ?</h2>
Fabrice Salvaire's avatar
Fabrice Salvaire committed
<p>The answer is <em>yes we can!</em> since <a class="reference external" href="https://www.qt.io">Qt</a> has as a nice binding so called
<a class="reference external" href="https://riverbankcomputing.com/software/pyqt/intro">PyQt</a>.</p>
<!-- (if we consider Qt is superior to GTK and WxWidgets) -->
<p>But up to now Python has of course some drawbacks!</p>
Fabrice Salvaire's avatar
Fabrice Salvaire committed
<p>Its main drawback is due to the fact the standard interpreter cannot execute more than one <em>Python
Fabrice Salvaire's avatar
Fabrice Salvaire committed
bytecode</em> thread at once, this limitation so called Global Interpreter Lock is required for
implementation simplicity.</p>
<!-- in true parallelism (multi-core) -->
<!-- Consequently we can do multi-threading, even on multi-core in some cases, but less easily than in Java or Cxx11. -->
Fabrice Salvaire's avatar
Fabrice Salvaire committed
<p>Despite a GUI implemented in PyQt is almost of the time more faster than the human perception on a
Fabrice Salvaire's avatar
Fabrice Salvaire committed
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.</p>
Fabrice Salvaire's avatar
Fabrice Salvaire committed
</div>
<div class="section" id="how-to-generate-drawings-in-standard-format-like-pdf-or-svg">
<h2>How to generate drawings in standard format like PDF or SVG ?</h2>
<p>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
Fabrice Salvaire's avatar
Fabrice Salvaire committed
than PostScript which is a true programming language.</p>
Fabrice Salvaire's avatar
Fabrice Salvaire committed
<p>There is several possibilities to generate PDF.</p>
<p>The most disturbing one is to use the <a class="reference external" href="https://en.wikipedia.org/wiki/LaTeX">LaTeX</a> publishing
system in combination with the <a class="reference external" href="http://www.texample.net/tikz/examples">PGF</a> package which provide
Fabrice Salvaire's avatar
Fabrice Salvaire committed
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 <a class="reference external" href="https://www.tug.org/texlive">TexLive</a> distribution.</p>
<p>A more conventional solution requires a library that can generate PDF from standard graphical
operations.  Some libraries featuring that are :</p>
Fabrice Salvaire's avatar
Fabrice Salvaire committed
<ul class="simple">
<li>Qt using QPainter API, Valentina solution, see <a class="reference external" href="https://wiki.qt.io/Handling_PDF">https://wiki.qt.io/Handling_PDF</a></li>
<li><a class="reference external" href="https://www.cairographics.org/manual/cairo-PDF-Surfaces.html">Cairo</a></li>
Fabrice Salvaire's avatar
Fabrice Salvaire committed
<li><a class="reference external" href="http://www.reportlab.com/opensource">ReportLab</a>  open-source PDF Toolkit (more commercial and less known)</li>
Fabrice Salvaire's avatar
Fabrice Salvaire committed
<li><a class="reference external" href="http://matplotlib.org">Matplotlib</a> (but more oriented to plot)</li>
<li>and ???</li>
</ul>
Fabrice Salvaire's avatar
Fabrice Salvaire committed
<!-- -*- Mode: rst -*- -->
</div>
</div>
Fabrice Salvaire's avatar
Fabrice Salvaire committed
<div class="section" id="installation">
<span id="installation-page"></span><h1>Installation</h1>
<p>The installation of PyValentina by itself is quite simple. However it will be easier to get the
dependencies on a Linux desktop.</p>
<div class="section" id="dependencies">
<h2>Dependencies</h2>
<p>PyValentina requires the following dependencies:</p>
<blockquote>
<ul class="simple">
<li><a class="reference external" href="http://python.org">Python</a> 3</li>
<li><a class="reference external" href="http://www.numpy.org">Numpy</a></li>
</ul>
</blockquote>
<p>Also it is recommanded to have these Python modules:</p>
<blockquote>
<ul class="simple">
<li>pip</li>
<li>virtualenv</li>
</ul>
</blockquote>
<p>For development, you will need in addition:</p>
<blockquote>
<ul class="simple">
<li><a class="reference external" href="http://sphinx-doc.org">Sphinx</a></li>
</ul>
</blockquote>
</div>
<div class="section" id="installation-from-pypi-repository">
<h2>Installation from PyPi Repository</h2>
<p>PyValentina is made available on the <a class="reference external" href="https://pypi.python.org/pypi">PyPI</a> repository at <a class="reference external" href="https://pypi.python.org/pypi/PyValentina">https://pypi.python.org/pypi/PyValentina</a></p>
<p>Run this command to install the last release:</p>
<pre class="code sh literal-block">
pip install PyValentina
</pre>
</div>
<div class="section" id="installation-from-source">
<h2>Installation from Source</h2>
<p>The PyValentina source code is hosted at <a class="reference external" href="https://github.com/FabriceSalvaire/PyValentina">https://github.com/FabriceSalvaire/PyValentina</a></p>
<p>To clone the Git repository, run this command in a terminal:</p>
<pre class="code sh literal-block">
git clone git&#64;github.com:FabriceSalvaire/PyValentina.git
</pre>
<p>Then to build and install PyValentina run these commands:</p>
<pre class="code sh literal-block">
python setup.py build
python setup.py install
</pre>
<!-- End -->
</div>
</div>
Fabrice Salvaire's avatar
Fabrice Salvaire committed
<div class="section" id="bibliography">
<span id="bibliography-page"></span><h1>Bibliography</h1>
<ul class="simple">
Fabrice Salvaire's avatar
Fabrice Salvaire committed
<li><a class="reference external" href="http://www.cgal.org">CGAL Computational Geometry Algorithms Library</a></li>
<li><a class="reference external" href="https://www.opencascade.com">Open Cascade Framework</a></li>
Fabrice Salvaire's avatar
Fabrice Salvaire committed
<li><a class="reference external" href="https://www.geometrictools.com/index.html">David Eberly Geometric Tools web site</a></li>
</ul>
<!-- End -->
</div>
Fabrice Salvaire's avatar
Fabrice Salvaire committed
</div>
</body>
</html>