本文整理汇总了Python中skeinforge_tools.skeinforge_utilities.gcodec.getFirstWord函数的典型用法代码示例。如果您正苦于以下问题:Python getFirstWord函数的具体用法?Python getFirstWord怎么用?Python getFirstWord使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getFirstWord函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: parseInitialization
def parseInitialization( self ):
"Parse gcode initialization and store the parameters."
for self.lineIndex in xrange( len( self.lines ) ):
line = self.lines[ self.lineIndex ]
splitLine = line.split()
firstWord = gcodec.getFirstWord( splitLine )
if firstWord == 'M108':
self.setOperatingFlowString( splitLine )
elif firstWord == '(<decimalPlacesCarried>':
self.decimalPlacesCarried = int( splitLine[ 1 ] )
elif firstWord == '(<extrusionPerimeterWidth>':
self.extrusionPerimeterWidth = float( splitLine[ 1 ] )
self.supportOutset = self.extrusionPerimeterWidth - self.extrusionPerimeterWidth * self.raftPreferences.supportInsetOverPerimeterExtrusionWidth.value
elif firstWord == '(<extrusionWidth>':
self.extrusionWidth = float( splitLine[ 1 ] )
elif firstWord == '(</extruderInitialization>)':
self.addLine( '(<procedureDone> raft /<procedureDone>)' )
elif firstWord == '(<feedrateMinute>':
self.feedrateMinute = float( splitLine[ 1 ] )
elif firstWord == '(<layer>':
return
elif firstWord == '(<layerThickness>':
self.layerThickness = float( splitLine[ 1 ] )
elif firstWord == '(<orbitalFeedratePerSecond>':
self.orbitalFeedratePerSecond = float( splitLine[ 1 ] )
elif firstWord == '(<supportFlowrate>':
self.supportFlowrateString = splitLine[ 1 ]
elif firstWord == '(<travelFeedratePerSecond>':
self.travelFeedratePerMinute = 60.0 * float( splitLine[ 1 ] )
self.addLine( line )
开发者ID:D1plo1d,项目名称:ReplicatorG,代码行数:30,代码来源:raft.py
示例2: setLayerPixelTable
def setLayerPixelTable( self ):
"Parse a gcode line and add it to the clip skein."
boundaryLoop = None
extruderActive = False
maskPixelTable = {}
self.boundaryLoops = []
self.maskPixelTableTable = {}
self.layerPixelTable = {}
oldLocation = self.oldLocation
for afterIndex in xrange( self.lineIndex + 1, len( self.lines ) ):
line = self.lines[ afterIndex ]
splitLine = gcodec.getSplitLineBeforeBracketSemicolon( line )
firstWord = gcodec.getFirstWord( splitLine )
if firstWord == 'G1':
location = gcodec.getLocationFromSplitLine( oldLocation, splitLine )
if extruderActive and oldLocation != None:
self.addSegmentToPixelTables( location, maskPixelTable, oldLocation )
oldLocation = location
elif firstWord == 'M101':
extruderActive = True
elif firstWord == 'M103':
extruderActive = False
maskPixelTable = {}
elif firstWord == '(</boundaryPerimeter>)':
boundaryLoop = None
elif firstWord == '(<boundaryPoint>':
if boundaryLoop == None:
boundaryLoop = []
self.boundaryLoops.append( boundaryLoop )
location = gcodec.getLocationFromSplitLine( None, splitLine )
boundaryLoop.append( location.dropAxis( 2 ) )
elif firstWord == '(</layer>)':
return
开发者ID:FarMcKon,项目名称:skeinforge,代码行数:33,代码来源:clip.py
示例3: parseLine
def parseLine( self, line ):
"Parse a gcode line."
binary16ByteRepository = self.binary16ByteRepository
splitLine = gcodec.getSplitLineBeforeBracketSemicolon( line )
firstWord = gcodec.getFirstWord( splitLine )
if len( firstWord ) < 1:
return
firstLetter = firstWord[ 0 ]
if firstLetter == '(':
return
feedRateInteger = getIntegerFromCharacterLengthLineOffset( 'F', 0.0, splitLine, binary16ByteRepository.feedRateStepLength.value )
iInteger = getIntegerFromCharacterLengthLineOffset( 'I', 0.0, splitLine, binary16ByteRepository.xStepLength.value )
jInteger = getIntegerFromCharacterLengthLineOffset( 'J', 0.0, splitLine, binary16ByteRepository.yStepLength.value )
xInteger = getIntegerFromCharacterLengthLineOffset( 'X', binary16ByteRepository.xOffset.value, splitLine, binary16ByteRepository.xStepLength.value )
yInteger = getIntegerFromCharacterLengthLineOffset( 'Y', binary16ByteRepository.yOffset.value, splitLine, binary16ByteRepository.yStepLength.value )
zInteger = getIntegerFromCharacterLengthLineOffset( 'Z', binary16ByteRepository.zOffset.value, splitLine, binary16ByteRepository.zStepLength.value )
sixteenByteStruct = Struct( 'cBhhhhhhBc' )
# print( 'xInteger' )
# print( xInteger )
flagInteger = getIntegerFlagFromCharacterSplitLine( 'X', splitLine )
flagInteger += 2 * getIntegerFlagFromCharacterSplitLine( 'Y', splitLine )
flagInteger += 4 * getIntegerFlagFromCharacterSplitLine( 'Z', splitLine )
flagInteger += 8 * getIntegerFlagFromCharacterSplitLine( 'I', splitLine )
flagInteger += 16 * getIntegerFlagFromCharacterSplitLine( 'J', splitLine )
flagInteger += 32 * getIntegerFlagFromCharacterSplitLine( 'F', splitLine )
packedString = sixteenByteStruct.pack( firstLetter, int( firstWord[ 1 : ] ), xInteger, yInteger, zInteger, iInteger, jInteger, feedRateInteger, flagInteger, '#' )
self.output.write( packedString )
开发者ID:CNCBASHER,项目名称:skeinforge,代码行数:27,代码来源:binary_16_byte.py
示例4: parseBoundaries
def parseBoundaries( self ):
"Parse the boundaries and add them to the boundary layers."
boundaryLoop = None
boundaryLayer = None
for line in self.lines[ self.lineIndex : ]:
splitLine = gcodec.getSplitLineBeforeBracketSemicolon( line )
firstWord = gcodec.getFirstWord( splitLine )
if len( self.shutdownLines ) > 0:
self.shutdownLines.append( line )
if firstWord == '(</boundaryPerimeter>)':
boundaryLoop = None
elif firstWord == '(<boundaryPoint>':
location = gcodec.getLocationFromSplitLine( None, splitLine )
if boundaryLoop == None:
boundaryLoop = []
boundaryLayer.loops.append( boundaryLoop )
boundaryLoop.append( location.dropAxis( 2 ) )
elif firstWord == '(<layer>':
boundaryLayer = euclidean.LoopLayer( float( splitLine[ 1 ] ) )
self.boundaryLayers.append( boundaryLayer )
elif firstWord == '(</extrusion>)':
self.shutdownLines = [ line ]
for boundaryLayer in self.boundaryLayers:
if not euclidean.isWiddershins( boundaryLayer.loops[ 0 ] ):
boundaryLayer.loops[ 0 ].reverse()
self.boundaryReverseLayers = self.boundaryLayers[ : ]
self.boundaryReverseLayers.reverse()
开发者ID:CNCBASHER,项目名称:skeinforge,代码行数:27,代码来源:coil.py
示例5: getTransferClosestSurroundingLoopLines
def getTransferClosestSurroundingLoopLines( self, oldOrderedLocation, remainingSurroundingLoops ):
"Get and transfer the closest remaining surrounding loop."
if len( remainingSurroundingLoops ) > 0:
oldOrderedLocation.z = remainingSurroundingLoops[ 0 ].z
closestDistance = 999999999999999999.0
closestSurroundingLoop = None
for remainingSurroundingLoop in remainingSurroundingLoops:
distance = euclidean.getNearestDistanceIndex( oldOrderedLocation.dropAxis( 2 ), remainingSurroundingLoop.boundary ).distance
if distance < closestDistance:
closestDistance = distance
closestSurroundingLoop = remainingSurroundingLoop
remainingSurroundingLoops.remove( closestSurroundingLoop )
hasTravelledHighRoad = False
for line in closestSurroundingLoop.lines:
splitLine = gcodec.getSplitLineBeforeBracketSemicolon( line )
firstWord = gcodec.getFirstWord( splitLine )
if firstWord == 'G1':
location = gcodec.getLocationFromSplitLine( self.oldLocation, splitLine )
if not hasTravelledHighRoad:
hasTravelledHighRoad = True
self.addHighThread( location )
if location.z > self.highestZ:
self.highestZ = location.z
self.oldLocation = location
self.distanceFeedRate.addLine( line )
return closestSurroundingLoop
开发者ID:CNCBASHER,项目名称:skeinforge,代码行数:26,代码来源:tower.py
示例6: getNext
def getNext( self ):
"Get next line going backward or raise exception."
while self.lineIndex > 3:
if self.lineIndex == self.firstLineIndex:
raise StopIteration, "You've reached the end of the line."
if self.firstLineIndex == None:
self.firstLineIndex = self.lineIndex
nextLineIndex = self.lineIndex - 1
line = self.lines[ self.lineIndex ]
splitLine = gcodec.getSplitLineBeforeBracketSemicolon( line )
firstWord = gcodec.getFirstWord( splitLine )
if firstWord == 'M103':
if self.isLoop:
nextLineIndex = self.getIndexBeforeNextDeactivate()
else:
raise StopIteration, "You've reached the end of the line."
if firstWord == 'G1':
if self.isBeforeExtrusion():
if self.isLoop:
nextLineIndex = self.getIndexBeforeNextDeactivate()
else:
raise StopIteration, "You've reached the end of the line."
else:
self.lineIndex = nextLineIndex
return line
self.lineIndex = nextLineIndex
raise StopIteration, "You've reached the end of the line."
开发者ID:FarMcKon,项目名称:skeinforge,代码行数:27,代码来源:stretch.py
示例7: parseInitialization
def parseInitialization(self):
"Parse gcode initialization and store the parameters."
for self.lineIndex in xrange(len(self.lines)):
line = self.lines[self.lineIndex]
splitLine = gcodec.getSplitLineBeforeBracketSemicolon(line)
firstWord = gcodec.getFirstWord(splitLine)
self.distanceFeedRate.parseSplitLine(firstWord, splitLine)
if firstWord == "(<layerThickness>":
self.layerThickness = float(splitLine[1])
elif firstWord == "(</extruderInitialization>)":
self.distanceFeedRate.addLine("(<procedureDone> speed </procedureDone>)")
return
elif firstWord == "(<perimeterWidth>":
self.absolutePerimeterWidth = abs(float(splitLine[1]))
self.distanceFeedRate.addTagBracketedLine(
"maximumZDrillFeedRatePerSecond", self.distanceFeedRate.maximumZDrillFeedRatePerSecond
)
self.distanceFeedRate.addTagBracketedLine(
"maximumZTravelFeedRatePerSecond", self.distanceFeedRate.maximumZTravelFeedRatePerSecond
)
self.distanceFeedRate.addTagBracketedLine("operatingFeedRatePerSecond", self.feedRatePerSecond)
if self.speedRepository.addFlowRate.value:
self.distanceFeedRate.addTagBracketedLine(
"operatingFlowRate", self.speedRepository.flowRateSetting.value
)
orbitalFeedRatePerSecond = (
self.feedRatePerSecond * self.speedRepository.orbitalFeedRateOverOperatingFeedRate.value
)
self.distanceFeedRate.addTagBracketedLine("orbitalFeedRatePerSecond", orbitalFeedRatePerSecond)
self.distanceFeedRate.addTagBracketedLine(
"travelFeedRatePerSecond", self.speedRepository.travelFeedRatePerSecond.value
)
self.distanceFeedRate.addLine(line)
开发者ID:jmil,项目名称:SkeinFox,代码行数:33,代码来源:speed.py
示例8: parseInitialization
def parseInitialization( self ):
"Parse gcode initialization and store the parameters."
for self.lineIndex in xrange( len( self.lines ) ):
line = self.lines[ self.lineIndex ]
splitLine = line.split()
firstWord = gcodec.getFirstWord( splitLine )
self.distanceFeedRate.parseSplitLine( firstWord, splitLine )
if firstWord == 'M108':
self.setOperatingFlowString( splitLine )
elif firstWord == '(</extruderInitialization>)':
self.distanceFeedRate.addLine( '(<procedureDone> raft </procedureDone>)' )
elif firstWord == '(<layer>':
return
elif firstWord == '(<layerThickness>':
self.layerThickness = float( splitLine[ 1 ] )
elif firstWord == '(<orbitalFeedRatePerSecond>':
self.orbitalFeedRatePerSecond = float( splitLine[ 1 ] )
elif firstWord == '(<operatingFeedRatePerSecond>':
self.feedRateMinute = 60.0 * float( splitLine[ 1 ] )
elif firstWord == '(<perimeterWidth>':
self.perimeterWidth = float( splitLine[ 1 ] )
self.supportOutset = self.perimeterWidth + self.perimeterWidth * self.raftRepository.supportGapOverPerimeterExtrusionWidth.value
elif firstWord == '(<travelFeedRatePerSecond>':
self.travelFeedRatePerMinute = 60.0 * float( splitLine[ 1 ] )
self.distanceFeedRate.addLine( line )
开发者ID:TeamTeamUSA,项目名称:ReplicatorG,代码行数:25,代码来源:raft.py
示例9: getDistanceToThreadBeginningAfterThreadEnd
def getDistanceToThreadBeginningAfterThreadEnd( self, remainingDistance ):
"Get the distance to the thread beginning after the end of this thread."
extruderOnReached = False
line = self.lines[ self.lineIndex ]
splitLine = gcodec.getSplitLineBeforeBracketSemicolon( line )
lastThreadLocation = gcodec.getLocationFromSplitLine( self.oldLocation, splitLine )
threadEndReached = False
totalDistance = 0.0
for afterIndex in xrange( self.lineIndex + 1, len( self.lines ) ):
line = self.lines[ afterIndex ]
splitLine = gcodec.getSplitLineBeforeBracketSemicolon( line )
firstWord = gcodec.getFirstWord( splitLine )
if firstWord == 'G1':
location = gcodec.getLocationFromSplitLine( lastThreadLocation, splitLine )
if threadEndReached:
totalDistance += location.distance( lastThreadLocation )
if totalDistance >= remainingDistance:
return None
if extruderOnReached:
return totalDistance
lastThreadLocation = location
elif firstWord == 'M101':
extruderOnReached = True
elif firstWord == 'M103':
threadEndReached = True
return None
开发者ID:CNCBASHER,项目名称:skeinforge,代码行数:26,代码来源:oozebane.py
示例10: parseLine
def parseLine( self, line ):
"Parse a gcode line."
splitLine = gcodec.getSplitLineBeforeBracketSemicolon( line )
firstWord = gcodec.getFirstWord( splitLine )
if len( firstWord ) < 1:
return
firstLetter = firstWord[ 0 ]
if firstLetter == '(':
return
if firstWord != 'G1' and firstWord != 'G2' and firstWord != 'G3':
self.addLine( line )
return
lineStringIO = cStringIO.StringIO()
lineStringIO.write( firstWord )
self.addCharacterInteger( 'I', lineStringIO, 0.0, splitLine, self.gcodeStepRepository.xStepLength.value )
self.addCharacterInteger( 'J', lineStringIO, 0.0, splitLine, self.gcodeStepRepository.yStepLength.value )
self.addCharacterInteger( 'R', lineStringIO, 0.0, splitLine, self.gcodeStepRepository.radiusStepLength.value )
self.addCharacterInteger( 'X', lineStringIO, self.gcodeStepRepository.xOffset.value, splitLine, self.gcodeStepRepository.xStepLength.value )
self.addCharacterInteger( 'Y', lineStringIO, self.gcodeStepRepository.yOffset.value, splitLine, self.gcodeStepRepository.yStepLength.value )
zString = getCharacterIntegerString( 'Z', self.gcodeStepRepository.zOffset.value, splitLine, self.gcodeStepRepository.zStepLength.value )
feedRateString = getCharacterIntegerString( 'F', 0.0, splitLine, self.gcodeStepRepository.feedRateStepLength.value )
if zString != None:
if zString != self.oldZString or self.gcodeStepRepository.addZEvenWhenUnchanging.value:
self.addStringToLine( lineStringIO, zString )
if feedRateString != None:
if feedRateString != self.oldFeedRateString or self.gcodeStepRepository.addFeedRateEvenWhenUnchanging.value:
self.addStringToLine( lineStringIO, feedRateString )
self.addLine( lineStringIO.getvalue() )
self.oldFeedRateString = feedRateString
self.oldZString = zString
开发者ID:CNCBASHER,项目名称:skeinforge,代码行数:30,代码来源:gcode_step.py
示例11: parseInitialization
def parseInitialization( self ):
"Parse gcode initialization and store the parameters."
for self.lineIndex in xrange( len( self.lines ) ):
line = self.lines[ self.lineIndex ].lstrip()
splitLine = line.split()
firstWord = gcodec.getFirstWord( splitLine )
self.distanceFeedRate.parseSplitLine( firstWord, splitLine )
if firstWord == '(<decimalPlacesCarried>':
self.addInitializationToOutput()
elif firstWord == '(</extruderInitialization>)':
self.distanceFeedRate.addTagBracketedLine( 'procedureDone', 'inset' )
elif firstWord == '(<perimeterWidth>':
self.perimeterWidth = float( splitLine[ 1 ] )
self.halfPerimeterWidth = 0.5 * self.perimeterWidth
self.fromExtrusionFillInset = self.perimeterWidth - self.perimeterWidth * self.insetPreferences.infillPerimeterOverlap.value
if self.insetPreferences.perimeterInfillPreference.value:
self.fromExtrusionFillInset = self.halfPerimeterWidth + 0.5 * self.extrusionWidth - self.extrusionWidth * self.insetPreferences.infillPerimeterOverlap.value
self.distanceFeedRate.addTagBracketedLine( 'fillInset', self.fromExtrusionFillInset )
# Set bridge extrusion width
elif firstWord == '(<layer>':
self.lineIndex -= 1
return
elif firstWord == '(<layerThickness>':
self.layerThickness = float( splitLine[ 1 ] )
self.extrusionWidth = self.insetPreferences.extrusionWidthOverThickness.value * self.layerThickness
self.distanceFeedRate.addTagBracketedLine( 'extrusionWidth', self.distanceFeedRate.getRounded( self.extrusionWidth ) ) # Set extrusion width.
self.distanceFeedRate.addTagBracketedLine( 'infillBridgeWidthOverExtrusionWidth', self.distanceFeedRate.getRounded( self.insetPreferences.infillBridgeWidthOverExtrusionWidth.value ) )
self.distanceFeedRate.addLine( line )
开发者ID:TeamTeamUSA,项目名称:SkeinFox,代码行数:28,代码来源:inset.py
示例12: parseCorner
def parseCorner(self, line):
"Parse a gcode line and use the location to update the bounding corners."
splitLine = line.split()
firstWord = gcodec.getFirstWord(splitLine)
if firstWord == "(<boundaryPoint>":
locationComplex = gcodec.getLocationFromSplitLine(None, splitLine).dropAxis(2)
self.cornerMaximum = euclidean.getMaximum(self.cornerMaximum, locationComplex)
self.cornerMinimum = euclidean.getMinimum(self.cornerMinimum, locationComplex)
开发者ID:TeamTeamUSA,项目名称:ReplicatorG,代码行数:8,代码来源:cool.py
示例13: getNextLocation
def getNextLocation( self ):
"Get the next linear move. Return none is none is found."
for afterIndex in xrange( self.lineIndex + 1, len( self.lines ) ):
line = self.lines[ afterIndex ]
splitLine = gcodec.getSplitLineBeforeBracketSemicolon( line )
if gcodec.getFirstWord( splitLine ) == 'G1':
nextLocation = gcodec.getLocationFromSplitLine( self.oldLocation, splitLine )
return nextLocation
return None
开发者ID:CNCBASHER,项目名称:skeinforge,代码行数:9,代码来源:fillet.py
示例14: getParameterFromJavascript
def getParameterFromJavascript( lines, parameterName, parameterValue ):
"Get a parameter from lines of javascript."
for line in lines:
strippedLine = line.replace( ';', ' ' ).lstrip()
splitLine = strippedLine.split()
firstWord = gcodec.getFirstWord( splitLine )
if firstWord == parameterName:
return float( splitLine[ 2 ] )
return parameterValue
开发者ID:CNCBASHER,项目名称:skeinforge,代码行数:9,代码来源:svg_codec.py
示例15: parseUntilOperatingLayer
def parseUntilOperatingLayer( self ):
"Parse gcode until the operating layer if there is one."
for self.lineIndex in xrange( self.lineIndex, len( self.lines ) ):
line = self.lines[ self.lineIndex ]
splitLine = line.split()
firstWord = gcodec.getFirstWord( splitLine )
self.distanceFeedRate.addLine( line )
if firstWord == '(<operatingLayerEnd>':
return
开发者ID:TeamTeamUSA,项目名称:ReplicatorG,代码行数:9,代码来源:tower.py
示例16: addFacesGivenText
def addFacesGivenText( objText, triangleMesh ):
"Add faces given obj text."
lines = gcodec.getTextLines( objText )
for line in lines:
splitLine = line.split()
firstWord = gcodec.getFirstWord( splitLine )
if firstWord == 'v':
triangleMesh.vertices.append( getVertexGivenLine( line ) )
elif firstWord == 'f':
triangleMesh.faces.append( getFaceGivenLine( line, triangleMesh ) )
开发者ID:TeamTeamUSA,项目名称:ReplicatorG,代码行数:10,代码来源:obj.py
示例17: setMaximumZ
def setMaximumZ( self ):
"Set maximum z."
localOldLocation = None
for line in self.lines[ self.lineIndex : ]:
splitLine = gcodec.getSplitLineBeforeBracketSemicolon( line )
firstWord = gcodec.getFirstWord( splitLine )
if firstWord == 'G1':
location = gcodec.getLocationFromSplitLine( localOldLocation, splitLine )
self.maximumZ = max( self.maximumZ, location.z )
localOldLocation = location
开发者ID:CNCBASHER,项目名称:skeinforge,代码行数:10,代码来源:lift.py
示例18: parseInitialization
def parseInitialization( self ):
"Parse gcode initialization and store the parameters."
for self.lineIndex in xrange( len( self.lines ) ):
line = self.lines[ self.lineIndex ]
splitLine = gcodec.getSplitLineBeforeBracketSemicolon( line )
firstWord = gcodec.getFirstWord( splitLine )
if firstWord == '(</extruderInitialization>)':
return
elif firstWord == '(<operatingFeedRatePerSecond>':
self.feedRateMinute = 60.0 * float( splitLine[ 1 ] )
开发者ID:FarMcKon,项目名称:skeinforge,代码行数:10,代码来源:behold.py
示例19: addRemoveThroughLayer
def addRemoveThroughLayer( self ):
"Parse gcode initialization and store the parameters."
for layerLineIndex in xrange( len( self.layerLines ) ):
line = self.layerLines[ layerLineIndex ]
splitLine = line.split()
firstWord = gcodec.getFirstWord( splitLine )
self.distanceFeedRate.addLine( line )
if firstWord == '(<layer>':
self.layerLines = self.layerLines[ layerLineIndex + 1 : ]
return
开发者ID:TeamTeamUSA,项目名称:SkeinFox,代码行数:10,代码来源:multiply.py
示例20: getIndexBeforeNextDeactivate
def getIndexBeforeNextDeactivate( self ):
"Get index two lines before the deactivate command."
for lineIndex in xrange( self.lineIndex + 1, len( self.lines ) ):
line = self.lines[ lineIndex ]
splitLine = gcodec.getSplitLineBeforeBracketSemicolon( line )
firstWord = gcodec.getFirstWord( splitLine )
if firstWord == 'M103':
return lineIndex - 2
print( 'This should never happen in stretch, no deactivate command was found for this thread.' )
raise StopIteration, "You've reached the end of the line."
开发者ID:FarMcKon,项目名称:skeinforge,代码行数:10,代码来源:stretch.py
注:本文中的skeinforge_tools.skeinforge_utilities.gcodec.getFirstWord函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论