Пример #1
0
	def addInitializationToOutput( self ):
		"Add initialization gcode to the output."
		# From http://www.ahha.com/VarsAndMacros.doc
		# If you wish to run macros using comments in parentheses, the comment character must be changed from a semi-colon to a left parenthesis.
		# Note: the original closing single quotation mark was not ascii, so I replaced it with an apostrophe.
		# To do this, the following line should be placed at the beginning of the G-Code file that calls the macro:
#		self.addLine( "(*CMST '('*)" ) # Gcode to convert the comment character to '('.
		self.addFromUpperLowerFile( 'Start.txt' ) # Add a start file if it exists.
		self.addLine( '(<creator> skeinforge May 28, 2008 )' ) # GCode formatted comment
		self.addLine( 'M110' ) # GCode for compatibility with Nophead's code.
		self.addLine( '(<extruderInitialization> )' ) # GCode formatted comment
		self.addLine( 'G21' ) # Set units to mm.
		self.addLine( 'G90' ) # Set positioning to absolute.
		self.addLine( 'G28' ) # Start at home.
		self.addLine( 'M103' ) # Turn extruder off.
		self.addLine( 'M104 S200' ) # Set temperature to 200.
		self.addLine( 'M105' ) # Custom code for temperature reading.
		self.addLine( 'M108 S210' ) # Set extruder speed to 210.
		self.addFromUpperLowerFile( 'EndOfTheBeginning.txt' ) # Add a second start file if it exists.
		self.addLine( '(<extrusionDiameter> ' + euclidean.getRoundedToThreePlaces( self.extrusionDiameter ) + ' )' ) # Set extrusion diameter.
		self.addLine( '(<extrusionWidth> ' + euclidean.getRoundedToThreePlaces( self.extrusionWidth ) + ' )' ) # Set extrusion width.
		self.addLine( '(<layerThickness> ' + euclidean.getRoundedToThreePlaces( self.layerThickness ) + ' )' ) # Set layer thickness.
		# Set bridge extrusion width over solid extrusion width.
		self.addLine( '(<bridgeExtrusionWidthOverSolid> ' + euclidean.getRoundedToThreePlaces( self.bridgeExtrusionWidth / self.extrusionWidth ) + ' )' )
		self.addLine( '(<procedureDone> slice )' ) # The skein has been sliced.
		self.addLine( '(<extrusionStart> )' ) # Initialization is finished, extrusion is starting.
Пример #2
0
 def addGcodeMovement(self, point):
     "Add a movement to the output."
     self.lastOutputPoint = point
     self.output.write("G1 X" + euclidean.getRoundedToThreePlaces(point.x) +
                       " Y" + euclidean.getRoundedToThreePlaces(point.y))
     self.addLine(" Z" + euclidean.getRoundedToThreePlaces(point.z) + " F" +
                  euclidean.getRoundedToThreePlaces(self.feedratePerMinute))
Пример #3
0
	def addGcodeMovement( self, point ):
		"Add a movement to the output."
		self.lastOutputPoint = point
		if point in self.feedrateTable:
			self.feedrateMinute = self.feedrateTable[ point ]
		self.output.write( "G1 X" + euclidean.getRoundedToThreePlaces( point.x ) + " Y" + euclidean.getRoundedToThreePlaces( point.y ) )
		self.addLine( " Z" + euclidean.getRoundedToThreePlaces( point.z ) + " F" + euclidean.getRoundedToThreePlaces( self.feedrateMinute ) )
Пример #4
0
	def getStretchedLineFromIndexLocation( self, indexPreviousStart, indexNextStart, location ):
		"Get stretched gcode line from line index and location."
		nextRange = range( indexNextStart, len( self.lines ) )
		previousRange = range( indexPreviousStart, 3, - 1 )
		relativeStretch = self.getRelativeStretch( location, nextRange ) + self.getRelativeStretch( location, previousRange )
		relativeStretch *= 0.8
		relativeStretchLength = abs( relativeStretch )
		if relativeStretchLength > 1.0:
			relativeStretch /= relativeStretchLength
		absoluteStretch = relativeStretch * self.maximumAbsoluteStretch
		stretchedLocation = location.plus( Vec3( absoluteStretch.real, absoluteStretch.imag, 0.0 ) )
		stretchedLine = "G1 X" + euclidean.getRoundedToThreePlaces( stretchedLocation.x ) + " Y" + euclidean.getRoundedToThreePlaces( stretchedLocation.y )
		return stretchedLine + " Z" + euclidean.getRoundedToThreePlaces( stretchedLocation.z ) + ' F' + euclidean.getRoundedToThreePlaces( self.feedrateMinute )
Пример #5
0
 def getStretchedLineFromIndexLocation(self, indexPreviousStart,
                                       indexNextStart, location):
     "Get stretched gcode line from line index and location."
     nextRange = range(indexNextStart, len(self.lines))
     previousRange = range(indexPreviousStart, 3, -1)
     relativeStretch = self.getRelativeStretch(
         location, nextRange) + self.getRelativeStretch(
             location, previousRange)
     relativeStretch *= 0.8
     relativeStretchLength = abs(relativeStretch)
     if relativeStretchLength > 1.0:
         relativeStretch /= relativeStretchLength
     absoluteStretch = relativeStretch * self.maximumAbsoluteStretch
     stretchedLocation = location.plus(
         Vec3(absoluteStretch.real, absoluteStretch.imag, 0.0))
     stretchedLine = "G1 X" + euclidean.getRoundedToThreePlaces(
         stretchedLocation.x) + " Y" + euclidean.getRoundedToThreePlaces(
             stretchedLocation.y)
     return stretchedLine + " Z" + euclidean.getRoundedToThreePlaces(
         stretchedLocation.z) + ' F' + euclidean.getRoundedToThreePlaces(
             self.feedrateMinute)
Пример #6
0
	def addGcodeMovement( self, point ):
		"Add a movement to the output."#later add feedrate
		self.addLine( "G1 X" + euclidean.getRoundedToThreePlaces( point.x ) + " Y" + euclidean.getRoundedToThreePlaces( point.y ) + " Z" + euclidean.getRoundedToThreePlaces( point.z ) )
Пример #7
0
 def addGcodeMovement(self, point):
     "Add a movement to the output."  #later add feedrate
     self.addLine("G1 X" + euclidean.getRoundedToThreePlaces(point.x) +
                  " Y" + euclidean.getRoundedToThreePlaces(point.y) + " Z" +
                  euclidean.getRoundedToThreePlaces(point.z))
Пример #8
0
 def addRelativeCenter(self, centerMinusBefore):
     "Add the relative center to a line of the arc radius filleted skein."
     planeCenterMinusBefore = centerMinusBefore.dropAxis(2)
     radius = abs(planeCenterMinusBefore)
     self.output.write(' R' + euclidean.getRoundedToThreePlaces(radius))
Пример #9
0
 def addRelativeCenter(self, centerMinusBefore):
     "Add the relative center to a line of the arc point filleted skein."
     self.output.write(
         ' I' + euclidean.getRoundedToThreePlaces(centerMinusBefore.x) +
         ' J' + euclidean.getRoundedToThreePlaces(centerMinusBefore.y))
Пример #10
0
 def addPoint(self, point):
     "Add a gcode point to the output."
     self.output.write(' X' + euclidean.getRoundedToThreePlaces(point.x) +
                       ' Y' + euclidean.getRoundedToThreePlaces(point.y) +
                       ' Z' + euclidean.getRoundedToThreePlaces(point.z))
Пример #11
0
 def addFeedrateEnd(self):
     "Add the gcode feedrate and a newline to the output."
     self.addLine(' F' +
                  euclidean.getRoundedToThreePlaces(self.feedrateMinute))
Пример #12
0
	def addGcodeMovement( self, point ):
		"Add a movement to the output."
		self.addLine( "G1 X%s Y%s Z%s" % ( euclidean.getRoundedToThreePlaces( point.x ), euclidean.getRoundedToThreePlaces( point.y ), euclidean.getRoundedToThreePlaces( point.z ) ) )
Пример #13
0
	def addRelativeCenter( self, centerMinusBefore ):
		"Add the relative center to a line of the arc radius filleted skein."
		planeCenterMinusBefore = centerMinusBefore.dropAxis( 2 )
		radius = abs( planeCenterMinusBefore )
		self.output.write( ' R' + euclidean.getRoundedToThreePlaces( radius ) )
Пример #14
0
	def addRelativeCenter( self, centerMinusBefore ):
		"Add the relative center to a line of the arc point filleted skein."
		self.output.write( ' I' + euclidean.getRoundedToThreePlaces( centerMinusBefore.x ) + ' J' + euclidean.getRoundedToThreePlaces( centerMinusBefore.y ) )
Пример #15
0
	def addPoint( self, point ):
		"Add a gcode point to the output."
		self.output.write( ' X' + euclidean.getRoundedToThreePlaces( point.x ) + ' Y' + euclidean.getRoundedToThreePlaces( point.y ) + ' Z' + euclidean.getRoundedToThreePlaces( point.z ) )
Пример #16
0
	def addFeedrateEnd( self ):
		"Add the gcode feedrate and a newline to the output."
		self.addLine(  ' F' + euclidean.getRoundedToThreePlaces( self.feedrateMinute ) )