예제 #1
0
	def parseGcode( self, gcodeText ):
		"Parse gcode text and store the statistics."
		self.characters = 0
		self.cornerHigh = Vector3( - 999999999.0, - 999999999.0, - 999999999.0 )
		self.cornerLow = Vector3( 999999999.0, 999999999.0, 999999999.0 )
		self.extruderActive = False
		self.extruderSpeed = 0.0
		self.extruderToggled = 0
		self.extrusionDiameter = None
		self.extrusionWidth = 0.4
		self.feedrateMinute = 600.0
		self.layerThickness = 0.4
		self.numberOfLines = 0
		self.procedures = []
		self.totalBuildTime = 0.0
		self.totalDistanceExtruded = 0.0
		self.totalDistanceTraveled = 0.0
		lines = gcodec.getTextLines( gcodeText )
		for line in lines:
			self.parseLine( line )
		averageFeedrate = self.totalDistanceTraveled / self.totalBuildTime
		self.characters += self.numberOfLines
		kilobytes = round( self.characters / 1024.0 )
		halfExtrusionWidth = 0.5 * self.extrusionWidth
		halfExtrusionCorner = Vector3( halfExtrusionWidth, halfExtrusionWidth, halfExtrusionWidth )
		self.cornerHigh += halfExtrusionCorner
		self.cornerLow -= halfExtrusionCorner
		extent = self.cornerHigh - self.cornerLow
		roundedHigh = euclidean.getRoundedPoint( self.cornerHigh )
		roundedLow = euclidean.getRoundedPoint( self.cornerLow )
		roundedExtent = euclidean.getRoundedPoint( extent )
		axisString =  " axis, the extrusion starts at "
		volumeExtruded = 0.0009 * self.extrusionWidth * self.layerThickness * self.totalDistanceExtruded # the 9 comes from a typical fill density of 0.9
		self.addLine( "On the X" + axisString + str( int ( roundedLow.x ) ) + " mm and ends at " + str( int ( roundedHigh.x ) ) + " mm, for a width of " + str( int ( extent.x ) ) + " mm" )
		self.addLine( "On the Y" + axisString + str( int ( roundedLow.y ) ) + " mm and ends at " + str( int ( roundedHigh.y ) ) + " mm, for a depth of " + str( int ( extent.y ) ) + " mm" )
		self.addLine( "On the Z" + axisString + str( int ( roundedLow.z ) ) + " mm and ends at " + str( int ( roundedHigh.z ) ) + " mm, for a height of " + str( int ( extent.z ) ) + " mm" )
		self.addLine( "The average feedrate is "  + str( int( round( averageFeedrate ) ) )  + " mm/s, (" + str( int( round( 60.0 * averageFeedrate ) ) ) + " mm/min)." )
		self.addLine( "The extruder speed is " + str( int( round( self.extruderSpeed ) ) ) )
		self.addLine( "The extruder was extruding "  + str( int( round( 100.0 * self.totalDistanceExtruded / self.totalDistanceTraveled ) ) ) + "% of the time." )
		self.addLine( "The extruder was toggled " + str( self.extruderToggled ) + " times." )
		if self.extrusionDiameter != None:
			self.addLine( "The extrusion diameter is "  + str( self.extrusionDiameter ) + " mm." )
		self.addLine( "The extrusion width is "  + str( self.extrusionWidth ) + " mm." )
		self.addLine( "The following procedures have been performed on the skein:" )
		for procedure in self.procedures:
			self.addLine( procedure )
		self.addLine( "The layer thickness is "  + str( self.layerThickness ) + " mm." )
		self.addLine( "The text has " + str( self.numberOfLines ) + " lines and a size of " + str( kilobytes ) + " KB." )
		self.addLine( "The total build time is " + str( int( round( self.totalBuildTime ) ) ) + " s." )
		self.addLine( "The total distance extruded is " + str( int( round( self.totalDistanceExtruded ) ) ) + " mm." )
		self.addLine( "The total distance traveled is " + str( int( round( self.totalDistanceTraveled ) ) ) + " mm." )
		self.addLine( "The volume extruded is "  + str( int( round( volumeExtruded ) ) ) + " cc." )
예제 #2
0
	def parseGcode( self, gcodeText ):
		"Parse gcode text and store the statistics."
		self.absolutePerimeterWidth = 0.4
		self.characters = 0
		self.cornerHigh = Vector3( - 999999999.0, - 999999999.0, - 999999999.0 )
		self.cornerLow = Vector3( 999999999.0, 999999999.0, 999999999.0 )
		self.extruderActive = False
		self.extruderSpeed = 0.0
		self.extruderToggled = 0
		self.feedRateMinute = 600.0
		self.layerThickness = 0.4
		self.numberOfLines = 0
		self.procedures = []
		self.totalBuildTime = 0.0
		self.totalDistanceExtruded = 0.0
		self.totalDistanceTraveled = 0.0
		lines = gcodec.getTextLines( gcodeText )
		for line in lines:
			self.parseLine( line )
		averageFeedRate = self.totalDistanceTraveled / self.totalBuildTime
		self.characters += self.numberOfLines
		kilobytes = round( self.characters / 1024.0 )
		halfPerimeterWidth = 0.5 * self.absolutePerimeterWidth
		halfExtrusionCorner = Vector3( halfPerimeterWidth, halfPerimeterWidth, halfPerimeterWidth )
		self.cornerHigh += halfExtrusionCorner
		self.cornerLow -= halfExtrusionCorner
		extent = self.cornerHigh - self.cornerLow
		roundedHigh = euclidean.getRoundedPoint( self.cornerHigh )
		roundedLow = euclidean.getRoundedPoint( self.cornerLow )
		roundedExtent = euclidean.getRoundedPoint( extent )
		axisString =  " axis, the extrusion starts at "
		crossSectionArea = 0.9 * self.absolutePerimeterWidth * self.layerThickness # 0.9 if from the typical fill density
		if self.extrusionDiameter != None:
			crossSectionArea = math.pi / 4.0 * self.extrusionDiameter * self.extrusionDiameter
		volumeExtruded = 0.001 * crossSectionArea * self.totalDistanceExtruded
		self.addLine( "On the X%s%s mm and ends at %s mm, for a width of %s mm." % ( axisString, int( roundedLow.x ), int( roundedHigh.x ), int( extent.x ) ) )
		self.addLine( "On the Y%s%s mm and ends at %s mm, for a depth of %s mm." % ( axisString, int( roundedLow.y ), int( roundedHigh.y ), int( extent.y ) ) )
		self.addLine( "On the Z%s%s mm and ends at %s mm, for a height of %s mm." % ( axisString, int( roundedLow.z ), int( roundedHigh.z ), int( extent.z ) ) )
		self.addLine( " " )
		self.addLine( "The average feedRate is %s mm/s, (%s mm/min)." % ( euclidean.getThreeSignificantFigures( averageFeedRate ), euclidean.getThreeSignificantFigures( 60.0 * averageFeedRate ) ) )
		self.addLine( "The cross section area is %s mm2." % euclidean.getThreeSignificantFigures( crossSectionArea ) )
		if self.extrusionDiameter != None:
			self.addLine( "The extrusion diameter is %s mm." % euclidean.getThreeSignificantFigures( self.extrusionDiameter ) )
		self.addLine( "The extruder speed is %s" % euclidean.getThreeSignificantFigures( self.extruderSpeed ) )
		self.addLine( "The extruder was extruding %s percent of the time." % euclidean.getThreeSignificantFigures( 100.0 * self.totalDistanceExtruded / self.totalDistanceTraveled ) )
		self.addLine( "The extruder was toggled %s times." % self.extruderToggled )
		self.addLine( "The layer thickness is %s mm." % euclidean.getThreeSignificantFigures( self.layerThickness ) )
		if self.operatingFeedRatePerSecond != None:
			flowRate = crossSectionArea * self.operatingFeedRatePerSecond
			self.addLine( "The operating flow rate is %s mm3/s." % euclidean.getThreeSignificantFigures( flowRate ) )
		self.addLine( 'The perimeter extrusion fill density ratio is %s' % euclidean.getThreeSignificantFigures( crossSectionArea / self.absolutePerimeterWidth / self.layerThickness ) )
		self.addLine( "The perimeter width is %s mm." % euclidean.getThreeSignificantFigures( self.absolutePerimeterWidth ) )
		self.addLine( " " )
		self.addLine( "The following procedures have been performed on the skein:" )
		for procedure in self.procedures:
			self.addLine( procedure )
		self.addLine( " " )
		self.addLine( "The text has %s lines and a size of %s KB." % ( self.numberOfLines, kilobytes ) )
		self.addLine( "The total build time is %s s." % int( round( self.totalBuildTime ) ) )
		self.addLine( "The total distance extruded is %s mm." % euclidean.getThreeSignificantFigures( self.totalDistanceExtruded ) )
		self.addLine( "The total distance traveled is %s mm." % euclidean.getThreeSignificantFigures( self.totalDistanceTraveled ) )
		if self.version != None:
			self.addLine( "The version is "  + self.version )
		self.addLine( "The volume extruded is %s cc." % euclidean.getThreeSignificantFigures( volumeExtruded ) )
예제 #3
0
 def getCraftedGcode(self, gcodeText, repository):
     "Parse gcode text and store the statistics."
     self.absolutePerimeterWidth = 0.4
     self.characters = 0
     self.cornerHigh = Vector3(-999999999.0, -999999999.0, -999999999.0)
     self.cornerLow = Vector3(999999999.0, 999999999.0, 999999999.0)
     self.extruderActive = False
     self.extruderSpeed = 0.0
     self.extruderToggled = 0
     self.feedRateMinute = 600.0
     self.layerThickness = 0.4
     self.numberOfLines = 0
     self.procedures = []
     self.repository = repository
     self.totalBuildTime = 0.0
     self.totalDistanceExtruded = 0.0
     self.totalDistanceTraveled = 0.0
     lines = gcodec.getTextLines(gcodeText)
     for line in lines:
         self.parseLine(line)
     averageFeedRate = self.totalDistanceTraveled / self.totalBuildTime
     self.characters += self.numberOfLines
     kilobytes = round(self.characters / 1024.0)
     halfPerimeterWidth = 0.5 * self.absolutePerimeterWidth
     halfExtrusionCorner = Vector3(halfPerimeterWidth, halfPerimeterWidth,
                                   halfPerimeterWidth)
     self.cornerHigh += halfExtrusionCorner
     self.cornerLow -= halfExtrusionCorner
     extent = self.cornerHigh - self.cornerLow
     roundedHigh = euclidean.getRoundedPoint(self.cornerHigh)
     roundedLow = euclidean.getRoundedPoint(self.cornerLow)
     roundedExtent = euclidean.getRoundedPoint(extent)
     axisString = " axis, the extrusion starts at "
     crossSectionArea = 0.9 * self.absolutePerimeterWidth * self.layerThickness  # 0.9 if from the typical fill density
     if self.extrusionDiameter != None:
         crossSectionArea = math.pi / 4.0 * self.extrusionDiameter * self.extrusionDiameter
     volumeExtruded = 0.001 * crossSectionArea * self.totalDistanceExtruded
     self.addLine(
         "On the X%s%s mm and ends at %s mm, for a width of %s mm." %
         (axisString, int(roundedLow.x), int(roundedHigh.x), int(extent.x)))
     self.addLine(
         "On the Y%s%s mm and ends at %s mm, for a depth of %s mm." %
         (axisString, int(roundedLow.y), int(roundedHigh.y), int(extent.y)))
     self.addLine(
         "On the Z%s%s mm and ends at %s mm, for a height of %s mm." %
         (axisString, int(roundedLow.z), int(roundedHigh.z), int(extent.z)))
     self.addLine(" ")
     self.addLine(
         "The average feedRate is %s mm/s, (%s mm/min)." %
         (euclidean.getThreeSignificantFigures(averageFeedRate),
          euclidean.getThreeSignificantFigures(60.0 * averageFeedRate)))
     self.addLine("The cross section area is %s mm2." %
                  euclidean.getThreeSignificantFigures(crossSectionArea))
     if self.extrusionDiameter != None:
         self.addLine(
             "The extrusion diameter is %s mm." %
             euclidean.getThreeSignificantFigures(self.extrusionDiameter))
     self.addLine('The extrusion fill density ratio is %s' %
                  euclidean.getThreeSignificantFigures(
                      crossSectionArea / self.absolutePerimeterWidth /
                      self.layerThickness))
     #		self.addLine( 'The perimeter extrusion fill density ratio is %s' % euclidean.getThreeSignificantFigures( crossSectionArea / self.absolutePerimeterWidth / self.layerThickness ) )
     self.addLine("The extruder speed is %s" %
                  euclidean.getThreeSignificantFigures(self.extruderSpeed))
     self.addLine("The extruder was extruding %s percent of the time." %
                  euclidean.getThreeSignificantFigures(
                      100.0 * self.totalDistanceExtruded /
                      self.totalDistanceTraveled))
     self.addLine("The extruder was toggled %s times." %
                  self.extruderToggled)
     self.addLine("The layer thickness is %s mm." %
                  euclidean.getThreeSignificantFigures(self.layerThickness))
     if self.operatingFeedRatePerSecond != None:
         flowRate = crossSectionArea * self.operatingFeedRatePerSecond
         self.addLine("The operating flow rate is %s mm3/s." %
                      euclidean.getThreeSignificantFigures(flowRate))
     self.addLine(
         "The perimeter width is %s mm." %
         euclidean.getThreeSignificantFigures(self.absolutePerimeterWidth))
     self.addLine(" ")
     self.addLine(
         "The following procedures have been performed on the skein:")
     for procedure in self.procedures:
         self.addLine(procedure)
     self.addLine(" ")
     self.addLine("The text has %s lines and a size of %s KB." %
                  (self.numberOfLines, kilobytes))
     self.addLine("The total build time is %s s." %
                  int(round(self.totalBuildTime)))
     self.addLine(
         "The total distance extruded is %s mm." %
         euclidean.getThreeSignificantFigures(self.totalDistanceExtruded))
     self.addLine(
         "The total distance traveled is %s mm." %
         euclidean.getThreeSignificantFigures(self.totalDistanceTraveled))
     if self.version != None:
         self.addLine("The version is " + self.version)
     self.addLine("The volume extruded is %s cc." %
                  euclidean.getThreeSignificantFigures(volumeExtruded))
     return self.output.getvalue()