diff --git a/extensions/fablabchemnitz/vpypetools/vpypetools.py b/extensions/fablabchemnitz/vpypetools/vpypetools.py index 218a4866..49f48993 100644 --- a/extensions/fablabchemnitz/vpypetools/vpypetools.py +++ b/extensions/fablabchemnitz/vpypetools/vpypetools.py @@ -92,6 +92,20 @@ class vpypetools (inkex.EffectExtension): # Plugin Occult self.arg_parser.add_argument("--plugin_occult", type=inkex.Boolean, default=False) self.arg_parser.add_argument("--plugin_occult_tolerance", type=float, default=0.01, help="Max distance between start and end point to consider a path closed (default 0.01 mm)") + + # Free Mode + self.arg_parser.add_argument("--tab") + self.arg_parser.add_argument("--freemode", type=inkex.Boolean, default=False) + self.arg_parser.add_argument("--freemode_cmd1") + self.arg_parser.add_argument("--freemode_cmd1_enabled", type=inkex.Boolean, default=True) + self.arg_parser.add_argument("--freemode_cmd2") + self.arg_parser.add_argument("--freemode_cmd2_enabled", type=inkex.Boolean, default=False) + self.arg_parser.add_argument("--freemode_cmd3") + self.arg_parser.add_argument("--freemode_cmd3_enabled", type=inkex.Boolean, default=False) + self.arg_parser.add_argument("--freemode_cmd4") + self.arg_parser.add_argument("--freemode_cmd4_enabled", type=inkex.Boolean, default=False) + self.arg_parser.add_argument("--freemode_cmd5") + self.arg_parser.add_argument("--freemode_cmd5_enabled", type=inkex.Boolean, default=False) # General Settings self.arg_parser.add_argument("--flattenbezier", type=inkex.Boolean, default=False, help="Flatten bezier curves to polylines") @@ -224,7 +238,10 @@ class vpypetools (inkex.EffectExtension): command += " --closed" if self.options.filter_not_closed is True: command += " --not-closed" - if self.options.filter_closed is False and self.options.filter_not_closed is False and self.options.filter_min_length_enabled is False and self.options.filter_max_length_enabled is False: + if self.options.filter_closed is False and \ + self.options.filter_not_closed is False and \ + self.options.filter_min_length_enabled is False and \ + self.options.filter_max_length_enabled is False: inkex.errormsg('No filters to apply. Please select at least one filter.') return @@ -232,8 +249,35 @@ class vpypetools (inkex.EffectExtension): if self.options.plugin_occult is True: command = "occult --tolerance " + str(self.options.plugin_occult_tolerance) + # Free Mode + if self.options.freemode is True: + command = "" + if self.options.freemode_cmd1_enabled is True: + command += " " + self.options.freemode_cmd1.strip() + if self.options.freemode_cmd2_enabled is True: + command += " " + self.options.freemode_cmd2.strip() + if self.options.freemode_cmd3_enabled is True: + command += " " + self.options.freemode_cmd3.strip() + if self.options.freemode_cmd4_enabled is True: + command += " " + self.options.freemode_cmd4.strip() + if self.options.freemode_cmd5_enabled is True: + command += " " + self.options.freemode_cmd5.strip() + if self.options.freemode_cmd1_enabled is False and \ + self.options.freemode_cmd2_enabled is False and \ + self.options.freemode_cmd3_enabled is False and \ + self.options.freemode_cmd4_enabled is False and \ + self.options.freemode_cmd5_enabled is False: + inkex.utils.debug("Please enabled at least one set of commands") + return + else: + inkex.utils.debug("Your command pipe will be the following: " + command) + # inkex.utils.debug(command) - doc = execute(command, doc) + try: + doc = execute(command, doc) + except Exception as e: + inkex.utils.debug("Error in vpype:" + str(e)) + return ########################################## diff --git a/extensions/fablabchemnitz/vpypetools/vpypetools_freemode.inx b/extensions/fablabchemnitz/vpypetools/vpypetools_freemode.inx new file mode 100644 index 00000000..11211f09 --- /dev/null +++ b/extensions/fablabchemnitz/vpypetools/vpypetools_freemode.inx @@ -0,0 +1,48 @@ + + + vpype Free Mode + fablabchemnitz.de.vpype_free_mode + + + + true + layout 1024x768 translate 150px 50px + true + scaleto -o 0 0 330 200 + false + rotate 30.0 + false + skew 45.0 60.0 + false + splitall + false + + + true + 0.100 + false + false + false + false + false + true + true + 1.000 + 1.000 + + + + + + + + + + + + + + + \ No newline at end of file