• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python gcodec.getFileText函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中skeinforge_tools.skeinforge_utilities.gcodec.getFileText函数的典型用法代码示例。如果您正苦于以下问题:Python getFileText函数的具体用法?Python getFileText怎么用?Python getFileText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了getFileText函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: readPreferences

def readPreferences( archivablePreferences ):
	"Set an archive to the preferences read from a file."
	text = gcodec.getFileText( archivablePreferences.fileNamePreferences )
	if text == '':
		print( 'Since the preferences file:' )
		print( archivablePreferences.fileNamePreferences )
		print( 'does not exist, the default preferences will be written to that file.' )
		text = gcodec.getFileText( os.path.join( 'defaults', os.path.basename( archivablePreferences.fileNamePreferences ) ) )
		if text != '':
			readPreferencesFromText( archivablePreferences, text )
		writePreferences( archivablePreferences )
		return
	readPreferencesFromText( archivablePreferences, text )
开发者ID:TeamTeamUSA,项目名称:SkeinFox,代码行数:13,代码来源:preferences.py


示例2: getCraftedText

def getCraftedText( fileName, text = '', repository = None ):
	"Get cleaved text."
	if gcodec.getHasSuffix( fileName, '.svg' ):
		if text == '':
			text = gcodec.getFileText( fileName )
		return text
	return getCraftedTextFromFileName( fileName, repository = None )
开发者ID:CNCBASHER,项目名称:skeinforge,代码行数:7,代码来源:cleave.py


示例3: getCarving

def getCarving( fileName = '' ):
	"Get the triangle mesh for the stl file."
	if fileName == '':
		unmodified = gcodec.getFilesWithFileTypeWithoutWords( 'stl' )
		if len( unmodified ) == 0:
			print( "There is no stl file in this folder." )
			return None
		fileName = unmodified[ 0 ]
	stlData = gcodec.getFileText( fileName, 'rb' )
	if stlData == '':
		return None
	triangleMesh = triangle_mesh.TriangleMesh()
	vertexIndexTable = {}
	binarySolidworksHeaderErrorString = 'solid binary STL from Solid Edge, Unigraphics Solutions Inc.'
	binarySolidworksHeaderError = stlData[ : len( binarySolidworksHeaderErrorString ) ] == binarySolidworksHeaderErrorString
	if binarySolidworksHeaderError:
		print( 'The solidworks file has the incorrect header:' )
		print( binarySolidworksHeaderErrorString )
		print( 'A binary stl should never start with the word "solid".  Because this error is common the file is been parsed as binary regardless.' )
	if ( stlData[ : 5 ] == 'solid' and not binarySolidworksHeaderError ):
		addFacesGivenText( stlData, triangleMesh, vertexIndexTable )
	else:
		addFacesGivenBinary( stlData, triangleMesh, vertexIndexTable )
	triangleMesh.setEdgesForAllFaces()
	return triangleMesh
开发者ID:D1plo1d,项目名称:ReplicatorG,代码行数:25,代码来源:stl.py


示例4: getCraftedText

def getCraftedText(fileName, text="", repository=None):
    "Get chopped text."
    if gcodec.getHasSuffix(fileName, ".svg"):
        if text == "":
            text = gcodec.getFileText(fileName)
        return text
    return getCraftedTextFromFileName(fileName, repository=None)
开发者ID:bmander,项目名称:skeinforge,代码行数:7,代码来源:chop.py


示例5: writeOutput

def writeOutput( fileName, gcodeText = '' ):
	"Write statistics for a skeinforge gcode file, if 'Write Statistics File for Skeinforge Chain' is selected."
	repository = settings.getReadRepository( StatisticRepository() )
	if gcodeText == '':
		gcodeText = gcodec.getFileText( fileName )
	if repository.activateStatistic.value:
		analyzeFileGivenText( fileName, gcodeText, repository )
开发者ID:CNCBASHER,项目名称:skeinforge,代码行数:7,代码来源:statistic.py


示例6: addInitializationToOutput

	def addInitializationToOutput( self ):
		"Add initialization gcode to the output."
		self.addFromUpperLowerFile( self.prefacePreferences.nameOfStartFile.value ) # Add a start file if it exists.
		self.distanceFeedRate.addTagBracketedLine( 'creator', 'skeinforge' ) # GCode formatted comment
		absoluteFilePathUntilDot = os.path.abspath( __file__ )[ : os.path.abspath( __file__ ).rfind( '.' ) ]
		if absoluteFilePathUntilDot == '/home/enrique/Desktop/backup/babbleold/script/reprap/pyRepRap/skeinforge_tools/craft_plugins/preface': #check to see if this script is on Enrique's computer
			gcodec.writeFileText( gcodec.getVersionFileName(), date.today().isoformat() )
		versionText = gcodec.getFileText( gcodec.getVersionFileName() )
		self.distanceFeedRate.addTagBracketedLine( 'version', versionText ) # GCode formatted comment
		self.distanceFeedRate.addLine( '(<extruderInitialization>)' ) # GCode formatted comment
		if self.prefacePreferences.setPositioningToAbsolute.value:
			self.distanceFeedRate.addLine( 'G90' ) # Set positioning to absolute.
		if self.prefacePreferences.setUnitsToMillimeters.value:
			self.distanceFeedRate.addLine( 'G21' ) # Set units to millimeters.
		if self.prefacePreferences.startAtHome.value:
			self.distanceFeedRate.addLine( 'G28' ) # Start at home.
		if self.prefacePreferences.turnExtruderOffAtStartUp.value:
			self.distanceFeedRate.addLine( 'M103' ) # Turn extruder off.
		self.distanceFeedRate.addTagBracketedLine( 'decimalPlacesCarried', self.distanceFeedRate.decimalPlacesCarried )
		if self.prefacePreferences.extrusionDistanceAbsolutePreference.value:
			self.distanceFeedRate.extrusionDistanceFormat = 'absolute'
		if self.prefacePreferences.extrusionDistanceRelativePreference.value:
			self.distanceFeedRate.extrusionDistanceFormat = 'relative'
		if self.distanceFeedRate.extrusionDistanceFormat != '':
			self.distanceFeedRate.addTagBracketedLine( 'extrusionDistanceFormat', self.distanceFeedRate.extrusionDistanceFormat )
		self.distanceFeedRate.addTagBracketedLine( 'layerThickness', self.distanceFeedRate.getRounded( self.layerThickness ) )
		self.distanceFeedRate.addTagBracketedLine( 'perimeterWidth', self.distanceFeedRate.getRounded( self.perimeterWidth ) )
		self.distanceFeedRate.addTagBracketedLine( 'procedureDone', 'carve' )
		self.distanceFeedRate.addTagBracketedLine( 'procedureDone', 'preface' )
		self.distanceFeedRate.addLine( '(</extruderInitialization>)' ) # Initialization is finished, extrusion is starting.
		self.distanceFeedRate.addLine( '(<extrusion>)' ) # Initialization is finished, extrusion is starting.
开发者ID:TeamTeamUSA,项目名称:SkeinFox,代码行数:31,代码来源:preface.py


示例7: writeOutput

def writeOutput( fileName, gcodeText = '' ):
	"Write a commented gcode file for a skeinforge gcode file, if 'Write Commented File for Skeinforge Chain' is selected."
	repository = settings.getReadRepository( CommentRepository() )
	if gcodeText == '':
		gcodeText = gcodec.getFileText( fileName )
	if repository.activateComment.value:
		analyzeFileGivenText( fileName, gcodeText )
开发者ID:CNCBASHER,项目名称:skeinforge,代码行数:7,代码来源:comment.py


示例8: getCraftedText

def getCraftedText( fileName, text = '', chopPreferences = None ):
	"Get chopped text."
	if gcodec.getHasSuffix( fileName, '.svg' ):
		if text == '':
			text = gcodec.getFileText( fileName )
		return text
	return getCraftedTextFromFileName( fileName, chopPreferences = None )
开发者ID:TeamTeamUSA,项目名称:SkeinFox,代码行数:7,代码来源:chop.py


示例9: readWriteDeleteHypertextHelp

def readWriteDeleteHypertextHelp( documentDirectoryPath, fileName ):
	"Read the pydoc hypertext help documents, write them in the documentation folder then delete the originals."
	print( fileName )
	filePath = os.path.join( documentDirectoryPath, fileName )
	fileText = gcodec.getFileText( fileName )
	fileText = getWrappedHypertext( fileText )
	gcodec.writeFileText( filePath, fileText )
	os.remove( fileName )
开发者ID:TeamTeamUSA,项目名称:ReplicatorG,代码行数:8,代码来源:docwrap.py


示例10: writeOutput

def writeOutput( fileName, gcodeText = '' ):
	"Write a commented gcode file for a skeinforge gcode file, if 'Write Commented File for Skeinforge Chain' is selected."
	commentPreferences = CommentPreferences()
	preferences.getReadRepository( commentPreferences )
	if gcodeText == '':
		gcodeText = gcodec.getFileText( fileName )
	if commentPreferences.activateComment.value:
		writeCommentFileGivenText( fileName, gcodeText )
开发者ID:TeamTeamUSA,项目名称:ReplicatorG,代码行数:8,代码来源:comment.py


示例11: writeOutput

def writeOutput( fileName, gcodeText = '' ):
	"Write a skeinviewed gcode file for a skeinforge gcode file, if 'Activate Skeinview' is selected."
	skeinviewPreferences = SkeinviewPreferences()
	preferences.readPreferences( skeinviewPreferences )
	if skeinviewPreferences.activateSkeinview.value:
		if gcodeText == '':
			gcodeText = gcodec.getFileText( fileName )
		displaySkeinviewFileGivenText( gcodeText, skeinviewPreferences )
开发者ID:D1plo1d,项目名称:ReplicatorG,代码行数:8,代码来源:skeinview.py


示例12: writeOutput

def writeOutput( fileName, gcodeText = '' ):
	"Write a beholded gcode file for a skeinforge gcode file, if 'Activate Behold' is selected."
	beholdPreferences = BeholdPreferences()
	preferences.readPreferences( beholdPreferences )
	if beholdPreferences.activateBehold.value:
		if gcodeText == '':
			gcodeText = gcodec.getFileText( fileName )
		displayBeholdFileGivenText( gcodeText, beholdPreferences )
开发者ID:D1plo1d,项目名称:ReplicatorG,代码行数:8,代码来源:behold.py


示例13: readWriteNavigationHelp

def readWriteNavigationHelp( documentDirectoryPath, transferredFileNameIndex, transferredFileNames ):
	"Read the hypertext help documents, and add the navigation lines to them."
	fileName = transferredFileNames[ transferredFileNameIndex ]
	print( fileName )
	filePath = os.path.join( documentDirectoryPath, fileName )
	fileText = gcodec.getFileText( filePath )
	fileText = getNavigationHypertext( fileText, transferredFileNameIndex, transferredFileNames )
	gcodec.writeFileText( filePath, fileText )
开发者ID:CNCBASHER,项目名称:skeinforge,代码行数:8,代码来源:wikifier.py


示例14: writeOutput

def writeOutput( fileName, gcodeText = '' ):
	"Write statistics for a skeinforge gcode file, if 'Write Statistics File for Skeinforge Chain' is selected."
	statisticPreferences = StatisticPreferences()
	preferences.getReadPreferences( statisticPreferences )
	if gcodeText == '':
		gcodeText = gcodec.getFileText( fileName )
	if statisticPreferences.activateStatistic.value:
		writeStatisticFileGivenText( fileName, gcodeText, statisticPreferences )
开发者ID:TeamTeamUSA,项目名称:SkeinFox,代码行数:8,代码来源:statistic.py


示例15: writeOutput

def writeOutput( fileName, gcodeText = '' ):
	"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 gcodeText == '':
		gcodeText = gcodec.getFileText( fileName )
	if vectorwritePreferences.activateVectorwrite.value:
		writeVectorFileGivenText( fileName, gcodeText, vectorwritePreferences )
开发者ID:D1plo1d,项目名称:ReplicatorG,代码行数:8,代码来源:vectorwrite.py


示例16: getInsetChainGcode

def getInsetChainGcode( fileName, gcodeText, insetPreferences = None ):
	"Inset the carves of a gcode text.  Chain inset the gcode if it is not already carved."
	if gcodeText == '':
		if fileName[ - len( '.svg' ) : ] == '.svg':
			gcodeText = gcodec.getFileText( fileName )
	if not gcodec.isProcedureDone( gcodeText, '"carve"' ): #"carve" is used instead of carve because quotes have to be used for strings in svg files
		gcodeText = carve.getCarveGcode( fileName )
	return getInsetGcode( gcodeText, insetPreferences )
开发者ID:TeamTeamUSA,项目名称:SkeinFox,代码行数:8,代码来源:inset.py


示例17: commentFile

def commentFile( fileName = '' ):
	"Comment a gcode file.  If no fileName is specified, comment the first gcode file in this folder that is not modified."
	if fileName == '':
		unmodified = gcodec.getUnmodifiedGCodeFiles()
		if len( unmodified ) == 0:
			print( "There are no unmodified gcode files in this folder." )
			return
		fileName = unmodified[ 0 ]
	writeCommentFileGivenText( fileName, gcodec.getFileText( fileName ) )
开发者ID:D1plo1d,项目名称:ReplicatorG,代码行数:9,代码来源:comment.py


示例18: getCarving

def getCarving( fileName = '' ):
	"Get the triangle mesh for the gts file."
	if fileName == '':
		unmodified = gcodec.getFilesWithFileTypeWithoutWords( 'gts' )
		if len( unmodified ) == 0:
			print( "There is no gts file in this folder." )
			return None
		fileName = unmodified[ 0 ]
	return getFromGNUTriangulatedSurfaceText( gcodec.getFileText( fileName ), triangle_mesh.TriangleMesh() )
开发者ID:D1plo1d,项目名称:ReplicatorG,代码行数:9,代码来源:gts.py


示例19: beholdFile

def beholdFile( fileName = '' ):
	"Behold a gcode file.  If no fileName is specified, behold the first gcode file in this folder that is not modified."
	if fileName == '':
		unmodified = gcodec.getUnmodifiedGCodeFiles()
		if len( unmodified ) == 0:
			print( "There are no unmodified gcode files in this folder." )
			return
		fileName = unmodified[ 0 ]
	gcodeText = gcodec.getFileText( fileName )
	displayBeholdFileGivenText( gcodeText )
开发者ID:D1plo1d,项目名称:ReplicatorG,代码行数:10,代码来源:behold.py


示例20: statisticFile

def statisticFile( fileName = '' ):
	"Write statistics for a gcode file.  If no fileName is specified, write statistics for the first gcode file in this folder that is not modified."
	if fileName == '':
		unmodified = gcodec.getUnmodifiedGCodeFiles()
		if len( unmodified ) == 0:
			print( "There are no unmodified gcode files in this folder." )
			return
		fileName = unmodified[ 0 ]
	statisticPreferences = StatisticPreferences()
	preferences.getReadPreferences( statisticPreferences )
	writeStatisticFileGivenText( fileName, gcodec.getFileText( fileName ), statisticPreferences )
开发者ID:TeamTeamUSA,项目名称:SkeinFox,代码行数:11,代码来源:statistic.py



注:本文中的skeinforge_tools.skeinforge_utilities.gcodec.getFileText函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python gcodec.getFirstWord函数代码示例发布时间:2022-05-27
下一篇:
Python polyfile.getFileOrDirectoryTypesUnmodifiedGcode函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap