@@ -670,17 +670,18 @@ def help(error=False):
670670 booleanExtractColor = False
671671 quiet = False
672672 sendAndSave = False
673+ directionAngle = None
673674
674675 try :
675- opts , args = getopt .getopt (sys .argv [1 :], "UR:Uhdulw:P:o:Oc:LT:M:m:A:XHrf:na:D:t:s:S:x:y:z:Z:p:f:F:" ,
676+ opts , args = getopt .getopt (sys .argv [1 :], "e: UR:Uhdulw:P:o:Oc:LT:M:m:A:XHrf:na:D:t:s:S:x:y:z:Z:p:f:F:" ,
676677 ["help" , "down" , "up" , "lower-left" , "allow-repeats" , "no-allow-repeats" , "scale=" , "config-file=" ,
677678 "area=" , 'align-x=' , 'align-y=' , 'optimization-time=' , "pens=" ,
678679 'input-dpi=' , 'tolerance=' , 'send=' , 'send-speed=' , 'work-z=' , 'lift-delta-z=' , 'safe-delta-z=' ,
679680 'pen-down-speed=' , 'pen-up-speed=' , 'z-speed=' , 'hpgl-out' , 'no-hpgl-out' , 'shading-threshold=' ,
680681 'shading-angle=' , 'shading-crosshatch' , 'no-shading-crosshatch' , 'shading-avoid-outline' ,
681682 'pause-at-start' , 'no-pause-at-start' , 'min-x=' , 'max-x=' , 'min-y=' , 'max-y=' ,
682683 'no-shading-avoid-outline' , 'shading-darkest=' , 'shading-lightest=' , 'stroke-all' , 'no-stroke-all' , 'gcode-pause' , 'dump-options' , 'tab=' , 'extract-color=' , 'sort' , 'no-sort' , 'simulation' , 'no-simulation' , 'tool-offset=' , 'overcut=' ,
683- 'boolean-shading-crosshatch=' , 'boolean-sort=' , 'tool-mode=' , 'send-and-save=' ], )
684+ 'boolean-shading-crosshatch=' , 'boolean-sort=' , 'tool-mode=' , 'send-and-save=' , 'direction=' ], )
684685
685686 if len (args ) + len (opts ) == 0 :
686687 raise getopt .GetoptError ("invalid commandline" )
@@ -826,13 +827,13 @@ def help(error=False):
826827 sys .exit (0 )
827828 elif opt == '--dump-options' :
828829 doDump = True
829- elif opt in ('R' , '--extract-color' ):
830+ elif opt in ('- R' , '--extract-color' ):
830831 arg = arg .lower ()
831832 if arg == 'all' or len (arg .strip ())== 0 :
832833 extractColor = None
833834 else :
834835 extractColor = parser .rgbFromColor (arg )
835- elif opt in ('d' , '--sort' ):
836+ elif opt in ('- d' , '--sort' ):
836837 sortPaths = True
837838 optimizationTime = 0
838839 elif opt == '--no-sort' :
@@ -845,6 +846,11 @@ def help(error=False):
845846 quiet = True # Inkscape
846847 elif opt == "--tool-mode" :
847848 toolMode = arg
849+ elif opt in ('e' , '--direction' ):
850+ if len (arg .strip ()) == 0 or arg == 'none' :
851+ directionAngle = None
852+ else :
853+ directionAngle = float (arg )
848854 else :
849855 raise ValueError ("Unrecognized argument " + opt )
850856 i += 1
@@ -956,7 +962,8 @@ def help(error=False):
956962 if svgTree is None and 'PD' not in data and 'PU' not in data :
957963 sys .stderr .write ("Unrecognized file.\n " )
958964 exit (1 )
959-
965+
966+ shader .setDrawingDirectionAngle (directionAngle )
960967 if svgTree is not None :
961968 penData = parseSVG (svgTree , tolerance = tolerance , shader = shader , strokeAll = strokeAll , pens = pens , extractColor = extractColor )
962969 else :
0 commit comments