def getLineWithTruncatedNumber(self, character, line, splitLine): 'Get a line with the number after the character truncated.' numberString = gcodec.getStringFromCharacterSplitLine(character, splitLine) if numberString == None: return line roundedNumberString = euclidean.getRoundedToPlacesString(self.decimalPlacesExported, float(numberString)) return gcodec.getLineWithValueString(character, line, splitLine, roundedNumberString)
def setSliceElementZ(decimalPlacesCarried, sliceElement, sliceElementIndex, z): "Set the slice element z." roundedZ = euclidean.getRoundedToPlacesString(decimalPlacesCarried, z) idValue = 'z:%s' % roundedZ sliceElement.attributeDictionary['id'] = idValue textElement = sliceElement.getFirstChildWithClassName('text') textElement.text = 'Layer %s, %s' % (sliceElementIndex, idValue)
def getRoundedRulingText( self, extraDecimalPlaces, number ): 'Get the rounded ruling text.' rulingText = euclidean.getRoundedToPlacesString( extraDecimalPlaces - math.floor( math.log10( self.rulingSeparationWidthMillimeters ) ), number ) if self.rulingSeparationWidthMillimeters < .99: return rulingText if rulingText[ - len('.0') : ] == '.0': return rulingText[ : - len('.0') ] return rulingText
def getRounded(self, number): 'Get number rounded to the number of carried decimal places as a string.' return euclidean.getRoundedToPlacesString(self.decimalPlacesCarried, number)