diff --git a/extensions/fablabchemnitz/paths_to_openscad/paths_to_openscad.py b/extensions/fablabchemnitz/paths_to_openscad/paths_to_openscad.py index 7fe932ee..f478d049 100644 --- a/extensions/fablabchemnitz/paths_to_openscad/paths_to_openscad.py +++ b/extensions/fablabchemnitz/paths_to_openscad/paths_to_openscad.py @@ -412,6 +412,32 @@ def msg_extrude_by_hull_and_paths(id, prefix): return msg +def remove_umlaut(string): + """ + Removes umlauts from strings and replaces them with the letter+e convention + :param string: string to remove umlauts from + :return: unumlauted string + """ + u = 'ü'.encode() + U = 'Ü'.encode() + a = 'ä'.encode() + A = 'Ä'.encode() + o = 'ö'.encode() + O = 'Ö'.encode() + ss = 'ß'.encode() + + string = string.encode() + string = string.replace(u, b'ue') + string = string.replace(U, b'Ue') + string = string.replace(a, b'ae') + string = string.replace(A, b'Ae') + string = string.replace(o, b'oe') + string = string.replace(O, b'Oe') + string = string.replace(ss, b'ss') + + string = string.decode('utf-8') + return string + class PathsToOpenSCAD(inkex.EffectExtension): def add_arguments(self, pars): @@ -1319,6 +1345,7 @@ module chamfer_sphere(rad=chamfer, res=chamfer_fn) # Remove all punctuation except underscore. badchars = string.punctuation.replace("_", "") + " " name = re.sub("[" + badchars + "]", "_", name) + name = remove_umlaut(name) self.outfile.write("\nmodule %s(h)\n{\n" % name) mi = ""