Saturday, July 23, 2011

Making Mach3 and Skeinforge Play Nice

RepRap Gcode uses 'E' as the identifier for the extruder axis, which makes sense to some degree, but Mach3 recognizes Axis extra to X, Y, & Z as A, B, & C. The extruder will have to use one of these three identifiers, I chose A.  Skeinforge does provide a nice tool in the export module to help facilitate this.  Locate the Skeinforge alterations directory, create a new text file with your favorite text editor like notepad.  Skeainforge parses the records in the file using the tab character.  The contents of the file should look like this

E[tab key] A[Enter]
M[tab key]; M[Enter]

save the file as text only.

From now on skeinforge will search and replace the E axis identifier with A and comment out all the M codes.

The reason for removing the M codes is because they serve no practical purpose and delay Mach 3 during the printing process as it tries to locate the undefined macros.

Mach3 began to chew through the g code and the print head danced lightly footed across the bed.  Quite the contrast to the rigid and jerky boxing like cadence.  Previously any motion with a radius sounded like the ratcheting report of a Thompson machine gun and now it pirouettes around any radius with out effort or wasted force.  To say the transformation was impressive is an understatement.

There was one minor annoyance.  Just before the head would make a non extruding series of movements, the extruder would retract the filament in an effort to stop molten plastic from oozing onto the print.  Once the head is in position to print, the extruder is primed and then the extruder axis is reset to 0.  It would take approx a second for the axis to zero which is confusing to me.  It may not sound like a lot of time but, having it occur a dozen or more times per layer over tens to hundreds of layers it starts to add up.  Not to mention effect the print quality.

The first attempt to work around the issues was to use the extruder axis relative distance mode option in skeinforge. Apparently the methods employed by RepRaps doesn't agree with Mach3, as all axis began to move using relative distance.  No good.

Digging through the dimension.py for skeinforge this was found.


elif firstWord == 'M101':
self.addLinearMoveExtrusionDistanceLine( self.restartDistance )
if not self.repository.relativeExtrusionDistance.value:
self.distanceFeedRate.addLine('G92 E0')
self.totalExtrusionDistance = 0.0
self.isExtruderActive = True

Even with my weak Python Fu it looked like the code responsible for zero'ing the extruder.  A couple quick flicks of the # key and the offending code was neutralized.

elif firstWord == 'M101':
self.addLinearMoveExtrusionDistanceLine( self.restartDistance )
#if not self.repository.relativeExtrusionDistance.value:
# self.distanceFeedRate.addLine('G92 E0')
# self.totalExtrusionDistance = 0.0
self.isExtruderActive = True

Setting the extruder back to absolute coordinates the new g-code no longer zero'ed the extruder again.

For the first time, I am substantially satisfied with the RepRap. 

No comments:

Post a Comment