Beispiel #1
0
	def __init__( self, repository, skein ):
		"Initialize the skein window."
		self.arrowshape = ( 24, 30, 9 )
		self.addCanvasMenuRootScrollSkein( repository, skein, '_skeiniso', 'Skeiniso')
		self.center = 0.5 * self.screenSize
		self.motionStippleName = 'gray75'
		halfCenter = 0.5 * self.center.real
		negativeHalfCenter = - halfCenter
		self.halfCenterModel = halfCenter / skein.scale
		negativeHalfCenterModel = - self.halfCenterModel
		roundedHalfCenter = euclidean.getThreeSignificantFigures( self.halfCenterModel )
		roundedNegativeHalfCenter = euclidean.getThreeSignificantFigures( negativeHalfCenterModel )
		self.negativeAxisLineX = tableau.ColoredLine( Vector3(), 'darkorange', None, Vector3( negativeHalfCenter ), 'X Negative Axis: Origin -> %s,0,0' % roundedNegativeHalfCenter )
		self.negativeAxisLineY = tableau.ColoredLine( Vector3(), 'gold', None, Vector3( 0.0, negativeHalfCenter ), 'Y Negative Axis: Origin -> 0,%s,0' % roundedNegativeHalfCenter )
		self.negativeAxisLineZ = tableau.ColoredLine( Vector3(), 'skyblue', None, Vector3( 0.0, 0.0, negativeHalfCenter ), 'Z Negative Axis: Origin -> 0,0,%s' % roundedNegativeHalfCenter )
		self.positiveAxisLineX = tableau.ColoredLine( Vector3(), 'darkorange', None, Vector3( halfCenter ), 'X Positive Axis: Origin -> %s,0,0' % roundedHalfCenter )
		self.positiveAxisLineY = tableau.ColoredLine( Vector3(), 'gold', None, Vector3( 0.0, halfCenter ), 'Y Positive Axis: Origin -> 0,%s,0' % roundedHalfCenter )
		self.positiveAxisLineZ = tableau.ColoredLine( Vector3(), 'skyblue', None, Vector3( 0.0, 0.0, halfCenter ), 'Z Positive Axis: Origin -> 0,0,%s' % roundedHalfCenter )
		self.repository.axisRulings.setUpdateFunction( self.setWindowToDisplaySaveUpdate )
		self.repository.bandHeight.setUpdateFunction( self.setWindowToDisplaySavePhoenixUpdate )
		self.repository.bottomBandBrightness.setUpdateFunction( self.setWindowToDisplaySavePhoenixUpdate )
		self.repository.bottomLayerBrightness.setUpdateFunction( self.setWindowToDisplaySavePhoenixUpdate )
		self.repository.fromTheBottom.setUpdateFunction( self.setWindowToDisplaySavePhoenixUpdate )
		self.repository.fromTheTop.setUpdateFunction( self.setWindowToDisplaySavePhoenixUpdate )
		self.setWindowNewMouseTool( display_line.getNewMouseTool, self.repository.displayLine )
		self.setWindowNewMouseTool( view_move.getNewMouseTool, self.repository.viewMove )
		self.setWindowNewMouseTool( view_rotate.getNewMouseTool, self.repository.viewRotate )
		self.repository.numberOfFillBottomLayers.setUpdateFunction( self.setWindowToDisplaySavePhoenixUpdate )
		self.repository.numberOfFillTopLayers.setUpdateFunction( self.setWindowToDisplaySavePhoenixUpdate )
		self.repository.viewpointLatitude.setUpdateFunction( self.setWindowToDisplaySaveUpdate )
		self.repository.viewpointLongitude.setUpdateFunction( self.setWindowToDisplaySaveUpdate )
		self.repository.widthOfAxisNegativeSide.setUpdateFunction( self.setWindowToDisplaySaveUpdate )
		self.repository.widthOfAxisPositiveSide.setUpdateFunction( self.setWindowToDisplaySaveUpdate )
		self.repository.widthOfFillBottomThread.setUpdateFunction( self.setWindowToDisplaySaveUpdate )
		self.repository.widthOfFillTopThread.setUpdateFunction( self.setWindowToDisplaySaveUpdate )
		self.repository.widthOfInfillThread.setUpdateFunction( self.setWindowToDisplaySaveUpdate )
		self.repository.widthOfLoopThread.setUpdateFunction( self.setWindowToDisplaySaveUpdate )
		self.repository.widthOfPerimeterInsideThread.setUpdateFunction( self.setWindowToDisplaySaveUpdate )
		self.repository.widthOfPerimeterOutsideThread.setUpdateFunction( self.setWindowToDisplaySaveUpdate )
		self.repository.widthOfRaftThread.setUpdateFunction( self.setWindowToDisplaySaveUpdate )
		self.addMouseToolsBind()
		self.negativeRulings = []
		self.positiveRulings = []
		for rulingIndex in xrange( 1, int( math.ceil( self.halfCenterModel / self.rulingSeparationWidthMillimeters ) ) ):
			modelDistance = rulingIndex * self.rulingSeparationWidthMillimeters
			self.negativeRulings.append( Ruling( modelDistance, self.getRoundedRulingText( 1, - modelDistance ) ) )
			self.positiveRulings.append( Ruling( modelDistance, self.getRoundedRulingText( 1, modelDistance ) ) )
		self.rulingExtentHalf = 0.5 * self.rulingExtent
Beispiel #2
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 ) ) )
		Filehandle = open ('report.txt', 'a')
		Filehandle.write ("The total build time is %s s." % int( round( self.totalBuildTime ) )+'\n')
		
		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 ) )
		Filehandle.write ("The volume extruded is %s cc." % euclidean.getThreeSignificantFigures( volumeExtruded )+'\n')
		Filehandle.close ()
		return self.output.getvalue()
Beispiel #3
0
	def getCraftedGcode(self, gcodeText, repository):
		"""Parse gcode text and store the statistics."""
		self.absolutePerimeterWidth = 0.4
		self.characters = 0
		self.cornerMaximum = Vector3(-987654321.0, -987654321.0, -987654321.0)
		self.cornerMinimum = Vector3(987654321.0, 987654321.0, 987654321.0)
		self.extruderActive = False
		self.extruderSpeed = None
		self.extruderToggled = 0
		self.feedRateMinute = 600.0
		self.extrusionHeight = 0.4
		self.numberOfLines = 0
		self.procedures = []
		self.repository = repository
		self.totalBuildTime = 0.0
		self.totalDistanceExtruded = 0.0
		self.totalDistanceTraveled = 0.0
		lines = archive.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.cornerMaximum += halfExtrusionCorner
		self.cornerMinimum -= halfExtrusionCorner
		extent = self.cornerMaximum - self.cornerMinimum
		roundedHigh = euclidean.getRoundedPoint( self.cornerMaximum )
		roundedLow = euclidean.getRoundedPoint( self.cornerMinimum )
		roundedExtent = euclidean.getRoundedPoint( extent )
		axisString =  " axis extrusion starts at "
		crossSectionArea = 0.9 * self.absolutePerimeterWidth * self.extrusionHeight # 0.9 if from the typical fill density
		if self.extrusionDiameter is not None:
			crossSectionArea = math.pi / 4.0 * self.extrusionDiameter * self.extrusionDiameter
		volumeExtruded = 0.001 * crossSectionArea * self.totalDistanceExtruded
		mass = volumeExtruded / repository.density.value
		machineTimeCost = repository.machineTime.value * self.totalBuildTime / 3600.0
		materialCost = repository.material.value * mass
		self.addLine(' ')
		self.addLine('Cost')
		self.addLine( "Machine time cost is %s$." % round( machineTimeCost, 2 ) )
		self.addLine( "Material cost is %s$." % round( materialCost, 2 ) )
		self.addLine( "Total cost is %s$." % round( machineTimeCost + materialCost, 2 ) )
		self.addLine(' ')
		self.addLine('Extent')
		self.addLine( "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( "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( "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('Extruder')
		self.addLine( "Build time is %s." % euclidean.getDurationString( self.totalBuildTime ) )
		self.addLine( "Distance extruded is %s mm." % euclidean.getThreeSignificantFigures( self.totalDistanceExtruded ) )
		self.addLine( "Distance traveled is %s mm." % euclidean.getThreeSignificantFigures( self.totalDistanceTraveled ) )
		if self.extruderSpeed is not None:
			self.addLine( "Extruder speed is %s" % euclidean.getThreeSignificantFigures( self.extruderSpeed ) )
		self.addLine( "Extruder was extruding %s percent of the time." % euclidean.getThreeSignificantFigures( 100.0 * self.totalDistanceExtruded / self.totalDistanceTraveled ) )
		self.addLine( "Extruder was toggled %s times." % self.extruderToggled )
		if self.operatingFeedRatePerSecond is not None:
			flowRate = crossSectionArea * self.operatingFeedRatePerSecond
			self.addLine( "Operating flow rate is %s mm3/s." % euclidean.getThreeSignificantFigures( flowRate ) )
		self.addLine( "Feed rate average is %s mm/s, (%s mm/min)." % ( euclidean.getThreeSignificantFigures( averageFeedRate ), euclidean.getThreeSignificantFigures( 60.0 * averageFeedRate ) ) )
		self.addLine(' ')
		self.addLine('Filament')
		self.addLine( "Cross section area is %s mm2." % euclidean.getThreeSignificantFigures( crossSectionArea ) )
		if self.extrusionDiameter is not None:
			self.addLine( "Extrusion diameter is %s mm." % euclidean.getThreeSignificantFigures( self.extrusionDiameter ) )
		self.addLine('Extrusion fill density ratio is %s' % euclidean.getThreeSignificantFigures( crossSectionArea / self.absolutePerimeterWidth / self.extrusionHeight ) )
		self.addLine(' ')
		self.addLine('Material')
		self.addLine( "Mass extruded is %s grams." % euclidean.getThreeSignificantFigures( 1000.0 * mass ) )
		self.addLine( "Volume extruded is %s cc." % euclidean.getThreeSignificantFigures( volumeExtruded ) )
		self.addLine(' ')
		self.addLine('Meta')
		self.addLine( "Text has %s lines and a size of %s KB." % ( self.numberOfLines, kilobytes ) )
		if self.version is not None:
			self.addLine( "Version is "  + self.version )
		self.addLine(' ')
		self.addLine( "Procedures" )
		for procedure in self.procedures:
			self.addLine(procedure)
		if self.profileName is not None:
			self.addLine(' ')
			self.addLine( 'Profile' )
			self.addLine(self.profileName)
		self.addLine(' ')
		self.addLine('Slice')
		self.addLine( "Layer thickness is %s mm." % euclidean.getThreeSignificantFigures( self.extrusionHeight ) )
		self.addLine( "Perimeter width is %s mm." % euclidean.getThreeSignificantFigures( self.absolutePerimeterWidth ) )
		self.addLine(' ')
		return self.output.getvalue()
Beispiel #4
0
 def getCraftedGcode(self, gcodeText, repository):
     "Parse gcode text and store the statistics."
     self.absoluteEdgeWidth = 0.4
     self.characters = 0
     self.cornerMaximum = Vector3(-987654321.0, -987654321.0, -987654321.0)
     self.cornerMinimum = Vector3(987654321.0, 987654321.0, 987654321.0)
     self.extruderActive = False
     self.extruderSpeed = None
     self.extruderToggled = 0
     self.feedRateMinute = 600.0
     self.layerHeight = 0.4
     self.numberOfLines = 0
     self.procedures = []
     self.repository = repository
     self.totalBuildTime = 0.0
     self.totalDistanceExtruded = 0.0
     self.totalDistanceTraveled = 0.0
     lines = archive.getTextLines(gcodeText)
     for line in lines:
         self.parseLine(line)
     averageFeedRate = self.totalDistanceTraveled / self.totalBuildTime
     self.characters += self.numberOfLines
     kilobytes = round(self.characters / 1024.0)
     halfEdgeWidth = 0.5 * self.absoluteEdgeWidth
     halfExtrusionCorner = Vector3(halfEdgeWidth, halfEdgeWidth,
                                   halfEdgeWidth)
     self.cornerMaximum += halfExtrusionCorner
     self.cornerMinimum -= halfExtrusionCorner
     extent = self.cornerMaximum - self.cornerMinimum
     roundedHigh = euclidean.getRoundedPoint(self.cornerMaximum)
     roundedLow = euclidean.getRoundedPoint(self.cornerMinimum)
     roundedExtent = euclidean.getRoundedPoint(extent)
     axisString = " axis extrusion starts at "
     crossSectionArea = self.absoluteEdgeWidth * self.layerHeight
     if self.volumeFraction != None:
         crossSectionArea *= self.volumeFraction
     self.extrusionDiameter = math.sqrt(4.0 * crossSectionArea / math.pi)
     volumeExtruded = 0.001 * crossSectionArea * self.totalDistanceExtruded
     mass = volumeExtruded / repository.density.value
     machineTimeCost = repository.machineTime.value * self.totalBuildTime / 3600.0
     materialCost = repository.material.value * mass
     self.addLine(' ')
     self.addLine('Cost')
     self.addLine("Machine time cost is %s$." % round(machineTimeCost, 2))
     self.addLine("Material cost is %s$." % round(materialCost, 2))
     self.addLine("Total cost is %s$." %
                  round(machineTimeCost + materialCost, 2))
     self.addLine(' ')
     self.addLine('Extent')
     self.addLine(
         "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(
         "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(
         "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('Extruder')
     self.addLine("Build time is %s." %
                  euclidean.getDurationString(self.totalBuildTime))
     self.addLine(
         "Distance extruded is %s mm." %
         euclidean.getThreeSignificantFigures(self.totalDistanceExtruded))
     self.addLine(
         "Distance traveled is %s mm." %
         euclidean.getThreeSignificantFigures(self.totalDistanceTraveled))
     if self.extruderSpeed != None:
         self.addLine(
             "Extruder speed is %s" %
             euclidean.getThreeSignificantFigures(self.extruderSpeed))
     self.addLine("Extruder was extruding %s percent of the time." %
                  euclidean.getThreeSignificantFigures(
                      100.0 * self.totalDistanceExtruded /
                      self.totalDistanceTraveled))
     self.addLine("Extruder was toggled %s times." % self.extruderToggled)
     if self.operatingFeedRatePerSecond != None:
         flowRate = crossSectionArea * self.operatingFeedRatePerSecond
         self.addLine("Operating flow rate is %s mm3/s." %
                      euclidean.getThreeSignificantFigures(flowRate))
     self.addLine(
         "Feed rate average is %s mm/s, (%s mm/min)." %
         (euclidean.getThreeSignificantFigures(averageFeedRate),
          euclidean.getThreeSignificantFigures(60.0 * averageFeedRate)))
     self.addLine(' ')
     self.addLine('Filament')
     self.addLine("Cross section area is %s mm2." %
                  euclidean.getThreeSignificantFigures(crossSectionArea))
     self.addLine(
         'Extrusion diameter is %s mm.' %
         euclidean.getThreeSignificantFigures(self.extrusionDiameter))
     if self.volumeFraction != None:
         self.addLine(
             'Volume fraction is %s.' %
             euclidean.getThreeSignificantFigures(self.volumeFraction))
     self.addLine(' ')
     self.addLine('Material')
     self.addLine("Mass extruded is %s grams." %
                  euclidean.getThreeSignificantFigures(1000.0 * mass))
     self.addLine("Volume extruded is %s cc." %
                  euclidean.getThreeSignificantFigures(volumeExtruded))
     self.addLine(' ')
     self.addLine('Meta')
     self.addLine("Text has %s lines and a size of %s KB." %
                  (self.numberOfLines, kilobytes))
     if self.version != None:
         self.addLine("Version is " + self.version)
     self.addLine(' ')
     self.addLine("Procedures")
     for procedure in self.procedures:
         self.addLine(procedure)
     if self.profileName != None:
         self.addLine(' ')
         self.addLine('Profile')
         self.addLine(self.profileName)
     self.addLine(' ')
     self.addLine('Slice')
     self.addLine(
         "Edge width is %s mm." %
         euclidean.getThreeSignificantFigures(self.absoluteEdgeWidth))
     self.addLine("Layer height is %s mm." %
                  euclidean.getThreeSignificantFigures(self.layerHeight))
     self.addLine(' ')
     return self.output.getvalue()
Beispiel #5
0
    def getCraftedGcode(self, gcodeText, repository):
        "Parse gcode text and store the statistics."
        self.absolutePerimeterWidth = 0.4
        self.characters = 0
        self.cornerMaximum = Vector3(-987654321.0, -987654321.0, -987654321.0)
        self.cornerMinimum = Vector3(987654321.0, 987654321.0, 987654321.0)
        self.extruderActive = False
        self.extruderSpeed = None
        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
        self.numberOfLines = 1
        lines = archive.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.cornerMaximum += halfExtrusionCorner
        self.cornerMinimum -= halfExtrusionCorner
        extent = self.cornerMaximum - self.cornerMinimum
        roundedHigh = euclidean.getRoundedPoint(self.cornerMaximum)
        roundedLow = euclidean.getRoundedPoint(self.cornerMinimum)
        roundedExtent = euclidean.getRoundedPoint(extent)
        axisString = " axis extrusion starts at "
        crossSectionArea = 0.9 * self.absolutePerimeterWidth * self.layerThickness  # 0.9 if from the typical fill density
        FilamentRadius = repository.FilamentDiameter.value / 2
        filamentCrossSectionArea = (FilamentRadius * FilamentRadius) * math.pi
        extrusionXSection = ((
            (self.layerThickness + self.perimeterWidth) / 4)**2) * math.pi
        volumeExtruded = extrusionXSection * self.totalDistanceExtruded / 1000
        mass = (volumeExtruded / 1000) * repository.density.value
        self.delay = (repository.realPrintTime.value -
                      repository.calculatedPrintTime.value
                      ) / repository.totalCommandsEntered.value
        buildQuadraticVolume = int(extent.x) * int(extent.y) * int(extent.z)

        self.estimatedBuildTime = (
            self.totalDistanceTraveled / self.totalCommandcount /
            averageFeedRate +
            ((averageFeedRate * 0.75 / repository.accelerationRate.value) / 2)
        ) * self.totalCommandcount / 60  # self.delay * self.totalCommandcount + self.totalBuildTime
        machineTimeCost = repository.machineTime.value * self.estimatedBuildTime / 3600.0
        self.filamentInOutRatio = filamentCrossSectionArea / (
            (((self.layerThickness + self.perimeterWidth) / 4) *
             ((self.layerThickness + self.perimeterWidth) / 4) * math.pi))
        self.totalDistanceFilament = self.totalDistanceExtruded
        averageFeedRate = self.totalDistanceTraveled / self.totalBuildTime
        averageFeedRateEst = self.totalDistanceTraveled / self.estimatedBuildTime
        materialCost = repository.material.value * mass / 1000
        self.addLine(' ')
        self.addLine("Procedures used (in sequence..")
        for procedure in self.procedures:
            self.addLine(procedure)
        self.addLine(' ')
        self.addLine('Extent')
        self.addLine(
            "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(
            "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(
            "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('Statistics')
        self.addLine("Distance traveled is %s m." %
                     euclidean.getThreeSignificantFigures(
                         self.totalDistanceTraveled / 1000))
        self.addLine("Distance extruded is %s m." %
                     euclidean.getThreeSignificantFigures(
                         self.totalDistanceExtruded / 1000))
        if self.extruderSpeed != None:
            self.addLine(
                "Extruder speed is %s" %
                euclidean.getThreeSignificantFigures(self.extruderSpeed))
        self.addLine("Extruder was extruding %s percent of the time." %
                     euclidean.getThreeSignificantFigures(
                         100.0 * self.totalDistanceExtruded /
                         self.totalDistanceTraveled))
        self.addLine("Extruder was toggled %s times." % self.extruderToggled)
        self.addLine(
            "Feed rate average is %s mm/s, (%s mm/min)." %
            (euclidean.getThreeSignificantFigures(averageFeedRateEst),
             euclidean.getThreeSignificantFigures(60.0 * averageFeedRateEst)))
        self.addLine("A Total of %s commands will be executed." %
                     self.totalCommandcount)
        self.addLine(' ')
        self.addLine('Time')
        self.addLine("Calculated Build time is %s." %
                     euclidean.getDurationString(self.totalBuildTime))
        self.addLine("Corrected Build time is %s." %
                     euclidean.getDurationString(self.estimatedBuildTime))
        self.addLine("Delay  is %s seconds per command ." % self.delay)

        self.addLine(' ')
        self.addLine('Consumption')
        self.addLine("Extrusion Cross section area is %s mm2." %
                     euclidean.getThreeSignificantFigures(extrusionXSection))
        self.addLine("Mass extruded is %s grams." %
                     euclidean.getThreeSignificantFigures(mass))
        self.addLine("Volume extruded is %s cc." %
                     euclidean.getThreeSignificantFigures(volumeExtruded))
        self.addLine("Filament used is %s m." %
                     euclidean.getThreeSignificantFigures(
                         self.totalDistanceFilament / 100000))

        self.addLine(' ')
        self.addLine('Cost')
        self.addLine("Machine time cost is %s$." % round(machineTimeCost, 2))
        self.addLine("Material cost is %s$." % round(materialCost, 2))
        self.addLine("Total cost is %s$." %
                     round(machineTimeCost + materialCost, 2))
        self.addLine(' ')
        if self.profileName != None:
            self.addLine(' ')
            self.addLine('Profile')
            self.addLine(self.profileName)
        self.addLine(' ')
        self.addLine('Info')
        self.addLine("Layer thickness is %s mm." %
                     euclidean.getThreeSignificantFigures(self.layerThickness))
        self.addLine(
            "Perimeter width is %s mm." %
            euclidean.getThreeSignificantFigures(self.absolutePerimeterWidth))
        self.addLine(
            "Filament Cross section area is %s mm2." %
            euclidean.getThreeSignificantFigures(filamentCrossSectionArea))
        self.addLine(
            'Filament In / Out ratio is %s' %
            euclidean.getThreeSignificantFigures(self.filamentInOutRatio))
        self.addLine("Text has %s lines and a size of %s KB." %
                     (self.numberOfLines, kilobytes))
        self.addLine('')
        if self.profileName is not None:
            self.addLine(' ')
            self.addLine("Profile used to Skein: ")
            self.addLine(self.profileName)
        self.addLine(' ')
        if self.version is not None:
            self.addLine("You are using SFACT Version " + self.version)
        self.addLine(' ')
        return self.output.getvalue()
Beispiel #6
0
	def getCraftedGcode(self, gcodeText, repository):
		"Parse gcode text and store the statistics."
		self.absolutePerimeterWidth = 0.4
		self.characters = 0
		self.cornerMaximum = Vector3(-987654321.0, -987654321.0, -987654321.0)
		self.cornerMinimum = Vector3(987654321.0, 987654321.0, 987654321.0)
		self.extruderActive = False
		self.extruderSpeed = None
		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
		self.numberOfLines = 1
		lines = archive.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.cornerMaximum += halfExtrusionCorner
		self.cornerMinimum -= halfExtrusionCorner
		extent = self.cornerMaximum - self.cornerMinimum
		roundedHigh = euclidean.getRoundedPoint( self.cornerMaximum )
		roundedLow = euclidean.getRoundedPoint( self.cornerMinimum )
		roundedExtent = euclidean.getRoundedPoint( extent )
		axisString =  " axis extrusion starts at "
		crossSectionArea = 0.9 * self.absolutePerimeterWidth * self.layerThickness # 0.9 if from the typical fill density
		FilamentRadius = repository.FilamentDiameter.value /2
		filamentCrossSectionArea = (FilamentRadius * FilamentRadius)*math.pi
		extrusionXSection =(((self.layerThickness+self.perimeterWidth)/4)**2)*math.pi
		volumeExtruded = extrusionXSection * self.totalDistanceExtruded / 1000
		mass = (volumeExtruded /1000)* repository.density.value
		self.delay = (repository.realPrintTime.value - repository.calculatedPrintTime.value ) / repository.totalCommandsEntered.value
		buildQuadraticVolume = int( extent.x )*int( extent.y )*int( extent.z )
		
		self.estimatedBuildTime =  (self.totalDistanceTraveled / self.totalCommandcount / averageFeedRate +((averageFeedRate*0.75/ repository.accelerationRate.value) /2))*self.totalCommandcount/60  # self.delay * self.totalCommandcount + self.totalBuildTime
		machineTimeCost = repository.machineTime.value * self.estimatedBuildTime / 3600.0
		self.filamentInOutRatio = filamentCrossSectionArea / ((((self.layerThickness+self.perimeterWidth)/4)*((self.layerThickness+self.perimeterWidth)/4)*math.pi))
		self.totalDistanceFilament = self.totalDistanceExtruded
		averageFeedRate = self.totalDistanceTraveled / self.totalBuildTime
		averageFeedRateEst = self.totalDistanceTraveled / self.estimatedBuildTime
		materialCost = repository.material.value * mass /1000
		self.addLine(' ')
		self.addLine( "Procedures used (in sequence.." )
		for procedure in self.procedures:
			self.addLine(procedure)
		self.addLine(' ')
		self.addLine('Extent')
		self.addLine( "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( "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( "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('Statistics')
		self.addLine( "Distance traveled is %s m." % euclidean.getThreeSignificantFigures( self.totalDistanceTraveled/1000 ) )
		self.addLine( "Distance extruded is %s m." % euclidean.getThreeSignificantFigures( self.totalDistanceExtruded/1000 ) )
		if self.extruderSpeed != None:
			self.addLine( "Extruder speed is %s" % euclidean.getThreeSignificantFigures( self.extruderSpeed ) )
		self.addLine( "Extruder was extruding %s percent of the time." % euclidean.getThreeSignificantFigures( 100.0 * self.totalDistanceExtruded / self.totalDistanceTraveled ) )
		self.addLine( "Extruder was toggled %s times." % self.extruderToggled )
		self.addLine( "Feed rate average is %s mm/s, (%s mm/min)." % ( euclidean.getThreeSignificantFigures(averageFeedRateEst ), euclidean.getThreeSignificantFigures( 60.0 * averageFeedRateEst ) ) )
		self.addLine( "A Total of %s commands will be executed." %  self.totalCommandcount)
		self.addLine(' ')
		self.addLine('Time')
		self.addLine( "Calculated Build time is %s." % euclidean.getDurationString(self.totalBuildTime))
		self.addLine( "Corrected Build time is %s." % euclidean.getDurationString( self.estimatedBuildTime))
		self.addLine( "Delay  is %s seconds per command ." % self.delay )

		self.addLine(' ')
		self.addLine('Consumption')
		self.addLine( "Extrusion Cross section area is %s mm2." % euclidean.getThreeSignificantFigures( extrusionXSection))
		self.addLine( "Mass extruded is %s grams." % euclidean.getThreeSignificantFigures(  mass ) )
		self.addLine( "Volume extruded is %s cc." % euclidean.getThreeSignificantFigures( volumeExtruded) )
		self.addLine( "Filament used is %s m." % euclidean.getThreeSignificantFigures( self.totalDistanceFilament /100000 ))

		self.addLine(' ')
		self.addLine('Cost')
		self.addLine( "Machine time cost is %s$." % round( machineTimeCost, 2 ) )
		self.addLine( "Material cost is %s$." % round( materialCost, 2 ) )
		self.addLine( "Total cost is %s$." % round( machineTimeCost + materialCost, 2 ) )
		self.addLine(' ')
		if self.profileName != None:
			self.addLine(' ')
			self.addLine( 'Profile' )
			self.addLine(self.profileName)
		self.addLine(' ')
		self.addLine('Info')
		self.addLine( "Layer thickness is %s mm." % euclidean.getThreeSignificantFigures( self.layerThickness ) )
		self.addLine( "Perimeter width is %s mm." % euclidean.getThreeSignificantFigures( self.absolutePerimeterWidth ) )
		self.addLine( "Filament Cross section area is %s mm2." % euclidean.getThreeSignificantFigures( filamentCrossSectionArea ) )
		self.addLine('Filament In / Out ratio is %s' % euclidean.getThreeSignificantFigures (self.filamentInOutRatio))
		self.addLine( "Text has %s lines and a size of %s KB." % ( self.numberOfLines, kilobytes ) )
		self.addLine('')
		if self.profileName is not None:
			self.addLine(' ')
			self.addLine( "Profile used to Skein: " )
			self.addLine(self.profileName)
		self.addLine( ' ' )
		if self.version is not None:
			self.addLine( "You are using SFACT Version "  + self.version )
		self.addLine(' ')
		return self.output.getvalue()