PyValentina a Python implementation of the core engine of Valentina

Hey @anuj8826! The drafted pattern formulas are stored into an xml file with extension .val

The body measurements data is stored into an xml file with extension .vit

The pattern formulas create the drawing on the software canvas. The image drawn on the canvas can be exported to vector (svg, eps, hpgl, ps, dxf, pdf) and raster/bitmap (png, jpg).

Hey @slspencer, so I can’t create a pattern from scratch using just the Python library, PyValentina. Thanks for responding back. I am actually trying to get the below jobs done :

First create a pattern from scratch only using this library without using the software Valentina. Then finally export it back to SVG.

Ah, so it’s really a return to the prototype. I’ll have to think about this, my previous approach was to script each step, so that each design is a result of running a manually created python program against my patternmaking function library. And I wrote the library to contain functions which broke down each manual method from patternmaking into it’s 2D geometry equivalent, which required reducing advanced computer graphics math down to 10th grade “desktop” math (surprisingly this was not an easy task!) and creating a element factory to create the SVG objects needed for patternmaking (based on the SVG object W3 specs) – this all took about 2 years to accomplish in total, not including the previous 2 years studying the 50+ patternmakingmethods to derive the engineering first principles of patternmaking which had been lost over time and are no longer taught (if they ever truly were taught, typically the reasons why and assumptions behind each patternmaking step were just implied not discussed).

What you’re asking for is what Roman and I did to create Seamly2D/Valentina - we built a GUI around the library, and added a canvas to show interactively the results of each design/programming step.

So, I really think this is the way to go, away from C++ due to lack of available programmers, and get back to something (python?) we can all work on. But some people have suggested GO, as there are a lot of hungry GO programmers looking for a project right now to prove their chops. And GO doesn’t seem to be so difficult, it’s just new.

Whatever programming language we choose, it will still take time. Fortunately, the good people of this forum provided all the guidance as to what workflow is required, and what finishing steps are needed, to produce a software tool optimized for real custom professional patternmakers and tailors. Because of this forum, the product definition is almost complete even though the product development is not. Design is always more than half the battle with software.

Let’s keep this discussion going. Is there a reason you want PyValentina to generate a pattern, is there a business case or a personal project? I’m asking as a product manager, the more I know the more I can help you.

Here is a python script to create a complex jacket, from 2012. I ran this today and exported the final pattern (SVG) as a .pdf and as a .png, both attached below.

Notice that the .py file is manually programmed, and rather time consuming. And it is read and processed by my prototype TMTP (not uploaded here). I’m posting the python script here because this is the type of file required by PyValentina. But with this type of ultimate control comes fantastic creations. Seamly2D/Valentina still doesn’t have all the tools and operations I created in the python prototype, as our previous programmer didn’t believe we needed them ! :slight_smile: One day I hope to be able to create something this complicated through a GUI program, like Seamly2D. But we need the programmers to make this happen.

A 10dpi .png image of the final pattern is shown below, so you know what’s in the PDF. (26.6 KB)


1 Like

Hat off to you :scream_cat: That’s really amazing. I’ve been reading all the PYValentina chats but it’s been way over my head so I’ve been really quiet about it. I even went so far as to install Python but I haven’t even tried to run it yet, because I really haven’t had the time to study it right now.

Now I’m going to have a look at GO. Perhaps that will sort of fit into my PHP website skills more. :rofl:

YAY! I’m really excited about golang.

I think it’s important to interject a bit of history at this point. Roman didn’t like the Android body measurement app. He sent me email saying that he wanted to develop this himself. And this pattern repeated itself over and over. Roman didn’t want to have a measurements app in 2014. He stated that the users could create the XML measurement .vit files using a text editor. So I hired Corey Berry to create the measurements app. Roman didn’t like it, woulldn’t merge it, and he wrote his own but it was just like Corey’s code. Same is true for pattern labels, I hired Bojan Kver to write the label code. This is also true about ability to run the code as a batch job from the command line, so that a business could automate generation of a pattern for a given client. I hired another programmer (Alexei ?) to write this feature, and Roman made it terribly difficult.

Plus, our 4 programmers that were interested in working on this project last fall lost their interest after receiving private messages from Roman.

So we’re in a position of needing to move this project forward. This is what happens when a coder takes over a project and believes they own it and that no one else contributed to its success. Strangely enough I still love programmers, and I am one myself :).

But I have no interest in learning C++. I think C++ has it’s uses, but it has a lot of difficulties.

We’ll work this out, and I appreciate everyone’s interest and patience.

1 Like

I have Golang up & running on both my pc’s. Now I need to learn how to use it. It really does look good. I don’t know anything about programming, only on creating websites :slight_smile: so I’m going to be a pain in the butt until someone take the programming seriously :blush:

1 Like

@Grace - You’ve inspired me. Excellent read:

Nice article about Go:

1 Like

I bookmarked it. I’ll try & read it & practice it over the weekend :slight_smile: Thank you

I’m not someone that’s a developer /programmer either, but my interest in an “embeddable” Seamly2D that could be used was so so someone interested with a lot of time, patience and skill could implement tools that would make thing like these possible ( these are pure blue sky wishlist right now)…

  • An import tool for the Seamly2D format in other tools, (this is what interested me about the really old TMTP scripts.) , namely those that already support extensions in certain languages , Both Inkscape and Blender supporting python extensions.

  • An “embeddable” pattern viewer/browser for web. Part of the motivation for Seamly2D was ‘libre’ tools for fashion. Being able to view shared patterns in the cloud would be important for this. In any event an embeddable browser/viewer for Mediawiki would enable example/tutorial patterns to be viewed interactively on sites like Seamly2D’s own wiki (hosted on Miraheze). I would certainly be interested in seeing old pattern system books (suce as those on a link I posted recently) being able to placed online with “interactive” patterns.

  • The possiblty for a more general parametric based API / XML format over SVG, which could be useful for not just sewing patterns, but other forms of parametric pattern based design ( I found an old manual on sheet metal drafting, and some of the drawing techniques for patterns don’t seem unfamiliar. )

1 Like

I may be utterly insane and clueless, but perhaps one idea that could be considered is the Seamly2d library as an Inkscape extension to extend Inkscape’s own tools.

1 Like

I believe there is a need for a compiled (vs interpreted) product to have good performance. That does not preclude the usefulness of doing a python (interpreted) version. If it were my decision, I would start with a definition of the roadmap and document a clear vision of where you want the project to go.

I would like to see the following ideas addressed in the roadmap



 List of programs (seamly2d and seamlyme and the cloud based app at are examples of programs) 

 A (not yet existent) add in for blender would be an example of a new program.

I have not lost interest in coding on the project but life goes on and I have had many other priorities in the last year. I perceive Seamly 2D as a really awesome idea and one that I find unfocused at the moment. I may be wrong and there may be focus that I simply don’t see from this forum.

I for one have been intimidated and not felt that it was my place to write into the roadmap. I have been waiting for “somebody” to “do something”. I have always made it my motto to remember for myself and to remind others that we are all somebody. Who gives permission to update the roadmap? What am I waiting for? What is anyone waiting for? Is there a reason any of us should not write ideas clearly into the roadmap and use it as a place to focus ideas? If that is the wrong place, then what is the right place? For anyone who does not know what I mean by the roadmap or does not know where to find it, please see Roadmap - Seamly2D


Hello! I’m glad to join your discussion guys. I found a lot of info from you and it really helpful. So I want to share one source too. It’s about Python. Would you like to read it?


i would like to read it

1 Like

Yes @kmf You should add to the roadmap!

1 Like

Python as a programming language has no saying about if it’s an compiled or interpreted programming language, only the implementation of it. The terms interpreted or compiled is not a property of the language but a property of the implementation. Python program runs directly from the source code . so, Python will fall under byte code interpreted. The .py source code is first compiled to byte code as .pyc. This byte code can be interpreted (official CPython), or JIT compiled (PyPy). Python source code (.py) can be compiled to different byte code also like IronPython (.Net) or Jython (JVM). There are multiple implementations of Python language . The official one is a byte code interpreted one. There are byte code JIT compiled implementations too.


if I add to the roadmap, is anyone interested enough to comment? Disagreement is allowed. Discussion is encouraged

1 Like

Seamly is written in c++… IMO if you want to write in another language get your own repository & forums.


I just thought of a use case for a Python implementation. Follow me into a dream…

{Cue orchestral flourish}

You arrive home to find a large package on your doorstep. Huzzah! Your PyPlottr hanging plotter has arrived! You quickly open up the box and set it up on a wall of your studio. You unroll some large tracing paper and tape it up under the PyPlottr, then turn it on and plug it into a USB port on your computer. Instantly, a new ‘PyPlottr Files’ drive shows up in Explorer. While the PyPlottr comes with a very useful general firmware package that can plot any number of vector and bitmap formats, you are only interested in plotting patterns, so you copy the S2dPlottr.bin file that you downloaded to the new drive, confirm on the PyPlottr that you want to do a firmware upgrade, then wait while it installs it and restarts. Then you drag and drop a .vit and .val file onto the new drive. The touchscreen on the PyPlottr lights up with options. You choose the pieces and sizes you want to print and touch ‘Okay’. With a soft buzz, the PyPlottr starts plotting your pattern at full scale. Huzzah once again!

(Background: There are any number of inexpensive microcontrollers that can run some level of Python and many are capable of performing as needed for this scenario. If more heavy lifting is needed, a Raspberry Pi (or other SBC) would work as well and wouldn’t make such a device too much more expensive.)