Skip to content

Commit

Permalink
Allow to save probed pointcloud to .XYZ format for meshlab
Browse files Browse the repository at this point in the history
  • Loading branch information
Harvie committed Oct 10, 2018
1 parent 6e97617 commit 018c786
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
18 changes: 12 additions & 6 deletions CNC.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,19 @@ def read(f):
# Save level information to file
#----------------------------------------------------------------------
def save(self, filename=None):
if filename is not None:
if filename is None:
filename = self.filename

fn,ext = os.path.splitext(filename)
ext = ext.lower()

f = open(filename,"w")
if ext != '.xyz':
self.filename = filename
f = open(self.filename,"w")
f.write("%g %g %d\n"%(self.xmin, self.xmax, self.xn))
f.write("%g %g %d\n"%(self.ymin, self.ymax, self.yn))
f.write("%g %g %g\n"%(self.zmin, self.zmax, CNC.vars["prbfeed"]))
f.write("\n\n")
f.write("%g %g %d\n"%(self.xmin, self.xmax, self.xn))
f.write("%g %g %d\n"%(self.ymin, self.ymax, self.yn))
f.write("%g %g %g\n"%(self.zmin, self.zmax, CNC.vars["prbfeed"]))
f.write("\n\n")
for j in range(self.yn):
y = self.ymin + self._ystep*j
for i in range(self.xn):
Expand Down
7 changes: 3 additions & 4 deletions Sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,13 +502,12 @@ def load(self, filename):
def save(self, filename):
fn,ext = os.path.splitext(filename)
ext = ext.lower()
if ext == ".probe":
if ext == ".probe" or ext == ".xyz":
# save probe
if not self.gcode.probe.isEmpty():
self.gcode.probe.save(filename)
if filename is not None:
self.gcode.probe.filename = filename
self._saveConfigFile()
if not self.gcode.probe.isEmpty():
self.gcode.probe.save()
elif ext == ".orient":
# save orientation file
self.gcode.orient.save(filename)
Expand Down
2 changes: 1 addition & 1 deletion bCNC.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
(_("G-Code clean"),("*.txt")),
("DXF", "*.dxf"),
("SVG", "*.svg"),
(_("Probe"), "*.probe"),
(_("Probe"), ("*.probe", "*.xyz")),
(_("Orient"), "*.orient"),
("STL", "*.stl"),
(_("All"), "*")]
Expand Down

0 comments on commit 018c786

Please sign in to comment.