Command Line Support

Issue #334 closed
Susan Spencer created an issue

Enable Valentina to be called from the command line with options.

valentina -somebody.vit -pattern.val -outputfile.svg

Comments (24)

  1. Susan Spencer reporter

    As an example, here are Inkscape's command line options. Some of this may be applicable for exporting patterns.

    Usage: inkscape [OPTIONS...] [FILE...]

    Available options:

    • -V, --version Print the Inkscape version number
    • -z, --without-gui Do not use X server (only process files from console)
    • -g, --with-gui Try to use X server (even if $DISPLAY is not set)
    • -f, --file=FILENAME Open specified document(s) (option string may be excluded)
    • -p, --print=FILENAME Print document(s) to specified output file (use '| program' for pipe)
    • -e, --export-png=FILENAME Export document to a PNG file
    • -d, --export-dpi=DPI Resolution for exporting to bitmap and for rasterization of filters in PS/EPS/PDF (default 90)
    • -a, --export-area=x0:y0:x1:y1 Exported area in SVG user units (default is the page; 0,0 is lower-left corner)
    • -D, --export-area-drawing Exported area is the entire drawing (not page)
    • -C, --export-area-page Exported area is the entire page
    • --export-area-snap Snap the bitmap export area outwards to the nearest integer values (in SVG user units)
    • -w, --export-width=WIDTH The width of exported bitmap in pixels (overrides export-dpi)
    • -h, --export-height=HEIGHT The height of exported bitmap in pixels (overrides export-dpi)
    • -i, --export-id=ID The ID of the object to export
    • -j, --export-id-only Export just the object with export-id, hide all others (only with export-id)
    • -t, --export-use-hints Use stored filename and DPI hints when exporting (only with export-id)
    • -b, --export-background=COLOR Background color of exported bitmap (any SVG-supported color string)
    • -y, --export-background-opacity=VALUE Background opacity of exported bitmap (either 0.0 to 1.0, or 1 to 255)
    • -l, --export-plain-svg=FILENAME Export document to plain SVG file (no sodipodi or inkscape namespaces)
    • -P, --export-ps=FILENAME Export document to a PS file
    • -E, --export-eps=FILENAME Export document to an EPS file
    • -A, --export-pdf=FILENAME Export document to a PDF file
    • --export-latex Export PDF/PS/EPS without text.
      • Besides the PDF/PS/EPS, a LaTeX file is exported, putting the text on top of the PDF/PS/EPS file.
      • Include the result in LaTeX like: \input{latexfile.tex}
    • -T, --export-text-to-path Convert text object to paths on export (PS, EPS, PDF)
    • --export-ignore-filters Render filtered objects without filters, instead of rasterizing (PS, EPS, PDF)
    • -X, --query-x Query the X coordinate of the drawing or, if specified, of the object with --query-id
    • -Y, --query-y Query the Y coordinate of the drawing or, if specified, of the object with --query-id
    • -W, --query-width Query the width of the drawing or, if specified, of the object with --query-id
    • -H, --query-height Query the height of the drawing or, if specified, of the object with --query-id
    • -S, --query-all List id,x,y,w,h for all objects
    • -I, --query-id=ID The ID of the object whose dimensions are queried
    • -x, --extension-directory Print out the extension directory and exit
    • --vacuum-defs Remove unused definitions from the defs section(s) of the document
    • --verb-list List the IDs of all the verbs in Inkscape
    • --verb=VERB-ID Verb to call when Inkscape opens.
    • --select=OBJECT-ID Object ID to select when Inkscape opens.
    • --shell Start Inkscape in interactive shell mode.
    • Help options:
    • -?, --help Show this help message
    • --usage Display brief usage message
  2. Susan Spencer reporter

    What are the command line options for Valentina? These options should be documented here in the issues thread.

  3. Former user Account Deleted
    Usage: valentina [options] filename
    Pattern making program.
    
    Options:
      -h, --help                 Displays this help.
      -v, --version              Displays version information.
      --outfile <outfile>        Path to output exported layout file. Use it to
                                 enable console export mode.
      --mfile <mfile>            Path to custom measure file (export mode).
      --format <format>          Number corresponding to output format (default =
                                 0, export mode): 
                                 Svg files (*.svg) = 0
                                 PDF files (*.pdf) = 1
                                 Images (*.png) = 2
                                 Wavefront OBJ (*.obj) = 3
                                 PS files (*.ps) = 4
                                 EPS files (*.eps) = 5
    
      --pageformat <pageformat>  Number corresponding to page template (default =
                                 0, export mode): 
                                 A0 = 0
                                 A1 = 1
                                 A2 = 2
                                 A3 = 3
                                 A4 = 4
                                 Letter = 5
                                 Legal = 6
                                 Roll 24in = 7
                                 Roll 30in = 8
                                 Roll 36in = 9
                                 Roll 42in = 10
                                 Roll 44in = 11
    
      --pagew <pagew>            Page width in current units like 12.0 (cannot be
                                 used with "pageformat", export mode).
      --pageh <pageh>            Page height in current units like 12.0 (cannot be
                                 used with "pageformat", export mode).
      --pageunits <pageunits>    Page height/width measure units (cannot be used
                                 with "pageformat", export mode): mm, cm, inch, px
      --rotate <rotate>          Rotation in degrees (one of predefined). Default
                                 (or 0) is no-rotate (export mode).
      --crop                     Auto crop unused length (export mode).
      --unite                    Unite pages if possible (export mode).
      --savelen                  Save length of the sheet if set. (export mode).
      --layounits <layounits>    Layout units (as paper's one except px, export
                                 mode).
      --shiftlen <shiftlen>      Shift layout length measured in layout units
                                 (export mode).
      --gapwidth <gapwidth>      Gap width x2, measured in layout units. (export
                                 mode).
      --groups <groups>          Sets layout groupping (export mode): 
                                 Three groups: big, middle, small = 0
                                 Two groups: big, small = 1
                                 Descending area = 2
    
    
    Arguments:
      filename                   Pattern file.
    
  4. Susan Spencer reporter

    Thanks for posting the Command Line options. When code is merged, I will build & test ASAP.

  5. Former user Account Deleted

    I told her, that I had to resolve merging errors ... ...yes, it seems good now.

  6. Former user Account Deleted

    He needs to test it I think. Also I cannot open "layout dialog" with his new changes even by GUI :/

  7. Roman Telezhynskyi repo owner

    Conversion formats 0.1.4->0.2.0 doesn't work yet. Create new test file for him.

  8. Susan Spencer reporter

    Okay I'm building code - slow on my laptop - may take several hours. When finished I will create new pattern & post it.

  9. Susan Spencer reporter

    okay there was a recent series of commits for the Measurements feature which changed the format of the pattern.

    Alexsey you need a pattern with the new format. Roman, please provide a new measurement file.

    Here are steps to create a new pattern for a simple square

    Create new pattern (File/New) Enter new pattern name. Select the measurement file as an existing measurement file that Roman sends you.

    Point A will be created automatically.

    Select the Point section in the lefthand menu.

    Select 'Point from Distance and Angle' tool (the first tool on the first row) Click on A and drag red line a short distance in any direction then left click on canvas to create point B. Right click on B, in popup box select 'Options' Enter angle 270 and length 10 Click 'Ok',

    Select 'Point from Distance and Angle' tool again Click on B, drag red line & click to create point C Right click on C, select 'Options' Enter angle 0 and length 10 'OK'

    Select 'Point from Distance and Angle' tool Click on C, drag red line & click to create point D Right click on D, in popup box select 'Options' Enter angle 180 and length 10 'OK'

    Select 'Line' section in lefthand menu

    Select 'Line' tool (first tool in 'Line' section) Enter point 'D' as first point of line Enter point 'A' as second point of line 'OK'

    File/Save to save pattern to your pattern directory which you entered under File/Preferences/Paths

    To create the Pattern Details:

    Click on 'Detail' in left hand menu Click on 'Create seam allowance'tool (first tool in Detail section) Click on A - this should create a popup box with point A in the seam allowance list then B - this should add B to the popup box then C then D then A again to close the loop. The list from the top down should show A B C D A Do not change any of the default settings, the seam allowance width should be 1cm, the Closed box should be checked. 'OK'

    File/Save to save pattern and detail

  10. Roman Telezhynskyi repo owner

    Alexsey you need a pattern with the new format. Roman, please provide a new measurement file.

    You don't need a measurement file if don't want to use data in a pattern.

  11. Susan Spencer reporter

    That's good. I would like to test the command line features with a pattern that uses measurements and with a pattern that doesn't use measurements.

    Can you post an example of a new measurement file? It doesn't need any values in it.

  12. Susan Spencer reporter

    new_measurements.vit is uploaded.

    It uses the new measurement file structure. It only has the Height section included right now, but this is sufficient for creating a test pattern then testing the command line feature.

  13. Susan Spencer reporter

    Qmake runs without error. But when I try to Build I get this error:

    ......\valentina\src\libs\vpatterndb" -I"........\valentina\src\libs\vgeometry" -I"........\valentina\src\libs\ifc" -I"........\valentina\src\libs\vmisc" -I"........\valentina\src\libs\vobj" -I"........\valentina\src\libs\vlayout" -I"........\valentina\src\libs\qmuparser" -I"........\valentina\src\libs\vpropertyexplorer" -I"C:\Qt5.4\5.4\mingw491_32\include" -I"C:\Qt5.4\5.4\mingw491_32\include\QtSvg" -I"C:\Qt5.4\5.4\mingw491_32\include\QtPrintSupport" -I"C:\Qt5.4\5.4\mingw491_32\include\QtWidgets" -I"C:\Qt5.4\5.4\mingw491_32\include\QtGui" -I"C:\Qt5.4\5.4\mingw491_32\include\QtXml" -I"C:\Qt5.4\5.4\mingw491_32\include\QtXmlPatterns" -I"C:\Qt5.4\5.4\mingw491_32\include\QtNetwork" -I"C:\Qt5.4\5.4\mingw491_32\include\QtCore" -I"moc" -I"uic" -I"C:\Qt5.4\5.4\mingw491_32\mkspecs\win32-g++" -o obj\vapplication.o ........\valentina\src\app\valentina\core\vapplication.cpp ........\valentina\src\app\valentina\core\vapplication.cpp: In member function 'QString VApplication::TapeFilePath() const': ........\valentina\src\app\valentina\core\vapplication.cpp:328:16: error: 'fileBundle' was not declared in this scope return fileBundle.absoluteFilePath(); ^ ........\valentina\src\app\valentina\core\vapplication.cpp:371:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ Makefile:10033: recipe for target 'obj/vapplication.o' failed mingw32-make[3]: [obj/vapplication.o] Error 1 mingw32-make[3]: Leaving directory 'C:/Users/Susan/src/build-Valentina-Desktop_Qt_5_4_1_MinGW_32bit-Release/src/app/valentina' Makefile:39: recipe for target 'sub-valentina-make_first' failed mingw32-make[2]: [sub-valentina-make_first] Error 2 mingw32-make[2]: Leaving directory 'C:/Users/Susan/src/build-Valentina-Desktop_Qt_5_4_1_MinGW_32bit-Release/src/app' Makefile:65: recipe for target 'sub-app-make_first' failed mingw32-make[1]: [sub-app-make_first] Error 2 mingw32-make[1]: Leaving directory 'C:/Users/Susan/src/build-Valentina-Desktop_Qt_5_4_1_MinGW_32bit-Release/src' makefile:38: recipe for target 'sub-src-make_first' failed mingw32-make: [sub-src-make_first] Error 2 15:37:33: The process "C:\Qt5.4\Tools\mingw491_32\bin\mingw32-make.exe" exited with code 2. Error while building/deploying project Valentina (kit: Desktop Qt 5.4.1 MinGW 32bit) When executing step "Make" 15:37:33: Elapsed time: 00:54.

  14. Log in to comment