Exemplo n.º 1
0
def fillChainFile(filename=''):
    "Fill the slices of a gcode file.  Chain slice the file if it is a GNU TriangulatedSurface file.  If no filename is specified, fill the first unmodified gcode file in this folder."
    if filename == '':
        unmodified = gcodec.getGNUGcode()
        if len(unmodified) == 0:
            print >> sys.stderr, (
                "There are no unmodified gcode files in this folder.")
            return
        filename = unmodified[0]
    startTime = time.time()
    fillPreferences = FillPreferences()
    preferences.readPreferences(fillPreferences)
    print >> sys.stderr, ('File ' + gcodec.getSummarizedFilename(filename) +
                          ' is being chain filled.')
    gcodeText = gcodec.getFileText(filename)
    if gcodeText == '':
        return
    suffixFilename = filename[:filename.rfind('.')] + '_fill.gcode'
    gcodec.writeFileText(suffixFilename,
                         getFillChainGcode(gcodeText, fillPreferences))
    print >> sys.stderr, ('The filled file is saved as ' + suffixFilename)
    vectorwrite.writeSkeinforgeVectorFile(suffixFilename)
    print >> sys.stderr, ('It took ' +
                          str(int(round(time.time() - startTime))) +
                          ' seconds to fill the file.')
Exemplo n.º 2
0
def towerChainFile(filename=''):
    """Tower a gcode linear move file.  Chain tower the gcode if it is not already towered.
	Depending on the preferences, either arcPoint, arcRadius, arcSegment, bevel or do nothing.
	If no filename is specified, tower the first unmodified gcode file in this folder."""
    if filename == '':
        unmodified = gcodec.getGNUGcode()
        if len(unmodified) == 0:
            print >> sys.stderr, (
                "There are no unmodified gcode files in this folder.")
            return
        filename = unmodified[0]
    towerPreferences = TowerPreferences()
    preferences.readPreferences(towerPreferences)
    startTime = time.time()
    print >> sys.stderr, ('File ' + gcodec.getSummarizedFilename(filename) +
                          ' is being chain towered.')
    gcodeText = gcodec.getFileText(filename)
    if gcodeText == '':
        return
    suffixFilename = filename[:filename.rfind('.')] + '_tower.gcode'
    gcodec.writeFileText(suffixFilename,
                         getTowerChainGcode(gcodeText, towerPreferences))
    print >> sys.stderr, ('The towered file is saved as ' +
                          gcodec.getSummarizedFilename(suffixFilename))
    vectorwrite.writeSkeinforgeVectorFile(suffixFilename)
    print >> sys.stderr, ('It took ' +
                          str(int(round(time.time() - startTime))) +
                          ' seconds to tower the file.')
Exemplo n.º 3
0
def fillChainFile( filename = '' ):
	"Fill the slices of a gcode file.  Chain slice the file if it is a GNU TriangulatedSurface file.  If no filename is specified, fill the first unmodified gcode file in this folder."
	if filename == '':
		unmodified = gcodec.getGNUGcode()
		if len( unmodified ) == 0:
			print >> sys.stderr, ( "There are no unmodified gcode files in this folder." )
			return
		filename = unmodified[ 0 ]
	startTime = time.time()
	fillPreferences = FillPreferences()
	preferences.readPreferences( fillPreferences )
	print >> sys.stderr, ( 'File ' + gcodec.getSummarizedFilename( filename ) + ' is being chain filled.' )
	gcodeText = gcodec.getFileText( filename )
	if gcodeText == '':
		return
	suffixFilename = filename[ : filename.rfind( '.' ) ] + '_fill.gcode'
	gcodec.writeFileText( suffixFilename, getFillChainGcode( gcodeText, fillPreferences ) )
	print >> sys.stderr, ( 'The filled file is saved as ' + suffixFilename )
	vectorwrite.writeSkeinforgeVectorFile( suffixFilename )
	print >> sys.stderr, ( 'It took ' + str( int( round( time.time() - startTime ) ) ) + ' seconds to fill the file.' )
Exemplo n.º 4
0
def combChainFile( filename = '' ):
	"""Comb a gcode linear move file.  Chain comb the gcode if it is not already combed.
	Depending on the preferences, either arcPoint, arcRadius, arcSegment, bevel or do nothing.
	If no filename is specified, comb the first unmodified gcode file in this folder."""
	if filename == '':
		unmodified = gcodec.getGNUGcode()
		if len( unmodified ) == 0:
			print >> sys.stderr, ( "There are no unmodified gcode files in this folder." )
			return
		filename = unmodified[ 0 ]
	combPreferences = CombPreferences()
	preferences.readPreferences( combPreferences )
	startTime = time.time()
	print >> sys.stderr, ( 'File ' + gcodec.getSummarizedFilename( filename ) + ' is being chain combed.' )
	gcodeText = gcodec.getFileText( filename )
	if gcodeText == '':
		return
	suffixFilename = filename[ : filename.rfind( '.' ) ] + '_comb.gcode'
	gcodec.writeFileText( suffixFilename, getCombChainGcode( gcodeText, combPreferences ) )
	print >> sys.stderr, ( 'The combed file is saved as ' + gcodec.getSummarizedFilename( suffixFilename ) )
	vectorwrite.writeSkeinforgeVectorFile( suffixFilename )
	print >> sys.stderr, ( 'It took ' + str( int( round( time.time() - startTime ) ) ) + ' seconds to comb the file.' )