diff --git a/.gitignore b/.gitignore index 7d46f40a..ce33b515 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.pyc .idea/ -tests/tmp/ \ No newline at end of file +tests/tmp/ +build/ \ No newline at end of file diff --git a/README.md b/README.md index 507ee573..44062523 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ CAD program, and create G-Code for Isolation routing. 19.01.2019 - added initial implementation of HPGL postprocessor +- fixed display HPGL code geometry on canvas 11.01.2019 diff --git a/camlib.py b/camlib.py index abcfc195..f9412835 100644 --- a/camlib.py +++ b/camlib.py @@ -5212,6 +5212,13 @@ class CNCjob(Geometry): command['Y'] = float(match_z.group(2).replace(" ", "")) * 0.025 command['Z'] = float(match_z.group(3).replace(" ", "")) * 0.025 + elif 'hpgl' in self.pp_excellon_name or 'hpgl' in self.pp_geometry_name: + match_pa = re.search(r"^PA(\s*-?\d+\.\d+?),(\s*\s*-?\d+\.\d+?)*;$", gline) + if match_pa: + command['G'] = 0 + command['X'] = float(match_pa.group(1).replace(" ", "")) + command['Y'] = float(match_pa.group(2).replace(" ", "")) + else: match = re.search(r'^\s*([A-Z])\s*([\+\-\.\d\s]+)', gline) while match: @@ -5260,6 +5267,8 @@ class CNCjob(Geometry): if 'Z' in gobj: if 'Roland' in self.pp_excellon_name or 'Roland' in self.pp_geometry_name: pass + elif 'hpgl' in self.pp_excellon_name or 'hpgl' in self.pp_geometry_name: + pass elif ('X' in gobj or 'Y' in gobj) and gobj['Z'] != current['Z']: log.warning("Non-orthogonal motion: From %s" % str(current)) log.warning(" To: %s" % str(gobj))