Skip to content

Commit 37cfa17

Browse files
committed
inx
1 parent 126284f commit 37cfa17

File tree

2 files changed

+32
-10
lines changed

2 files changed

+32
-10
lines changed

gcodeplot.inx

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,36 @@
55
<dependency type="extension">org.inkscape.output.svg.inkscape</dependency>
66
<dependency type="executable" location="extensions">gcodeplot.py</dependency>
77
<param name="tab" type="notebook">
8-
<page name="plotter" _gui-text="Plotter Settings ">
8+
<page name="general" _gui-text="General Settings ">
9+
<param name="tool-mode" type="enum" _gui-text="Tool mode:" _gui-description="In draw mode, tool offset and overcut settings are ignored. In cut mode, shading is always disabled. In custom mode, all the other settings are used.">
10+
<item value="draw">drawing</item>
11+
<item value="cut">cutting</item>
12+
<item value="custom">custom</item>
13+
</param>
914
<param name="tolerance" type="float" min="0.0001" max="10.0" precision="2" _gui-text="Precision (mm):" _gui-description="Set rendering precision (Default: 0.05)">0.05</param>
1015
<param name="min-x" type="float" min="-1000000" max="1000000" precision="1" _gui-text="Left x-coordinate (mm):" _gui-description="x-coordinate of the print area's left edge (Default: 0)">0</param>
1116
<param name="min-y" type="float" min="-1000000" max="1000000" precision="1" _gui-text="Lower y-coordinate (mm):" _gui-description="y-coordinate of the print area's lower edge (Default: 0)">0</param>
1217
<param name="max-x" type="float" min="-1000000" max="1000000" precision="1" _gui-text="Right x-coordinate (mm):" _gui-description="x-coordinate of the print area's right edge (Default: 200)">200</param>
1318
<param name="max-y" type="float" min="-1000000" max="1000000" precision="1" _gui-text="Upper y-coordinate (mm):" _gui-description="y-coordinate of the print area's upper edge (Default: 200)">200</param>
14-
<param name="pen-up-z" type="float" min="-1000000" max="1000000" precision="1" _gui-text="Pen up z-coordinate (mm):" _gui-description="z-coordinate of pen-up position (Default: 30)">30</param>
15-
<param name="pen-down-z" type="float" min="-1000000" max="1000000" precision="1" _gui-text="Pen down z-coordinate (mm):" _gui-description="z-coordinate of pen-down position (Default: 25)">25</param>
16-
<param name="parking-z" type="float" min="-1000000" max="1000000" precision="1" _gui-text="Parking z-coordinate (mm):" _gui-description="z-coordinate of park position (Default: 50)">50</param>
17-
<param name="pen-up-speed" type="float" min="-1000000" max="1000000" precision="1" _gui-text="Movement speed (mm/s):" _gui-description="Speed when moving with pen up (Default: 40)">40</param>
18-
<param name="pen-down-speed" type="float" min="-1000000" max="1000000" precision="1" _gui-text="Draw speed (mm/s):" _gui-description="Speed when moving with pen down (Default: 35)">35</param>
19-
<param name="z-speed" type="float" min="-1000000" max="1000000" precision="1" _gui-text="Z-speed (mm/s):" _gui-description="Speed when moving pen up/down (Default: 5)">5</param>
20-
<param name="scale" type="enum" _gui-text="Scaling mode:" _gui-description="Method for scaling to print area (Default: none)">
21-
<item value="none">none</item>
19+
<param name="work-z" type="float" min="-1000000" max="1000000" precision="2" _gui-text="Work z-coordinate (mm):" _gui-description="z-coordinate for drawing/cutting (Default: 15)">15</param>
20+
<param name="lift-delta-z" type="float" min="-1000000" max="1000000" precision="2" _gui-text="Lift z-height (mm):" _gui-description="height to lift pen/knife for movement (Default: 4)">4</param>
21+
<param name="safe-delta-z" type="float" min="-1000000" max="1000000" precision="1" _gui-text="Parking z-height (mm):" _gui-description="height to lift pen/knife for safe parking (Default: 20)">20</param>
22+
<param name="pen-up-speed" type="float" min="-1000000" max="1000000" precision="1" _gui-text="Movement speed (mm/s):" _gui-description="Speed moving with pen up (Default: 40)">40</param>
23+
<param name="pen-down-speed" type="float" min="-1000000" max="1000000" precision="1" _gui-text="Draw speed (mm/s):" _gui-description="Speed moving with pen down (Default: 35)">35</param>
24+
<param name="z-speed" type="float" min="-1000000" max="1000000" precision="1" _gui-text="Z-speed (mm/s):" _gui-description="Speed moving pen up/down (Default: 5)">5</param>
25+
<param name="scale" type="enum" _gui-text="Scaling mode:" _gui-description="Method for scaling to print area (Default: none; should be 'none' if tool-offset option is set in cutter tab)">
26+
<item value="none">none (needed if tool offset&gt;0)</item>
2227
<item value="fit">fit</item>
2328
<item value="down-only">down-only</item>
2429
</param>
2530
</page>
31+
<page name="shading" _gui-text="Shading Settings">
32+
<param name="shading-threshold" type="float" min="0" max="1" precision="2" _gui-text="Shading threshold:" _gui-description="Shade whenever the shade is below this value, where 0=black and 1=white. To turn off shading, set to 0. (Default: 1, shade everything other than white).">1</param>
33+
<param name="shading-lightest" type="float" min="0" max="1000" precision="1" _gui-text="Lightest shading spacing (mm):" _gui-description="Distance between shading lines for the lightest shaded areas.">3</param>
34+
<param name="shading-darkest" type="float" min="0" max="1000" precision="1" _gui-text="Darkest shading spacing (mm):" _gui-description="Distance between shading lines for the darkest shaded areas.">0.5</param>
35+
<param name="shading-angle" type="float" min="0" max="180" precision="1" _gui-text="Shading angle (degrees)" _gui-description="Angle of shading lines">45</param>
36+
<param name="boolean-shading-crosshatch" type="boolean" _gui-text="Crosshatching" _gui-description="Crosshatching when shading">0</param>
37+
</page>
2638
</param>
2739
<output>
2840
<extension>.gcode</extension>

gcodeplot.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,7 @@ def help():
651651
svgSimulation = False
652652
toolOffset = 0.
653653
overcut = 0.
654+
toolMode = "custom"
654655

655656
try:
656657
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:",
@@ -660,7 +661,7 @@ def help():
660661
'pen-down-speed=', 'pen-up-speed=', 'z-speed=', 'hpgl-out', 'no-hpgl-out', 'shading-threshold=',
661662
'shading-angle=', 'shading-crosshatch', 'no-shading-crosshatch', 'shading-avoid-outline',
662663
'pause-at-start', 'no-pause-at-start', 'min-x=', 'max-x=', 'min-y=', 'max-y=',
663-
'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='], )
664+
'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=', 'boolean-shading-crosshatch=' ], )
664665

665666
if len(args) + len(opts) == 0:
666667
raise getopt.GetoptError("invalid commandline")
@@ -768,6 +769,8 @@ def help():
768769
shader.darkestSpacing = float(arg)
769770
elif opt in ('-A', '--shading-angle'):
770771
shader.angle = float(arg)
772+
elif opt == '--boolean-shading-crosshatch':
773+
shader.crossHatch = int(arg) != 0
771774
elif opt in ('-X', '--shading-crosshatch'):
772775
shader.crossHatch = True
773776
elif opt == '--no-shading-crosshatch':
@@ -815,6 +818,8 @@ def help():
815818
svgSimulation = False
816819
elif opt == '--tab':
817820
pass # Inkscape
821+
elif opt == "--tool-mode":
822+
toolMode = arg
818823
else:
819824
raise ValueError("Unrecognized argument "+opt)
820825
i += 1
@@ -886,6 +891,11 @@ def help():
886891

887892
sys.exit(0)
888893

894+
if toolMode == 'cut':
895+
shader.unshadedThreshold = 0
896+
elif toolMode == 'draw':
897+
toolOffset = 0.
898+
889899
variables = {'lift':plotter.liftDeltaZ, 'work':plotter.workZ, 'safe':plotter.safeDeltaZ, 'left':plotter.xyMin[0],
890900
'bottom':plotter.xyMin[1]}
891901
formulas = {'right':str(plotter.xyMax[0]), 'top':str(plotter.xyMax[1]), 'up':'work+lift', 'park':'work+safe', 'centerx':'(left+right)/2.', 'centery':'(top+bottom)/2.'}

0 commit comments

Comments
 (0)