Added ability to fix "stroke style" for laser cutting
This commit is contained in:
parent
559ecb6d9e
commit
02c98d0b79
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
|
||||
<name>Fix Global Stroke Width / Opacity</name>
|
||||
<name>Fix Global Stroke Width / Opacity / Style</name>
|
||||
<id>fablabchemnitz.de.cleanup</id>
|
||||
<param name="stroke_width" type="float" precision="4" min="0" max="5" gui-text="Stroke width">0.1</param>
|
||||
<param name="stroke_units" gui-text="Units" type="optiongroup" appearance="combo">
|
||||
@ -11,6 +11,7 @@
|
||||
<option value="mm">mm</option>
|
||||
</param>
|
||||
<param name="opacity" type="float" precision="1" min="0" max="100" gui-text="Opacity (%)">100.0</param>
|
||||
<param name="remove_styles" type="bool" gui-text="Remove stroke styles">true</param>
|
||||
<effect needs-live-preview="true">
|
||||
<object-type>all</object-type>
|
||||
<effects-menu>
|
||||
|
@ -26,6 +26,7 @@ class Cleanup(inkex.Effect):
|
||||
inkex.Effect.__init__(self)
|
||||
self.arg_parser.add_argument("--stroke_width", type=float, default=0.1, help="Stroke width")
|
||||
self.arg_parser.add_argument("--stroke_units", default="mm", help="Stroke unit")
|
||||
self.arg_parser.add_argument("--remove_styles", default="mm", help="Remove stroke styles")
|
||||
self.arg_parser.add_argument("--opacity", type=float, default="100.0", help="Opacity")
|
||||
|
||||
def effect(self):
|
||||
@ -56,6 +57,16 @@ class Cleanup(inkex.Effect):
|
||||
if prop == 'stroke-opacity':
|
||||
new_val = str(self.options.opacity / 100)
|
||||
declarations[i] = prop + ':' + new_val
|
||||
if prop == 'stroke-dasharray':
|
||||
declarations[i] = ''
|
||||
if prop == 'stroke-dashoffset':
|
||||
declarations[i] = ''
|
||||
if prop == 'stroke-linejoin':
|
||||
declarations[i] = ''
|
||||
if prop == 'stroke-linecap':
|
||||
declarations[i] = ''
|
||||
if prop == 'stroke-miterlimit':
|
||||
declarations[i] = ''
|
||||
node.set('style', ';'.join(declarations))
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Reference in New Issue
Block a user