コード例 #1
0
def combFile(filename=''):
    """Comb a gcode linear move file.  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.getUnmodifiedGCodeFiles()
        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)
    if not combPreferences.comb.value:
        print >> sys.stderr, (
            'The preference is to not comb, so nothing will be done.')
        return
    print >> sys.stderr, ('File ' + gcodec.getSummarizedFilename(filename) +
                          ' is being combed.')
    gcodeText = gcodec.getFileText(filename)
    if gcodeText == '':
        return
    suffixFilename = filename[:filename.rfind('.')] + '_comb.gcode'
    gcodec.writeFileText(suffixFilename,
                         getCombGcode(gcodeText, combPreferences))
    print >> sys.stderr, ('The combed file is saved as ' + suffixFilename)
    vectorwrite.writeSkeinforgeVectorFile(suffixFilename)
コード例 #2
0
ファイル: tower.py プロジェクト: syky27/emcrepstrap
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.')
コード例 #3
0
ファイル: tower.py プロジェクト: syky27/emcrepstrap
def towerFile(filename=''):
    """Tower a gcode linear move file.  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.getUnmodifiedGCodeFiles()
        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)
    if towerPreferences.maximumTowerHeight.value < 1:
        print >> sys.stderr, (
            'The maximum tower height preference is less than one, so nothing will be done.'
        )
        return
    print >> sys.stderr, ('File ' + gcodec.getSummarizedFilename(filename) +
                          ' is being towered.')
    gcodeText = gcodec.getFileText(filename)
    if gcodeText == '':
        return
    suffixFilename = filename[:filename.rfind('.')] + '_tower.gcode'
    gcodec.writeFileText(suffixFilename,
                         getTowerGcode(gcodeText, towerPreferences))
    print >> sys.stderr, ('The towered file is saved as ' + suffixFilename)
    vectorwrite.writeSkeinforgeVectorFile(suffixFilename)
コード例 #4
0
ファイル: fill.py プロジェクト: syky27/emcrepstrap
def fillFile(filename=''):
    "Fill the slices of a gcode file.  If no filename is specified, fill the first unmodified gcode file in this folder."
    if filename == '':
        unmodified = gcodec.getUnmodifiedGCodeFiles()
        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 filled.')
    gcodeText = gcodec.getFileText(filename)
    if gcodeText == '':
        return
    suffixFilename = filename[:filename.rfind('.')] + '_fill.gcode'
    gcodec.writeFileText(suffixFilename,
                         getFillGcode(gcodeText, fillPreferences))
    print >> sys.stderr, ('The filled file is saved as ' +
                          gcodec.getSummarizedFilename(suffixFilename))
    vectorwrite.writeSkeinforgeVectorFile(suffixFilename)
    print >> sys.stderr, ('It took ' +
                          str(int(round(time.time() - startTime))) +
                          ' seconds to fill the file.')
コード例 #5
0
ファイル: vectorwrite.py プロジェクト: syky27/emcrepstrap
def getVectorGcode( gcodeText, vectorwritePreferences = None ):
	"Write a gcode text."
	if gcodeText == '':
		return ''
	if vectorwritePreferences == None:
		vectorwritePreferences = VectorwritePreferences()
		preferences.readPreferences( vectorwritePreferences )
	skein = VectorwriteSkein()
	skein.parseGcode( gcodeText, vectorwritePreferences )
	return skein.vectorWindow.getVectorFormattedText()
コード例 #6
0
def getSliceGcode( gnuTriangulatedSurfaceText, slicePreferences = None ):
	"Slice a GNU Triangulated Surface text."
	if gnuTriangulatedSurfaceText == '':
		return ''
	if slicePreferences == None:
		slicePreferences = SlicePreferences()
		preferences.readPreferences( slicePreferences )
	skein = SliceSkein()
	skein.parseGcode( slicePreferences, gnuTriangulatedSurfaceText )
	return skein.output.getvalue()
コード例 #7
0
ファイル: fill.py プロジェクト: syky27/emcrepstrap
def getFillGcode(gcodeText, fillPreferences=None):
    "Fill the slices of a gcode text."
    if gcodeText == '':
        return ''
    if gcodec.isProcedureDone(gcodeText, 'fill'):
        return gcodeText
    if fillPreferences == None:
        fillPreferences = FillPreferences()
        preferences.readPreferences(fillPreferences)
    skein = FillSkein()
    skein.parseGcode(fillPreferences, gcodeText)
    return skein.output.getvalue()
コード例 #8
0
ファイル: fill.py プロジェクト: brendanjerwin/emcrepstrap
def getFillGcode( gcodeText, fillPreferences = None ):
	"Fill the slices of a gcode text."
	if gcodeText == '':
		return ''
	if gcodec.isProcedureDone( gcodeText, 'fill' ):
		return gcodeText
	if fillPreferences == None:
		fillPreferences = FillPreferences()
		preferences.readPreferences( fillPreferences )
	skein = FillSkein()
	skein.parseGcode( fillPreferences, gcodeText )
	return skein.output.getvalue()
コード例 #9
0
ファイル: tower.py プロジェクト: brendanjerwin/emcrepstrap
def getTowerGcode( gcodeText, towerPreferences = None ):
	"Tower a gcode linear move text."
	if gcodeText == '':
		return ''
	if gcodec.isProcedureDone( gcodeText, 'tower' ):
		return gcodeText
	if towerPreferences == None:
		towerPreferences = TowerPreferences()
		preferences.readPreferences( towerPreferences )
	if towerPreferences.maximumTowerHeight.value < 1:
		return gcodeText
	skein = TowerSkein()
	skein.parseGcode( gcodeText, towerPreferences )
	return skein.output.getvalue()
コード例 #10
0
def getStretchGcode(gcodeText, stretchPreferences=None):
    "Stretch a gcode linear move text."
    if gcodeText == '':
        return ''
    if gcodec.isProcedureDone(gcodeText, 'stretch'):
        return gcodeText
    if stretchPreferences == None:
        stretchPreferences = StretchPreferences()
        preferences.readPreferences(stretchPreferences)
    if stretchPreferences.stretchOverHalfExtrusionWidth.value <= 0.0:
        return gcodeText
    skein = StretchSkein()
    skein.parseGcode(gcodeText, stretchPreferences)
    return skein.output.getvalue()
コード例 #11
0
ファイル: comb.py プロジェクト: brendanjerwin/emcrepstrap
def getCombGcode( gcodeText, combPreferences = None ):
	"Comb a gcode linear move text."
	if gcodeText == '':
		return ''
	if gcodec.isProcedureDone( gcodeText, 'comb' ):
		return gcodeText
	if combPreferences == None:
		combPreferences = CombPreferences()
		preferences.readPreferences( combPreferences )
	if not combPreferences.comb.value:
		return gcodeText
	skein = CombSkein()
	skein.parseGcode( gcodeText )
	return skein.output.getvalue()
コード例 #12
0
ファイル: tower.py プロジェクト: syky27/emcrepstrap
def getTowerGcode(gcodeText, towerPreferences=None):
    "Tower a gcode linear move text."
    if gcodeText == '':
        return ''
    if gcodec.isProcedureDone(gcodeText, 'tower'):
        return gcodeText
    if towerPreferences == None:
        towerPreferences = TowerPreferences()
        preferences.readPreferences(towerPreferences)
    if towerPreferences.maximumTowerHeight.value < 1:
        return gcodeText
    skein = TowerSkein()
    skein.parseGcode(gcodeText, towerPreferences)
    return skein.output.getvalue()
コード例 #13
0
ファイル: stretch.py プロジェクト: brendanjerwin/emcrepstrap
def getStretchGcode( gcodeText, stretchPreferences = None ):
	"Stretch a gcode linear move text."
	if gcodeText == '':
		return ''
	if gcodec.isProcedureDone( gcodeText, 'stretch' ):
		return gcodeText
	if stretchPreferences == None:
		stretchPreferences = StretchPreferences()
		preferences.readPreferences( stretchPreferences )
	if stretchPreferences.stretchOverHalfExtrusionWidth.value <= 0.0:
		return gcodeText
	skein = StretchSkein()
	skein.parseGcode( gcodeText, stretchPreferences )
	return skein.output.getvalue()
コード例 #14
0
def getCombGcode(gcodeText, combPreferences=None):
    "Comb a gcode linear move text."
    if gcodeText == '':
        return ''
    if gcodec.isProcedureDone(gcodeText, 'comb'):
        return gcodeText
    if combPreferences == None:
        combPreferences = CombPreferences()
        preferences.readPreferences(combPreferences)
    if not combPreferences.comb.value:
        return gcodeText
    skein = CombSkein()
    skein.parseGcode(gcodeText)
    return skein.output.getvalue()
コード例 #15
0
ファイル: fillet.py プロジェクト: brendanjerwin/emcrepstrap
def bevelFile( filename = '' ):
	"Bevel a gcode linear move file.  If no filename is specified, bevel the first unmodified gcode file in this folder."
	if filename == '':
		unmodified = gcodec.getUnmodifiedGCodeFiles()
		if len( unmodified ) == 0:
			print >> sys.stderr, ( "There are no unmodified gcode files in this folder." )
			return
		filename = unmodified[ 0 ]
	filletPreferences = FilletPreferences()
	preferences.readPreferences( filletPreferences )
	print >> sys.stderr, ( 'File ' + gcodec.getSummarizedFilename( filename ) + ' is being beveled.' )
	gcodeText = gcodec.getFileText( filename )
	if gcodeText == '':
		return
	gcodec.writeFileMessageSuffix( filename, getBevelGcode( filletPreferences, gcodeText ), 'The beveled file is saved as ', '_fillet' )
コード例 #16
0
ファイル: fillet.py プロジェクト: brendanjerwin/emcrepstrap
def arcRadiusFile( filename = '' ):
	"Fillet a gcode linear move file into a helical radius move file.  If no filename is specified, arc radius the first unmodified gcode file in this folder."
	if filename == '':
		unmodified = gcodec.getUnmodifiedGCodeFiles()
		if len( unmodified ) == 0:
			print >> sys.stderr, ( "There are no unmodified gcode files in this folder." )
			return
		filename = unmodified[ 0 ]
	filletPreferences = FilletPreferences()
	preferences.readPreferences( filletPreferences )
	print >> sys.stderr, ( 'File ' + gcodec.getSummarizedFilename( filename ) + ' is being filleted into arc radiuses.' )
	gcodeText = gcodec.getFileText( filename )
	if gcodeText == '':
		return
	gcodec.writeFileMessageSuffix( filename, getArcRadiusGcode( filletPreferences, gcodeText ), 'The arc radius file is saved as ', '_fillet' )
コード例 #17
0
ファイル: vectorwrite.py プロジェクト: syky27/emcrepstrap
def writeVectorFile( filename = '' ):
	"Write scalable vector graphics for a gcode file.  If no filename is specified, write scalable vector graphics for the first gcode file in this folder."
	if filename == '':
		unmodified = gcodec.getFilesWithFileTypeWithoutWords( 'gcode' )
		if len( unmodified ) == 0:
			print >> sys.stderr, ( "There is no gcode file in this folder." )
			return
		filename = unmodified[ 0 ]
	vectorwritePreferences = VectorwritePreferences()
	preferences.readPreferences( vectorwritePreferences )
	print >> sys.stderr, ( 'Scalable vector graphics are being generated for the file ' + gcodec.getSummarizedFilename( filename ) )
	fileText = gcodec.getFileText( filename )
	suffixFilename = filename[ : filename.rfind( '.' ) ] + '.svg'
	suffixFilename = suffixFilename.replace( ' ', '_' )
	gcodec.writeFileText( suffixFilename, getVectorGcode( fileText, vectorwritePreferences ) )
	print >> sys.stderr, ( 'The scalable vector graphics file is saved as ' + gcodec.getSummarizedFilename( suffixFilename ) )
コード例 #18
0
ファイル: fillet.py プロジェクト: brendanjerwin/emcrepstrap
def getFilletGcode( gcodeText, filletPreferences = None ):
	"Fillet a gcode linear move text."
	if gcodeText == '':
		return ''
	if gcodec.isProcedureDone( gcodeText, 'fillet' ):
		return gcodeText
	if filletPreferences == None:
		filletPreferences = FilletPreferences()
		preferences.readPreferences( filletPreferences )
	if filletPreferences.arcPoint.value:
		return getArcPointGcode( filletPreferences, gcodeText )
	elif filletPreferences.arcRadius.value:
		return getArcRadiusGcode( filletPreferences, gcodeText )
	elif filletPreferences.arcSegment.value:
		return getArcSegmentGcode( filletPreferences, gcodeText )
	elif filletPreferences.bevel.value:
		return getBevelGcode( filletPreferences, gcodeText )
	return gcodeText
コード例 #19
0
ファイル: fillet.py プロジェクト: syky27/emcrepstrap
def getFilletGcode(gcodeText, filletPreferences=None):
    "Fillet a gcode linear move text."
    if gcodeText == '':
        return ''
    if gcodec.isProcedureDone(gcodeText, 'fillet'):
        return gcodeText
    if filletPreferences == None:
        filletPreferences = FilletPreferences()
        preferences.readPreferences(filletPreferences)
    if filletPreferences.arcPoint.value:
        return getArcPointGcode(filletPreferences, gcodeText)
    elif filletPreferences.arcRadius.value:
        return getArcRadiusGcode(filletPreferences, gcodeText)
    elif filletPreferences.arcSegment.value:
        return getArcSegmentGcode(filletPreferences, gcodeText)
    elif filletPreferences.bevel.value:
        return getBevelGcode(filletPreferences, gcodeText)
    return gcodeText
コード例 #20
0
ファイル: stretch.py プロジェクト: brendanjerwin/emcrepstrap
def stretchFile( filename = '' ):
	"""Stretch a gcode linear move file.  Depending on the preferences, either arcPoint, arcRadius, arcSegment, bevel or do nothing.
	If no filename is specified, stretch the first unmodified gcode file in this folder."""
	if filename == '':
		unmodified = gcodec.getUnmodifiedGCodeFiles()
		if len( unmodified ) == 0:
			print >> sys.stderr, ( "There are no unmodified gcode files in this folder." )
			return
		filename = unmodified[ 0 ]
	stretchPreferences = StretchPreferences()
	preferences.readPreferences( stretchPreferences )
	print >> sys.stderr, ( 'File ' + gcodec.getSummarizedFilename( filename ) + ' is being stretched.' )
	gcodeText = gcodec.getFileText( filename )
	if gcodeText == '':
		return
	suffixFilename = filename[ : filename.rfind( '.' ) ] + '_stretch.gcode'
	gcodec.writeFileText( suffixFilename, getStretchGcode( gcodeText, stretchPreferences ) )
	print >> sys.stderr, ( 'The stretched file is saved as ' + suffixFilename )
	vectorwrite.writeSkeinforgeVectorFile( suffixFilename )
コード例 #21
0
ファイル: fillet.py プロジェクト: syky27/emcrepstrap
def bevelFile(filename=''):
    "Bevel a gcode linear move file.  If no filename is specified, bevel the first unmodified gcode file in this folder."
    if filename == '':
        unmodified = gcodec.getUnmodifiedGCodeFiles()
        if len(unmodified) == 0:
            print >> sys.stderr, (
                "There are no unmodified gcode files in this folder.")
            return
        filename = unmodified[0]
    filletPreferences = FilletPreferences()
    preferences.readPreferences(filletPreferences)
    print >> sys.stderr, ('File ' + gcodec.getSummarizedFilename(filename) +
                          ' is being beveled.')
    gcodeText = gcodec.getFileText(filename)
    if gcodeText == '':
        return
    gcodec.writeFileMessageSuffix(filename,
                                  getBevelGcode(filletPreferences, gcodeText),
                                  'The beveled file is saved as ', '_fillet')
コード例 #22
0
ファイル: fillet.py プロジェクト: syky27/emcrepstrap
def arcRadiusFile(filename=''):
    "Fillet a gcode linear move file into a helical radius move file.  If no filename is specified, arc radius the first unmodified gcode file in this folder."
    if filename == '':
        unmodified = gcodec.getUnmodifiedGCodeFiles()
        if len(unmodified) == 0:
            print >> sys.stderr, (
                "There are no unmodified gcode files in this folder.")
            return
        filename = unmodified[0]
    filletPreferences = FilletPreferences()
    preferences.readPreferences(filletPreferences)
    print >> sys.stderr, ('File ' + gcodec.getSummarizedFilename(filename) +
                          ' is being filleted into arc radiuses.')
    gcodeText = gcodec.getFileText(filename)
    if gcodeText == '':
        return
    gcodec.writeFileMessageSuffix(
        filename, getArcRadiusGcode(filletPreferences, gcodeText),
        'The arc radius file is saved as ', '_fillet')
コード例 #23
0
def sliceFile( filename = '' ):
	"Slice a GNU Triangulated Surface file.  If no filename is specified, slice the first GNU Triangulated Surface file in this folder."
	if filename == '':
		unmodified = gcodec.getGNUTriangulatedSurfaceFiles()
		if len( unmodified ) == 0:
			print >> sys.stderr, ( "There are no GNU Triangulated Surface files in this folder." )
			return
		filename = unmodified[ 0 ]
	startTime = time.time()
	slicePreferences = SlicePreferences()
	preferences.readPreferences( slicePreferences )
	print >> sys.stderr, ( 'File ' + gcodec.getSummarizedFilename( filename ) + ' is being sliced.' )
	gnuTriangulatedSurfaceText = gcodec.getFileText( filename )
	if gnuTriangulatedSurfaceText == '':
		return
	suffixFilename = filename[ : filename.rfind( '.' ) ] + '_slice.gcode'
	gcodec.writeFileText( suffixFilename, getSliceGcode( gnuTriangulatedSurfaceText, slicePreferences ) )
	print >> sys.stderr, ( 'The sliced file is saved as ' + gcodec.getSummarizedFilename( suffixFilename ) )
	vectorwrite.writeSkeinforgeVectorFile( suffixFilename )
	print >> sys.stderr, ( 'It took ' + str( int( round( time.time() - startTime ) ) ) + ' seconds to slice the file.' )
コード例 #24
0
ファイル: fill.py プロジェクト: brendanjerwin/emcrepstrap
def fillFile( filename = '' ):
	"Fill the slices of a gcode file.  If no filename is specified, fill the first unmodified gcode file in this folder."
	if filename == '':
		unmodified = gcodec.getUnmodifiedGCodeFiles()
		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 filled.' )
	gcodeText = gcodec.getFileText( filename )
	if gcodeText == '':
		return
	suffixFilename = filename[ : filename.rfind( '.' ) ] + '_fill.gcode'
	gcodec.writeFileText( suffixFilename, getFillGcode( gcodeText, fillPreferences ) )
	print >> sys.stderr, ( 'The filled file is saved as ' + gcodec.getSummarizedFilename( suffixFilename ) )
	vectorwrite.writeSkeinforgeVectorFile( suffixFilename )
	print >> sys.stderr, ( 'It took ' + str( int( round( time.time() - startTime ) ) ) + ' seconds to fill the file.' )
コード例 #25
0
def stretchFile(filename=''):
    """Stretch a gcode linear move file.  Depending on the preferences, either arcPoint, arcRadius, arcSegment, bevel or do nothing.
	If no filename is specified, stretch the first unmodified gcode file in this folder."""
    if filename == '':
        unmodified = gcodec.getUnmodifiedGCodeFiles()
        if len(unmodified) == 0:
            print >> sys.stderr, (
                "There are no unmodified gcode files in this folder.")
            return
        filename = unmodified[0]
    stretchPreferences = StretchPreferences()
    preferences.readPreferences(stretchPreferences)
    print >> sys.stderr, ('File ' + gcodec.getSummarizedFilename(filename) +
                          ' is being stretched.')
    gcodeText = gcodec.getFileText(filename)
    if gcodeText == '':
        return
    suffixFilename = filename[:filename.rfind('.')] + '_stretch.gcode'
    gcodec.writeFileText(suffixFilename,
                         getStretchGcode(gcodeText, stretchPreferences))
    print >> sys.stderr, ('The stretched file is saved as ' + suffixFilename)
    vectorwrite.writeSkeinforgeVectorFile(suffixFilename)
コード例 #26
0
ファイル: comb.py プロジェクト: brendanjerwin/emcrepstrap
def combFile( filename = '' ):
	"""Comb a gcode linear move file.  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.getUnmodifiedGCodeFiles()
		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 )
	if not combPreferences.comb.value:
		print >> sys.stderr, ( 'The preference is to not comb, so nothing will be done.' )
		return
	print >> sys.stderr, ( 'File ' + gcodec.getSummarizedFilename( filename ) + ' is being combed.' )
	gcodeText = gcodec.getFileText( filename )
	if gcodeText == '':
		return
	suffixFilename = filename[ : filename.rfind( '.' ) ] + '_comb.gcode'
	gcodec.writeFileText( suffixFilename, getCombGcode( gcodeText, combPreferences ) )
	print >> sys.stderr, ( 'The combed file is saved as ' + suffixFilename )
	vectorwrite.writeSkeinforgeVectorFile( suffixFilename )
コード例 #27
0
ファイル: comb.py プロジェクト: brendanjerwin/emcrepstrap
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.' )
コード例 #28
0
ファイル: tower.py プロジェクト: brendanjerwin/emcrepstrap
def towerFile( filename = '' ):
	"""Tower a gcode linear move file.  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.getUnmodifiedGCodeFiles()
		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 )
	if towerPreferences.maximumTowerHeight.value < 1:
		print >> sys.stderr, ( 'The maximum tower height preference is less than one, so nothing will be done.' )
		return
	print >> sys.stderr, ( 'File ' + gcodec.getSummarizedFilename( filename ) + ' is being towered.' )
	gcodeText = gcodec.getFileText( filename )
	if gcodeText == '':
		return
	suffixFilename = filename[ : filename.rfind( '.' ) ] + '_tower.gcode'
	gcodec.writeFileText( suffixFilename, getTowerGcode( gcodeText, towerPreferences ) )
	print >> sys.stderr, ( 'The towered file is saved as ' + suffixFilename )
	vectorwrite.writeSkeinforgeVectorFile( suffixFilename )
コード例 #29
0
ファイル: vectorwrite.py プロジェクト: syky27/emcrepstrap
def writeSkeinforgeVectorFile( filename ):
	"Write scalable vector graphics for a skeinforge gcode file, if 'Write Scalable Vector Graphics for Skeinforge Chain' is selected."
	vectorwritePreferences = VectorwritePreferences()
	preferences.readPreferences( vectorwritePreferences )
	if vectorwritePreferences.writeSkeinforgeSVG.value:
		writeVectorFile( filename )