コード例 #1
0
ファイル: raftless.py プロジェクト: LawrenceLeung/PrintJs
	def deriveIntroLine( self, line, splitG1Line, introX, introY, introFeed ):
		"Creates a new linear gcode movement, derived from self.firstLinearGcodeMovement."
		roundedXString = 'X' + self.distanceFeedRate.getRounded( introX )
		roundedYString = 'Y' + self.distanceFeedRate.getRounded( introY )
		roundedFString = 'F' + self.distanceFeedRate.getRounded( introFeed )
		indexOfX = gcodec.indexOfStartingWithSecond( 'X', splitG1Line )
		introLine = line
		if indexOfX == -1:
			introLine = introLine + ' ' + roundedXString;
		else:
			word = splitG1Line[ indexOfX ]
			introLine = introLine.replace( word, roundedXString )
		indexOfY = gcodec.indexOfStartingWithSecond( 'Y', splitG1Line )
		if indexOfY == -1:
			introLine = introLine + ' ' + roundedYString;
		else:
			word = splitG1Line[ indexOfY ]
			introLine = introLine.replace( word, roundedYString )
		indexOfF = gcodec.indexOfStartingWithSecond( 'F', splitG1Line )
		if indexOfF == -1:
			introLine = introLine + ' ' + roundedFString;
		else:
			word = splitG1Line[ indexOfF ]
			introLine = introLine.replace( word, roundedFString )
		return introLine;	
コード例 #2
0
ファイル: statistic.py プロジェクト: weeberp/MakerDroid
	def getLocationSetFeedRateToSplitLine( self, splitLine ):
		"Get location ans set feed rate to the plsit line."
		location = gcodec.getLocationFromSplitLine( self.oldLocation, splitLine )
		indexOfF = gcodec.indexOfStartingWithSecond( "F", splitLine )
		if indexOfF > 0:
			self.feedRateMinute = gcodec.getDoubleAfterFirstLetter( splitLine[ indexOfF ] )
		return location
コード例 #3
0
ファイル: raftless.py プロジェクト: LawrenceLeung/PrintJs
	def getRaftlessSpeededLine( self, line, splitLine ):
		"Get gcode line with raftless feed rate."
		roundedFString = 'F' + self.distanceFeedRate.getRounded( self.feedRateMinute )
		indexOfF = gcodec.indexOfStartingWithSecond( 'F', splitLine )
		if indexOfF == - 1:
			return line + ' ' + roundedFString
		word = splitLine[ indexOfF ]
		return line.replace( word, roundedFString )
コード例 #4
0
ファイル: speed.py プロジェクト: lImbus/giseburt-ReplicatorG
 def getSpeededLine(self, line, splitLine):
     "Get gcode line with feed rate."
     if gcodec.indexOfStartingWithSecond('F', splitLine) > 0:
         return line
     feedRateMinute = 60.0 * self.feedRatePerSecond
     if self.isBridgeLayer:
         feedRateMinute *= self.repository.bridgeFeedRateMultiplier.value
     if self.isPerimeter:
         feedRateMinute *= self.repository.perimeterFeedRateOverOperatingFeedRate.value
     self.addFlowRateLineIfNecessary()
     if not self.isExtruderActive:
         feedRateMinute = self.travelFeedRatePerMinute
     return line + ' ' + self.distanceFeedRate.getRounded(feedRateMinute)
コード例 #5
0
 def helicalMove(self, isCounterclockwise, splitLine):
     "Get statistics for a helical move."
     if self.oldLocation == None:
         return
     location = self.getLocationSetFeedRateToSplitLine(splitLine)
     location += self.oldLocation
     center = self.oldLocation.copy()
     indexOfR = gcodec.indexOfStartingWithSecond("R", splitLine)
     if indexOfR > 0:
         radius = gcodec.getDoubleAfterFirstLetter(splitLine[indexOfR])
         halfLocationMinusOld = location - self.oldLocation
         halfLocationMinusOld *= 0.5
         halfLocationMinusOldLength = halfLocationMinusOld.magnitude()
         centerMidpointDistanceSquared = radius * radius - halfLocationMinusOldLength * halfLocationMinusOldLength
         centerMidpointDistance = math.sqrt(
             max(centerMidpointDistanceSquared, 0.0))
         centerMinusMidpoint = euclidean.getRotatedWiddershinsQuarterAroundZAxis(
             halfLocationMinusOld)
         centerMinusMidpoint.normalize()
         centerMinusMidpoint *= centerMidpointDistance
         if isCounterclockwise:
             center.setToVector3(halfLocationMinusOld + centerMinusMidpoint)
         else:
             center.setToVector3(halfLocationMinusOld - centerMinusMidpoint)
     else:
         center.x = gcodec.getDoubleForLetter("I", splitLine)
         center.y = gcodec.getDoubleForLetter("J", splitLine)
     curveSection = 0.5
     center += self.oldLocation
     afterCenterSegment = location - center
     beforeCenterSegment = self.oldLocation - center
     afterCenterDifferenceAngle = euclidean.getAngleAroundZAxisDifference(
         afterCenterSegment, beforeCenterSegment)
     absoluteDifferenceAngle = abs(afterCenterDifferenceAngle)
     steps = int(
         round(0.5 + max(
             absoluteDifferenceAngle * 2.4,
             absoluteDifferenceAngle * beforeCenterSegment.magnitude() /
             curveSection)))
     stepPlaneAngle = euclidean.getWiddershinsUnitPolar(
         afterCenterDifferenceAngle / steps)
     zIncrement = (afterCenterSegment.z -
                   beforeCenterSegment.z) / float(steps)
     for step in xrange(1, steps):
         beforeCenterSegment = euclidean.getRoundZAxisByPlaneAngle(
             stepPlaneAngle, beforeCenterSegment)
         beforeCenterSegment.z += zIncrement
         arcPoint = center + beforeCenterSegment
         self.addToPath(arcPoint)
     self.addToPath(location)
コード例 #6
0
ファイル: statistic.py プロジェクト: elmom/Skeinforge-Mirror
 def helicalMove(self, isCounterclockwise, splitLine):
     "Get statistics for a helical move."
     if self.oldLocation == None:
         return
     location = self.getLocationSetFeedRateToSplitLine(splitLine)
     location += self.oldLocation
     center = self.oldLocation.copy()
     indexOfR = gcodec.indexOfStartingWithSecond("R", splitLine)
     if indexOfR > 0:
         radius = gcodec.getDoubleAfterFirstLetter(splitLine[indexOfR])
         halfLocationMinusOld = location - self.oldLocation
         halfLocationMinusOld *= 0.5
         halfLocationMinusOldLength = halfLocationMinusOld.magnitude()
         centerMidpointDistanceSquared = radius * radius - halfLocationMinusOldLength * halfLocationMinusOldLength
         centerMidpointDistance = math.sqrt(max(centerMidpointDistanceSquared, 0.0))
         centerMinusMidpoint = euclidean.getRotatedWiddershinsQuarterAroundZAxis(halfLocationMinusOld)
         centerMinusMidpoint.normalize()
         centerMinusMidpoint *= centerMidpointDistance
         if isCounterclockwise:
             center.setToVector3(halfLocationMinusOld + centerMinusMidpoint)
         else:
             center.setToVector3(halfLocationMinusOld - centerMinusMidpoint)
     else:
         center.x = gcodec.getDoubleForLetter("I", splitLine)
         center.y = gcodec.getDoubleForLetter("J", splitLine)
     curveSection = 0.5
     center += self.oldLocation
     afterCenterSegment = location - center
     beforeCenterSegment = self.oldLocation - center
     afterCenterDifferenceAngle = euclidean.getAngleAroundZAxisDifference(afterCenterSegment, beforeCenterSegment)
     absoluteDifferenceAngle = abs(afterCenterDifferenceAngle)
     steps = int(
         round(
             0.5
             + max(
                 absoluteDifferenceAngle * 2.4,
                 absoluteDifferenceAngle * beforeCenterSegment.magnitude() / curveSection,
             )
         )
     )
     stepPlaneAngle = euclidean.getWiddershinsUnitPolar(afterCenterDifferenceAngle / steps)
     zIncrement = (afterCenterSegment.z - beforeCenterSegment.z) / float(steps)
     for step in xrange(1, steps):
         beforeCenterSegment = euclidean.getRoundZAxisByPlaneAngle(stepPlaneAngle, beforeCenterSegment)
         beforeCenterSegment.z += zIncrement
         arcPoint = center + beforeCenterSegment
         self.addToPath(arcPoint)
     self.addToPath(location)