I hacked 6 month ago a Python implementation of the core engine of Valentina. I did the proof of concept in few hours and later implemented a cleaner code.
Example of generated layout for city trouser on A0 and tiled A4 paper:
Main purpose is to make patterns from an hacker point of view. Thus it is not for lambda users!
Also I believe Blender users could import 2D pattern geometries using this Python module and then use the Blender API to go to 3D.
It features actually:
- read/write XML .val and .vit file
- QMuParser expressions are translated to Python and evaluated on the fly
- Python API to define patterns
- compute the detail of a pattern
- export the detail to LaTeX/PGF as A0 or tiled A4 paper
Missing features are:
- full operation support: should be easy, maybe seam allowance would need more work
- direct PDF export: easy using Qt Painter API for example
- SVG export: cf. supra
Notice if you understand this, it can be faster to work with such code than using the Valentina GUI, simply because Valentina follow a WYSIWYG sequential approach, i.e. your pattern must be right at each action. Here it must only be right when you evaluate the code.
vit_file = VitFile(Path('patterns', 'measurements.vit')) measurements = vit_file.measurements pattern = Pattern(measurements, 'cm') pattern.SinglePoint(name='A0', x=0.7, y=1.0)) pattern.EndLinePoint(name='A1', base_point='A0', angle=0, length='waist_circ/2+10', line_style='dashDotLine', line_color='black') pattern.NormalPoint(name='A2', first_point='A0', second_point='A1', angle=180, length='leg_waist_side_to_floor+@longeur_ourlet_bas_pantalon', line_style='dashDotLine', line_color='black') pattern.AlongLinePoint(name='A3', first_point='A0', second_point='A2', length=4, line_style='none', line_color='black') pattern.AlongLinePoint(name='A4', first_point='A0', second_point='A2', length=20, line_style='none', line_color='black') pattern.AlongLinePoint(name='A5', first_point='A0', second_point='A2', length='leg_waist_side_to_floor-@leg_crotch_to_floor_men', line_style='none', line_color='black') ...
How to get the code ?