本文整理汇总了Python中CNC.GCode.saveDXF方法的典型用法代码示例。如果您正苦于以下问题:Python GCode.saveDXF方法的具体用法?Python GCode.saveDXF怎么用?Python GCode.saveDXF使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CNC.GCode
的用法示例。
在下文中一共展示了GCode.saveDXF方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from CNC import GCode [as 别名]
# 或者: from CNC.GCode import saveDXF [as 别名]
#.........这里部分代码省略.........
def load(self, filename):
fn,ext = os.path.splitext(filename)
if ext==".probe":
if filename is not None:
self.gcode.probe.filename = filename
self._saveConfigFile()
self.gcode.probe.load(filename)
elif ext == ".stl":
# FIXME: implements solid import???
pass
elif ext==".dxf":
self.gcode.init()
self.gcode.importDXF(filename)
self._saveConfigFile(filename)
else:
self.gcode.load(filename)
self._saveConfigFile()
Utils.addRecent(filename)
#----------------------------------------------------------------------
def save(self, filename):
fn,ext = os.path.splitext(filename)
if ext == ".probe":
# save probe
if filename is not None:
self.gcode.probe.filename = filename
self._saveConfigFile()
if not self.gcode.probe.isEmpty():
self.gcode.probe.save()
elif ext == ".stl":
#save probe as STL
self.gcode.probe.saveAsSTL(filename)
elif ext == ".dxf":
return self.gcode.saveDXF(filename)
else:
if filename is not None:
self.gcode.filename = filename
self._saveConfigFile()
Utils.addRecent(self.gcode.filename)
return self.gcode.save()
#----------------------------------------------------------------------
def saveAll(self, event=None):
if self.gcode.filename:
self.save(self.gcode.filename)
if self.gcode.probe.filename:
self.save(self.gcode.probe.filename)
return "break"
#----------------------------------------------------------------------
# Open serial port
#----------------------------------------------------------------------
def open(self, device, baudrate):
self.serial = serial.Serial( device,
baudrate,
bytesize=serial.EIGHTBITS,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
timeout=0.1,
xonxoff=False,
rtscts=False)
# Toggle DTR to reset Arduino
self.serial.setDTR(0)
time.sleep(1)
CNC.vars["state"] = CONNECTED
CNC.vars["color"] = STATECOLOR[CNC.vars["state"]]
示例2: __init__
# 需要导入模块: from CNC import GCode [as 别名]
# 或者: from CNC.GCode import saveDXF [as 别名]
#.........这里部分代码省略.........
elif ext == ".orient":
# save orientation file
self.gcode.orient.load(filename)
elif ext == ".stl":
# FIXME: implements solid import???
pass
elif ext==".dxf":
self.gcode.init()
self.gcode.importDXF(filename)
self._saveConfigFile(filename)
else:
self.gcode.load(filename)
self._saveConfigFile()
Utils.addRecent(filename)
#----------------------------------------------------------------------
def save(self, filename):
fn,ext = os.path.splitext(filename)
ext = ext.lower()
if ext == ".probe":
# save probe
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)
elif ext == ".stl":
#save probe as STL
self.gcode.probe.saveAsSTL(filename)
elif ext == ".dxf":
return self.gcode.saveDXF(filename)
else:
if filename is not None:
self.gcode.filename = filename
self._saveConfigFile()
Utils.addRecent(self.gcode.filename)
return self.gcode.save()
#----------------------------------------------------------------------
def saveAll(self, event=None):
if self.gcode.filename:
self.save(self.gcode.filename)
if self.gcode.probe.filename:
self.save(self.gcode.probe.filename)
return "break"
#----------------------------------------------------------------------
# Open serial port
#----------------------------------------------------------------------
def open(self, device, baudrate):
self.serial = serial.Serial( device,
baudrate,
bytesize=serial.EIGHTBITS,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
timeout=0.1,
xonxoff=False,
rtscts=False)
# Toggle DTR to reset Arduino
try:
self.serial.setDTR(0)
except IOError:
pass
示例3: __init__
# 需要导入模块: from CNC import GCode [as 别名]
# 或者: from CNC.GCode import saveDXF [as 别名]
#.........这里部分代码省略.........
# FIXME: implements solid import???
import tkMessageBox
tkMessageBox.showinfo("Open 3D Mesh", "Importing of 3D mesh files in .STL and .PLY format is supported by SliceMesh plugin.\nYou can find it in Tools->SliceMesh.")
elif ext==".dxf":
self.gcode.init()
self.gcode.importDXF(filename)
self._saveConfigFile(filename)
elif ext==".svg":
self.gcode.init()
self.gcode.importSVG(filename)
self._saveConfigFile(filename)
else:
self.gcode.load(filename)
self._saveConfigFile()
Utils.addRecent(filename)
#----------------------------------------------------------------------
def save(self, filename):
fn,ext = os.path.splitext(filename)
ext = ext.lower()
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._saveConfigFile()
elif ext == ".orient":
# save orientation file
self.gcode.orient.save(filename)
elif ext == ".stl":
#save probe as STL
self.gcode.probe.saveAsSTL(filename)
elif ext == ".dxf":
return self.gcode.saveDXF(filename)
elif ext == ".svg":
return self.gcode.saveSVG(filename)
elif ext == ".txt":
#save gcode as txt (only enabled blocks and no bCNC metadata)
return self.gcode.saveTXT(filename)
else:
if filename is not None:
self.gcode.filename = filename
self._saveConfigFile()
Utils.addRecent(self.gcode.filename)
return self.gcode.save()
#----------------------------------------------------------------------
def saveAll(self, event=None):
if self.gcode.filename:
self.save(self.gcode.filename)
if self.gcode.probe.filename:
self.save(self.gcode.probe.filename)
return "break"
#----------------------------------------------------------------------
# Open serial port
#----------------------------------------------------------------------
def open(self, device, baudrate):
#self.serial = serial.Serial(
self.serial = serial.serial_for_url(
device,
baudrate,
bytesize=serial.EIGHTBITS,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
timeout=SERIAL_TIMEOUT,