diff options
| author | Liam P. White <inkscapebronyat-signgmaildotcom> | 2014-03-04 02:23:52 +0000 |
|---|---|---|
| committer | Liam P. White <inkscapebronyat-signgmaildotcom> | 2014-03-04 02:23:52 +0000 |
| commit | d627dc64423f864c9320c73a52b47836c696bceb (patch) | |
| tree | 6dd2947cf2adc65ae0afb361e081a1fd0ae31928 /share | |
| parent | Fixed path color when changed by Objects Dialog (diff) | |
| parent | Remove dom/* code and replace two uses of dom/uri with uri. (diff) | |
| download | inkscape-d627dc64423f864c9320c73a52b47836c696bceb.tar.gz inkscape-d627dc64423f864c9320c73a52b47836c696bceb.zip | |
Merge to trunk
(bzr r13090.1.12)
Diffstat (limited to 'share')
| -rw-r--r-- | share/extensions/Makefile.am | 350 | ||||
| -rw-r--r-- | share/extensions/hpgl_decoder.py | 1 | ||||
| -rw-r--r-- | share/extensions/hpgl_encoder.py | 25 | ||||
| -rw-r--r-- | share/extensions/hpgl_input.py | 1 | ||||
| -rw-r--r-- | share/extensions/hpgl_output.inx | 15 | ||||
| -rwxr-xr-x | share/extensions/hpgl_output.py | 11 | ||||
| -rw-r--r-- | share/extensions/plotter.inx | 19 | ||||
| -rw-r--r-- | share/extensions/plotter.py | 34 | ||||
| -rwxr-xr-x | share/extensions/test/hpgl_output.test.py | 4 |
9 files changed, 42 insertions, 418 deletions
diff --git a/share/extensions/Makefile.am b/share/extensions/Makefile.am index c107f7646..41ddd576f 100644 --- a/share/extensions/Makefile.am +++ b/share/extensions/Makefile.am @@ -15,176 +15,9 @@ moduledir = $(datadir)/inkscape/extensions # If you remove an extension from here, either add it to EXTRA_DIST # below, or remove all mention of it from po/inkscape.pot as well. -extensions = \ - addnodes.py \ - bezmisc.py \ - chardataeffect.py\ - color_blackandwhite.py\ - color_brighter.py\ - color_custom.py\ - color_darker.py\ - color_desaturate.py\ - coloreffect.py\ - color_grayscale.py\ - color_HSL_adjust.py\ - color_lesshue.py\ - color_lesslight.py\ - color_lesssaturation.py\ - color_morehue.py\ - color_morelight.py\ - color_moresaturation.py\ - color_negative.py\ - color_randomize.py\ - color_removeblue.py\ - color_removegreen.py\ - color_removered.py\ - color_rgbbarrel.py\ - color_replace.py\ - convert2dashes.py\ - cspsubdiv.py \ - cubicsuperpath.py \ - dia2svg.sh \ - dimension.py \ - dm2svg.py \ - dots.py \ - draw_from_triangle.py \ - dxf_input.py \ - dxf_outlines.py \ - dxf_templates.py \ - edge3d.py \ - embedimage.py \ - embed_raster_in_svg.pl \ - empty_page.py \ - eqtexsvg.py \ - export_gimp_palette.py \ - extractimage.py \ - extrude.py \ - ffgeom.py\ - fig2dev-ext.py \ - flatten.py \ - foldablebox.py \ - fractalize.py \ - funcplot.py \ - render_gears.py \ - render_gear_rack.py \ - gcodetools.py\ - generate_voronoi.py \ - gimp_xcf.py \ - grid_cartesian.py \ - grid_isometric.py \ - grid_polar.py \ - guides_creator.py \ - guillotine.py \ - handles.py \ - hershey.py \ - hersheydata.py \ - hpgl_decoder.py \ - hpgl_encoder.py \ - hpgl_input.py \ - hpgl_output.py \ - ink2canvas.py \ - inkex.py \ - inkscape_follow_link.py \ - inkwebeffect.py \ - interp.py \ - interp_att_g.py \ - jessyInk_autoTexts.py \ - jessyInk_effects.py \ - jessyInk_export.py \ - jessyInk_install.py \ - jessyInk_keyBindings.py \ - jessyInk_masterSlide.py \ - jessyInk_mouseHandler.py \ - jessyInk_summary.py \ - jessyInk_transitions.py \ - jessyInk_uninstall.py \ - jessyInk_video.py \ - jessyInk_view.py \ - launch_webbrowser.py \ - layers2svgfont.py \ - svgfont2layers.py \ - layout_nup.py \ - layout_nup_pageframe.py \ - lindenmayer.py \ - lorem_ipsum.py \ - markers_strokepaint.py \ - measure.py \ - motion.py \ - new_glyph_layer.py \ - next_glyph_layer.py \ - previous_glyph_layer.py \ - param_curves.py \ - pathalongpath.py\ - pathscatter.py\ - pathmodifier.py\ - perfectboundcover.py \ - perspective.py \ - pixelsnap.py \ - plotter.py \ - plt_output.py \ - polyhedron_3d.py \ - printing_marks.py \ - ps2dxf.sh \ - ps2pdf-ext.py \ - pturtle.py \ - radiusrand.py \ - replace_font.py \ - restack.py \ - render_barcode.py \ - render_barcode_datamatrix.py \ - render_barcode_qrcode.py \ - render_alphabetsoup.py \ - render_alphabetsoup_config.py \ - rtree.py \ - rubberstretch.py\ - run_command.py \ - scour.py \ - scour.inkscape.py \ - setup_typography_canvas.py \ - simplepath.py \ - simplepath.rb \ - simplestyle.py \ - simpletransform.py \ - sk1_output.py \ - sk2svg.sh \ - spirograph.py\ - split.py \ - straightseg.py \ - summersnight.py \ - svgcalendar.py \ - svg_regex.py \ - svg_and_media_zip_output.py \ - synfig_fileformat.py \ - synfig_output.py \ - synfig_prepare.py \ - text_extract.py \ - svg_transform.py \ - tar_layers.py \ - text_uppercase.py \ - text_lowercase.py \ - text_sentencecase.py \ - text_titlecase.py \ - text_flipcase.py \ - text_randomcase.py \ - text_braille.py \ - text_merge.py \ - triangle.py \ - uniconv-ext.py \ - uniconv_output.py \ - voronoi.py \ - voronoi2svg.py \ - webslicer_create_group.py \ - webslicer_create_rect.py \ - webslicer_effect.py \ - webslicer_export.py \ - web-set-att.py \ - web-transmit-att.py \ - whirl.py \ - wireframe_sphere.py \ - wmf_output.py \ - yocto_css.py +module_DATA = $(wildcard $(extensiondir)/*.py) -otherstuff = \ +otherstuff_DATA = \ fontfix.conf \ inkweb.js \ jessyInk.js \ @@ -197,184 +30,7 @@ otherstuff = \ svg2xaml.xsl \ xaml2svg.xsl -modules = \ - addnodes.inx \ - ai_input.inx \ - aisvg.inx \ - ccx_input.inx \ - cdr_input.inx \ - cdt_input.inx \ - cgm_input.inx \ - cmx_input.inx \ - color_blackandwhite.inx\ - color_brighter.inx\ - color_custom.inx \ - color_darker.inx\ - color_desaturate.inx\ - color_grayscale.inx\ - color_HSL_adjust.inx\ - color_lesshue.inx\ - color_lesslight.inx\ - color_lesssaturation.inx\ - color_morehue.inx\ - color_morelight.inx\ - color_moresaturation.inx\ - color_negative.inx\ - color_randomize.inx\ - color_removeblue.inx\ - color_removegreen.inx\ - color_removered.inx\ - color_rgbbarrel.inx\ - color_replace.inx\ - convert2dashes.inx\ - dhw_input.inx \ - dia.inx \ - dimension.inx \ - dots.inx \ - draw_from_triangle.inx \ - dxf_input.inx \ - dxf_outlines.inx \ - dxf_output.inx \ - edge3d.inx \ - embedimage.inx \ - embedselectedimages.inx \ - empty_page.inx \ - eps_input.inx \ - eqtexsvg.inx \ - export_gimp_palette.inx \ - extractimage.inx \ - extrude.inx \ - fig_input.inx \ - flatten.inx \ - foldablebox.inx \ - fractalize.inx \ - funcplot.inx \ - render_gears.inx \ - render_gear_rack.inx \ - gcodetools_about.inx\ - gcodetools_area.inx\ - gcodetools_check_for_updates.inx\ - gcodetools_dxf_points.inx\ - gcodetools_engraving.inx\ - gcodetools_graffiti.inx\ - gcodetools_lathe.inx\ - gcodetools_orientation_points.inx\ - gcodetools_path_to_gcode.inx\ - gcodetools_prepare_path_for_plasma.inx\ - gcodetools_tools_library.inx\ - generate_voronoi.inx \ - gimp_xcf.inx \ - grid_cartesian.inx \ - grid_isometric.inx \ - grid_polar.inx \ - guides_creator.inx \ - guillotine.inx \ - handles.inx \ - hershey.inx \ - hpgl_input.inx \ - hpgl_output.inx \ - ink2canvas.inx \ - inkscape_follow_link.inx \ - inkscape_help_askaquestion.inx \ - inkscape_help_commandline.inx \ - inkscape_help_faq.inx\ - inkscape_help_manual.inx \ - inkscape_help_relnotes.inx \ - inkscape_help_reportabug.inx \ - inkscape_help_svgspec.inx \ - inkscape_help_keys.inx \ - interp.inx \ - interp_att_g.inx \ - jessyInk_autoTexts.inx \ - jessyInk_effects.inx \ - jessyInk_export.inx \ - jessyInk_install.inx \ - jessyInk_keyBindings.inx \ - jessyInk_masterSlide.inx \ - jessyInk_mouseHandler.inx \ - jessyInk_summary.inx \ - jessyInk_transitions.inx \ - jessyInk_uninstall.inx \ - jessyInk_video.inx \ - jessyInk_view.inx \ - layers2svgfont.inx \ - svgfont2layers.inx \ - layout_nup.inx \ - lindenmayer.inx \ - lorem_ipsum.inx \ - markers_strokepaint.inx \ - measure.inx \ - motion.inx \ - new_glyph_layer.inx \ - next_glyph_layer.inx \ - previous_glyph_layer.inx \ - param_curves.inx \ - pathalongpath.inx\ - pathscatter.inx\ - perfectboundcover.inx \ - perspective.inx \ - pixelsnap.inx \ - plotter.inx \ - plt_input.inx \ - plt_output.inx \ - polyhedron_3d.inx \ - printing_marks.inx \ - ps_input.inx \ - radiusrand.inx \ - render_barcode.inx \ - render_barcode_datamatrix.inx \ - render_barcode_qrcode.inx \ - render_alphabetsoup.inx \ - replace_font.inx \ - restack.inx \ - rubberstretch.inx \ - rtree.inx \ - scour.inx \ - setup_typography_canvas.inx \ - sk_input.inx \ - sk1_input.inx \ - sk1_output.inx \ - spirograph.inx \ - split.inx \ - straightseg.inx \ - summersnight.inx \ - svg2fxg.inx \ - svg2xaml.inx \ - svg_and_media_zip_output.inx \ - svgcalendar.inx \ - synfig_output.inx \ - tar_layers.inx \ - text_extract.inx \ - text_uppercase.inx\ - text_lowercase.inx \ - text_sentencecase.inx \ - text_titlecase.inx \ - text_flipcase.inx \ - text_randomcase.inx \ - text_braille.inx \ - text_merge.inx \ - triangle.inx \ - voronoi2svg.inx \ - webslicer_create_group.inx \ - webslicer_create_rect.inx \ - webslicer_export.inx \ - web-set-att.inx \ - web-transmit-att.inx \ - whirl.inx \ - wireframe_sphere.inx \ - wmf_input.inx \ - wmf_output.inx \ - xaml2svg.inx - - -extension_SCRIPTS = \ - $(extensions) - -otherstuff_DATA = \ - $(otherstuff) - -module_DATA = \ - $(modules) +module_DATA = $(wildcard $(moduledir)/*.inx) EXTRA_DIST = \ $(extension_SCRIPTS) $(otherstuff_DATA) $(module_DATA) diff --git a/share/extensions/hpgl_decoder.py b/share/extensions/hpgl_decoder.py index 2401a5612..c195b21e3 100644 --- a/share/extensions/hpgl_decoder.py +++ b/share/extensions/hpgl_decoder.py @@ -25,7 +25,6 @@ from StringIO import StringIO import inkex -# TODO: Unittests class hpglDecoder: def __init__(self, hpglString, options): diff --git a/share/extensions/hpgl_encoder.py b/share/extensions/hpgl_encoder.py index 42c3bb821..3d0b1bb7f 100644 --- a/share/extensions/hpgl_encoder.py +++ b/share/extensions/hpgl_encoder.py @@ -33,7 +33,6 @@ import simplestyle import simpletransform -# TODO: Unittests class hpglEncoder: PI = math.pi TWO_PI = PI * 2 @@ -50,13 +49,9 @@ class hpglEncoder: "mirrorY":bool "center":bool "flat":float - "useOvercut":bool "overcut":float - "useToolOffset":bool "toolOffset":float "precut":bool - "offsetX":float - "offsetY":float "autoAlign":bool "debug":bool ''' @@ -70,15 +65,18 @@ class hpglEncoder: self.sizeY = 'False' self.dryRun = True self.lastPoint = [0, 0, 0] + self.offsetX = 0 + self.offsetY = 0 self.scaleX = self.options.resolutionX / effect.unittouu("1.0in") # dots per inch to dots per user unit self.scaleY = self.options.resolutionY / effect.unittouu("1.0in") # dots per inch to dots per user unit scaleXY = (self.scaleX + self.scaleY) / 2 - self.offsetX = effect.unittouu(str(self.options.offsetX) + "mm") * self.scaleX # mm to dots (plotter coordinate system) - self.offsetY = effect.unittouu(str(self.options.offsetY) + "mm") * self.scaleY # mm to dots - self.overcut = effect.unittouu(str(self.options.overcut) + "mm") * scaleXY # mm to dots + self.overcut = effect.unittouu(str(self.options.overcut) + "mm") * scaleXY # mm to dots (plotter coordinate system) self.toolOffset = effect.unittouu(str(self.options.toolOffset) + "mm") * scaleXY # mm to dots self.flat = self.options.flat / (1016 / ((self.options.resolutionX + self.options.resolutionY) / 2)) # scale flatness to resolution - self.toolOffsetFlat = self.flat / self.toolOffset * 4.5 # scale flatness to offset + if self.toolOffset > 0.0: + self.toolOffsetFlat = self.flat / self.toolOffset * 4.5 # scale flatness to offset + else: + self.toolOffsetFlat = 0.0 self.mirrorX = 1.0 if self.options.mirrorX: self.mirrorX = -1.0 @@ -150,7 +148,7 @@ class hpglEncoder: self.offsetX += self.docHeight * self.scaleY if self.options.orientation == '180': self.offsetX += self.docWidth * self.scaleX - if not self.options.center and self.options.useToolOffset: + if not self.options.center and self.toolOffset > 0.0: self.offsetX += self.toolOffset self.offsetY += self.toolOffset # initialize transformation matrix and cache @@ -166,7 +164,7 @@ class hpglEncoder: self.hpgl += ';VS%d' % self.options.speed # add move to zero point and precut self.processOffset('PU', 0, 0) - if self.options.useToolOffset and self.options.precut: + if self.toolOffset > 0.0 and self.options.precut: if self.options.center: # TODO: get this FU to work or remove precut functionality ''' @@ -237,7 +235,6 @@ class hpglEncoder: # path to HPGL commands oldPosX = 0.0 oldPosY = 0.0 - # TODO: Plot smallest parts first to avid plotter dragging parts of foil around (on text) for singlePath in path: cmd = 'PU' for singlePathPoint in singlePath: @@ -249,7 +246,7 @@ class hpglEncoder: oldPosX = posX oldPosY = posY # perform overcut - if self.options.useOvercut and not self.dryRun: + if self.overcut > 0.0 and not self.dryRun: # check if last and first points are the same, otherwise the path is not closed and no overcut can be performed if int(round(oldPosX)) == int(round(singlePath[0][1][0])) and int(round(oldPosY)) == int(round(singlePath[0][1][1])): overcutLength = 0 @@ -284,7 +281,7 @@ class hpglEncoder: def processOffset(self, cmd, posX, posY): # calculate offset correction (or dont) - if not self.options.useToolOffset or self.dryRun: + if self.toolOffset == 0.0 or self.dryRun: self.storePoint(cmd, posX, posY) else: # insert data into cache diff --git a/share/extensions/hpgl_input.py b/share/extensions/hpgl_input.py index 93dd5a6c2..d85a5edd6 100644 --- a/share/extensions/hpgl_input.py +++ b/share/extensions/hpgl_input.py @@ -28,7 +28,6 @@ import sys inkex.localize() -# TODO: Unittests # parse options parser = inkex.optparse.OptionParser(usage='usage: %prog [options] HPGLfile', option_class=inkex.InkOption) parser.add_option('--resolutionX', action='store', type='float', dest='resolutionX', default=1016.0, help='Resolution X (dpi)') diff --git a/share/extensions/hpgl_output.inx b/share/extensions/hpgl_output.inx index bb0809386..d16cc55e5 100644 --- a/share/extensions/hpgl_output.inx +++ b/share/extensions/hpgl_output.inx @@ -8,7 +8,7 @@ <dependency type="executable" location="extensions">inkex.py</dependency> <_param name="introduction" type="description">Please make sure that all objects you want to save are converted to paths. Please use the plotter extension (Extensions menu) to plot directly over a serial connection.</_param> <param name="tab" type="notebook"> - <page name="plotter" _gui-text="Plotter Settings"> + <page name="plotter" _gui-text="Plotter Settings "> <param name="resolutionX" type="float" min="1.0" max="4096.0" precision="1" _gui-text="Resolution X (dpi)" _gui-description="The amount of steps the plotter moves if it moves for 1 inch on the X axis. (Default: 1016.0)">1016.0</param> <param name="resolutionY" type="float" min="1.0" max="4096.0" precision="1" _gui-text="Resolution Y (dpi)" _gui-description="The amount of steps the plotter moves if it moves for 1 inch on the Y axis. (Default: 1016.0)">1016.0</param> <param name="pen" type="int" min="0" max="99" _gui-text="Pen number" _gui-description="The number of the pen (tool) to use. (Standard: '1')">1</param> @@ -24,18 +24,11 @@ <param name="mirrorY" type="boolean" _gui-text="Mirror Y axis" _gui-description="Check this to mirror the Y axis. (Default: Unchecked)">false</param> <param name="center" type="boolean" _gui-text="Center zero point" _gui-description="Check this if your plotter uses a centered zero point. (Default: Unchecked)">false</param> </page> - <page name="overcutToolOffset" _gui-text="Overcut & Tool Offset"> - <param name="useOvercut" type="boolean" _gui-text="Use overcut" _gui-description="Check this to use overcut, if not checked the 'Overcut' parameter is unused. (Default: Checked)">true</param> - <param name="overcut" type="float" min="0.0" max="100.0" precision="2" _gui-text="Overcut (mm)" _gui-description="The distance in mm that will be cut over the starting point of the path to prevent open paths. (Default: 1.00)">1.00</param> - <param name="space" type="description"> </param> - <param name="useToolOffset" type="boolean" _gui-text="Use tool offset correction" _gui-description="Check this to use the tool offset correction, if not checked the 'Tool offset' and 'Precut' parameters are unused. (Default: Checked)">true</param> - <param name="toolOffset" type="float" min="0.0" max="20.0" precision="2" _gui-text="Tool offset (mm)" _gui-description="The offset from the tool tip to the tool axis in mm. (Default: 0.25)">0.25</param> + <page name="overcutToolOffset" _gui-text="Plot Features "> + <param name="overcut" type="float" min="0.0" max="100.0" precision="2" _gui-text="Overcut (mm)" _gui-description="The distance in mm that will be cut over the starting point of the path to prevent open paths, set to 0.0 to omit command. (Default: 1.00)">1.00</param> + <param name="toolOffset" type="float" min="0.0" max="20.0" precision="2" _gui-text="Tool offset (mm)" _gui-description="The offset from the tool tip to the tool axis in mm, set to 0.0 to omit command. (Default: 0.25)">0.25</param> <param name="precut" type="boolean" _gui-text="Use precut" _gui-description="Check this to cut a small line before the real drawing starts to correctly align the tool orientation. (Default: Checked)">true</param> - </page> - <page name="misc" _gui-text="Miscellaneous"> <param name="flat" type="float" min="0.1" max="10.0" precision="1" _gui-text="Curve flatness" _gui-description="Curves are divided into lines, this number controls how fine the curves will be reproduced, the smaller the finer. (Default: '1.2')">1.2</param> - <param name="offsetX" type="float" min="-10000.0" max="10000.0" precision="2" _gui-text="X offset (mm)" _gui-description="Shifts your drawing on the X axis in mm. (Default: '0.00')">0.00</param> - <param name="offsetY" type="float" min="-10000.0" max="10000.0" precision="2" _gui-text="Y offset (mm)" _gui-description="Shifts your drawing on the Y axis in mm. (Default: '0.00')">0.00</param> <param name="autoAlign" type="boolean" _gui-text="Auto align" _gui-description="Check this to auto align the drawing to the zero point (Plus the tool offset if used). If unchecked you have to make sure that all parts of your drawing are within the document border! (Default: Checked)">true</param> </page> </param> diff --git a/share/extensions/hpgl_output.py b/share/extensions/hpgl_output.py index 02157eb95..5b5521926 100755 --- a/share/extensions/hpgl_output.py +++ b/share/extensions/hpgl_output.py @@ -26,8 +26,7 @@ import inkex inkex.localize() -# TODO: Unittests -class MyEffect(inkex.Effect): +class HpglOutput(inkex.Effect): def __init__(self): inkex.Effect.__init__(self) @@ -41,14 +40,10 @@ class MyEffect(inkex.Effect): self.OptionParser.add_option('--mirrorX', action='store', type='inkbool', dest='mirrorX', default='FALSE', help='Mirror X axis') self.OptionParser.add_option('--mirrorY', action='store', type='inkbool', dest='mirrorY', default='FALSE', help='Mirror Y axis') self.OptionParser.add_option('--center', action='store', type='inkbool', dest='center', default='FALSE', help='Center zero point') - self.OptionParser.add_option('--flat', action='store', type='float', dest='flat', default=1.2, help='Curve flatness') - self.OptionParser.add_option('--useOvercut', action='store', type='inkbool', dest='useOvercut', default='TRUE', help='Use overcut') self.OptionParser.add_option('--overcut', action='store', type='float', dest='overcut', default=1.0, help='Overcut (mm)') - self.OptionParser.add_option('--useToolOffset', action='store', type='inkbool', dest='useToolOffset', default='TRUE', help='Correct tool offset') self.OptionParser.add_option('--toolOffset', action='store', type='float', dest='toolOffset', default=0.25, help='Tool offset (mm)') self.OptionParser.add_option('--precut', action='store', type='inkbool', dest='precut', default='TRUE', help='Use precut') - self.OptionParser.add_option('--offsetX', action='store', type='float', dest='offsetX', default=0.0, help='X offset (mm)') - self.OptionParser.add_option('--offsetY', action='store', type='float', dest='offsetY', default=0.0, help='Y offset (mm)') + self.OptionParser.add_option('--flat', action='store', type='float', dest='flat', default=1.2, help='Curve flatness') self.OptionParser.add_option('--autoAlign', action='store', type='inkbool', dest='autoAlign', default='TRUE', help='Auto align') def effect(self): @@ -74,7 +69,7 @@ class MyEffect(inkex.Effect): if __name__ == '__main__': # start extension - e = MyEffect() + e = HpglOutput() e.affect() # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99
\ No newline at end of file diff --git a/share/extensions/plotter.inx b/share/extensions/plotter.inx index c8f009140..fc620f8a3 100644 --- a/share/extensions/plotter.inx +++ b/share/extensions/plotter.inx @@ -8,7 +8,7 @@ <dependency type="executable" location="extensions">inkex.py</dependency> <_param name="introduction" type="description">Please make sure that all objects you want to plot are converted to paths.</_param> <param name="tab" type="notebook"> - <page name="misc" _gui-text="Connection"> + <page name="misc" _gui-text="Connection Settings "> <param name="serialPort" type="string" _gui-text="Serial port" _gui-description="The port of your serial connection, on Windows something like 'COM1', on Linux something like: '/dev/ttyUSB0'. (Default: COM1)">COM1</param> <param name="serialBaudRate" type="optiongroup" appearance="minimal" _gui-text="Serial baud rate" _gui-description="The Baud rate of your serial connection. (Default: 9600)"> <option value="9600">9600</option> @@ -43,7 +43,7 @@ <_param name="serialHelp" type="description">This can be a physical serial connection or a USB-to-Serial bridge. Ask your plotter manufacturer for drivers if needed.</_param> <_param name="parallelHelp" type="description">Parallel (LPT) connections are not supported.</_param> </page> - <page name="plotter" _gui-text="Plotter Settings"> + <page name="plotter" _gui-text="Plotter Settings "> <param name="resolutionX" type="float" min="1.0" max="4096.0" precision="1" _gui-text="Resolution X (dpi)" _gui-description="The amount of steps the plotter moves if it moves for 1 inch on the X axis. (Default: 1016.0)">1016.0</param> <param name="resolutionY" type="float" min="1.0" max="4096.0" precision="1" _gui-text="Resolution Y (dpi)" _gui-description="The amount of steps the plotter moves if it moves for 1 inch on the Y axis. (Default: 1016.0)">1016.0</param> <param name="pen" type="int" min="0" max="99" _gui-text="Pen number" _gui-description="The number of the pen (tool) to use. (Standard: '1')">1</param> @@ -59,25 +59,18 @@ <param name="mirrorY" type="boolean" _gui-text="Mirror Y axis" _gui-description="Check this to mirror the Y axis. (Default: Unchecked)">false</param> <param name="center" type="boolean" _gui-text="Center zero point" _gui-description="Check this if your plotter uses a centered zero point. (Default: Unchecked)">false</param> </page> - <page name="overcutToolOffset" _gui-text="Overcut & Tool Offset"> - <param name="useOvercut" type="boolean" _gui-text="Use overcut" _gui-description="Check this to use overcut, if not checked the 'Overcut' parameter is unused. (Default: Checked)">true</param> - <param name="overcut" type="float" min="0.0" max="100.0" precision="2" _gui-text="Overcut (mm)" _gui-description="The distance in mm that will be cut over the starting point of the path to prevent open paths. (Default: 1.00)">1.00</param> - <param name="space" type="description"> </param> - <param name="useToolOffset" type="boolean" _gui-text="Use tool offset correction" _gui-description="Check this to use the tool offset correction, if not checked the 'Tool offset' and 'Precut' parameters are unused. (Default: Checked)">true</param> - <param name="toolOffset" type="float" min="0.0" max="20.0" precision="2" _gui-text="Tool offset (mm)" _gui-description="The offset from the tool tip to the tool axis in mm. (Default: 0.25)">0.25</param> + <page name="misc" _gui-text="Plot Features "> + <param name="overcut" type="float" min="0.0" max="100.0" precision="2" _gui-text="Overcut (mm)" _gui-description="The distance in mm that will be cut over the starting point of the path to prevent open paths, set to 0.0 to omit command. (Default: 1.00)">1.00</param> + <param name="toolOffset" type="float" min="0.0" max="20.0" precision="2" _gui-text="Tool offset (mm)" _gui-description="The offset from the tool tip to the tool axis in mm, set to 0.0 to omit command. (Default: 0.25)">0.25</param> <param name="precut" type="boolean" _gui-text="Use precut" _gui-description="Check this to cut a small line before the real drawing starts to correctly align the tool orientation. (Default: Checked)">true</param> - </page> - <page name="misc" _gui-text="Miscellaneous"> <param name="flat" type="float" min="0.1" max="10.0" precision="1" _gui-text="Curve flatness" _gui-description="Curves are divided into lines, this number controls how fine the curves will be reproduced, the smaller the finer. (Default: '1.2')">1.2</param> - <param name="offsetX" type="float" min="-10000.0" max="10000.0" precision="2" _gui-text="X offset (mm)" _gui-description="Shifts your drawing on the X axis in mm. (Default: '0.00')">0.00</param> - <param name="offsetY" type="float" min="-10000.0" max="10000.0" precision="2" _gui-text="Y offset (mm)" _gui-description="Shifts your drawing on the Y axis in mm. (Default: '0.00')">0.00</param> <param name="autoAlign" type="boolean" _gui-text="Auto align" _gui-description="Check this to auto align the drawing to the zero point (Plus the tool offset if used). If unchecked you have to make sure that all parts of your drawing are within the document border! (Default: Checked)">true</param> <param name="space" type="description"> </param> <param name="debug" type="boolean" _gui-text="Show debug information" _gui-description="Check this to get verbose information about the plot without actually sending something to the plotter (A.k.a. data dump). (Default: Unchecked)">false</param> </page> </param> <_param name="settingsHelp" type="description">All these settings depend on the plotter you use, for more information please consult the manual or homepage for your plotter.</_param> - <effect needs-live-preview="false"> + <effect needs-live-preview="false" needs-document="true"> <object-type>path</object-type> <effects-menu> <submenu _name="Export"/> diff --git a/share/extensions/plotter.py b/share/extensions/plotter.py index 67d40a92a..be59f604b 100644 --- a/share/extensions/plotter.py +++ b/share/extensions/plotter.py @@ -30,8 +30,7 @@ import inkex inkex.localize() -# TODO: Unittests -class MyEffect(inkex.Effect): +class Plot(inkex.Effect): def __init__(self): inkex.Effect.__init__(self) @@ -49,14 +48,10 @@ class MyEffect(inkex.Effect): self.OptionParser.add_option('--mirrorX', action='store', type='inkbool', dest='mirrorX', default='FALSE', help='Mirror X axis') self.OptionParser.add_option('--mirrorY', action='store', type='inkbool', dest='mirrorY', default='FALSE', help='Mirror Y axis') self.OptionParser.add_option('--center', action='store', type='inkbool', dest='center', default='FALSE', help='Center zero point') - self.OptionParser.add_option('--flat', action='store', type='float', dest='flat', default=1.2, help='Curve flatness') - self.OptionParser.add_option('--useOvercut', action='store', type='inkbool', dest='useOvercut', default='TRUE', help='Use overcut') self.OptionParser.add_option('--overcut', action='store', type='float', dest='overcut', default=1.0, help='Overcut (mm)') - self.OptionParser.add_option('--useToolOffset', action='store', type='inkbool', dest='useToolOffset', default='TRUE', help='Correct tool offset') self.OptionParser.add_option('--toolOffset', action='store', type='float', dest='toolOffset', default=0.25, help='Tool offset (mm)') self.OptionParser.add_option('--precut', action='store', type='inkbool', dest='precut', default='TRUE', help='Use precut') - self.OptionParser.add_option('--offsetX', action='store', type='float', dest='offsetX', default=0.0, help='X offset (mm)') - self.OptionParser.add_option('--offsetY', action='store', type='float', dest='offsetY', default=0.0, help='Y offset (mm)') + self.OptionParser.add_option('--flat', action='store', type='float', dest='flat', default=1.2, help='Curve flatness') self.OptionParser.add_option('--autoAlign', action='store', type='inkbool', dest='autoAlign', default='TRUE', help='Auto align') self.OptionParser.add_option('--debug', action='store', type='inkbool', dest='debug', default='FALSE', help='Show debug information') @@ -75,16 +70,17 @@ class MyEffect(inkex.Effect): raise ValueError, ('', type, value), traceback # TODO: Get preview to work. This requires some work on the C++ side to be able to determine if it is # a preview or a final run. (Remember to set <effect needs-live-preview='false'> to true) - # This outcommented code has a user unit issue (getSvg produces px, docWidth could be mm or something else) ''' - # reparse data for preview - self.options.showMovements = True - self.options.docWidth = float(self.unittouu(self.document.getroot().get('width'))) - self.options.docHeight = float(self.unittouu(self.document.getroot().get('height'))) - myHpglDecoder = hpgl_decoder.hpglDecoder(self.hpgl, self.options) - doc, warnings = myHpglDecoder.getSvg() - # deliver document to inkscape - self.document = doc + if MAGIC: + # reparse data for preview + self.options.showMovements = True + self.options.docWidth = self.uutounit(self.unittouu(self.document.getroot().get('width')), "px") + self.options.docHeight = self.uutounit(self.unittouu(self.document.getroot().get('height')), "px") + myHpglDecoder = hpgl_decoder.hpglDecoder(self.hpgl, self.options) + doc, warnings = myHpglDecoder.getSvg() + # deliver document to inkscape + self.document = doc + else: ''' # convert to other formats if self.options.commandLanguage == 'DMPL': @@ -174,14 +170,10 @@ class MyEffect(inkex.Effect): inkex.errormsg(' Mirror X axis: ' + str(self.options.mirrorX)) inkex.errormsg(' Mirror Y axis: ' + str(self.options.mirrorY)) inkex.errormsg(' Center zero point: ' + str(self.options.center)) - inkex.errormsg(' Use overcut: ' + str(self.options.useOvercut)) inkex.errormsg(' Overcut (mm): ' + str(self.options.overcut)) - inkex.errormsg(' Use tool offset correction: ' + str(self.options.useToolOffset)) inkex.errormsg(' Tool offset (mm): ' + str(self.options.toolOffset)) inkex.errormsg(' Use precut: ' + str(self.options.precut)) inkex.errormsg(' Curve flatness: ' + str(self.options.flat)) - inkex.errormsg(' X offset (mm): ' + str(self.options.offsetX)) - inkex.errormsg(' Y offset (mm): ' + str(self.options.offsetY)) inkex.errormsg(' Auto align: ' + str(self.options.autoAlign)) inkex.errormsg(' Show debug information: ' + str(self.options.debug)) inkex.errormsg("\nDocument properties:\n") @@ -216,7 +208,7 @@ class MyEffect(inkex.Effect): if __name__ == '__main__': # start extension - e = MyEffect() + e = Plot() e.affect() # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99
\ No newline at end of file diff --git a/share/extensions/test/hpgl_output.test.py b/share/extensions/test/hpgl_output.test.py index 4d9500b1e..19fdeb661 100755 --- a/share/extensions/test/hpgl_output.test.py +++ b/share/extensions/test/hpgl_output.test.py @@ -12,13 +12,13 @@ sys.path.append('..') # this line allows to import the extension code import unittest from hpgl_output import * -class MyEffectBasicTest(unittest.TestCase): +class HPGLOuputBasicTest(unittest.TestCase): #def setUp(self): def test_run_without_parameters(self): args = [ 'minimal-blank.svg' ] - e = MyEffect() + e = HpglOutput() e.affect( args, False ) #self.assertEqual( e.something, 'some value', 'A commentary about that.' ) |
