PageRenderTime 41ms CodeModel.GetById 11ms RepoModel.GetById 1ms app.codeStats 0ms

/Program_Files/replicatorg-0025/skein_engines/skeinforge-35/skeinforge_application/skeinforge_plugins/craft_plugins/chamber.py

https://github.com/sialan/autonomous-sprayer
Python | 257 lines | 219 code | 25 blank | 13 comment | 12 complexity | 2ede2b6e257bdffc9387a68c05e6b45b MD5 | raw file
  1. """
  2. This page is in the table of contents.
  3. Some filaments contract too much and to prevent this you have to print the object in a temperature regulated chamber or on a temperature regulated bed. The chamber tool allows you to control the bed and chamber temperature and the holding pressure. The gcodes are also described at:
  4. http://reprap.org/wiki/Mendel_User_Manual:_RepRapGCodes
  5. The chamber manual page is at:
  6. http://www.bitsfrombytes.com/wiki/index.php?title=Skeinforge_Chamber
  7. ==Operation==
  8. The default 'Activate Chamber' checkbox is on. When it is on, the functions described below will work, when it is off, the functions will not be called.
  9. ==Settings==
  10. ===Bed Temperature===
  11. Default is 60C.
  12. Defines the print_bed temperature in Celcius by adding an M140 command.
  13. ===Chamber Temperature===
  14. Default is 30C.
  15. Defines the chamber temperature in Celcius by adding an M141 command.
  16. ===Holding Force===
  17. Default is zero.
  18. Defines the holding pressure of a mechanism, like a vacuum table or electromagnet, to hold the bed surface or object, by adding an M142 command. The holding pressure is in bar. For hardware which only has on/off holding, when the holding pressure is zero, turn off holding, when the holding pressure is greater than zero, turn on holding.
  19. ==Heated Beds==
  20. ===Bothacker===
  21. A resistor heated aluminum plate by Bothacker:
  22. http://bothacker.com
  23. with an article at:
  24. http://bothacker.com/2009/12/18/heated-build-platform/
  25. ===Domingo===
  26. A heated copper build plate by Domingo:
  27. http://casainho-emcrepstrap.blogspot.com/
  28. with articles at:
  29. http://casainho-emcrepstrap.blogspot.com/2010/01/first-time-with-pla-testing-it-also-on.html
  30. http://casainho-emcrepstrap.blogspot.com/2010/01/call-for-helpideas-to-develop-heated.html
  31. http://casainho-emcrepstrap.blogspot.com/2010/01/new-heated-build-platform.html
  32. http://casainho-emcrepstrap.blogspot.com/2010/01/no-acrylic-and-instead-kapton-tape-on.html
  33. http://casainho-emcrepstrap.blogspot.com/2010/01/problems-with-heated-build-platform-and.html
  34. http://casainho-emcrepstrap.blogspot.com/2010/01/perfect-build-platform.html
  35. http://casainho-emcrepstrap.blogspot.com/2009/12/almost-no-warp.html
  36. http://casainho-emcrepstrap.blogspot.com/2009/12/heated-base-plate.html
  37. ===Jmil===
  38. A heated build stage by jmil, over at:
  39. http://www.hive76.org
  40. with articles at:
  41. http://www.hive76.org/handling-hot-build-surfaces
  42. http://www.hive76.org/heated-build-stage-success
  43. ===Kulitorum===
  44. Kulitorum has made a heated bed. It is a 5mm Alu sheet with a pattern laid out in kapton tape. The wire is a 0.6mm2 Konstantin wire and it's held in place by small pieces of kapton tape. The description and picture is at:
  45. http://gallery.kulitorum.com/main.php?g2_itemId=283
  46. ===Metalab===
  47. A heated base by the Metalab folks:
  48. http://reprap.soup.io
  49. with information at:
  50. http://reprap.soup.io/?search=heated%20base
  51. ===Nophead===
  52. A resistor heated aluminum bed by Nophead:
  53. http://hydraraptor.blogspot.com
  54. with articles at:
  55. http://hydraraptor.blogspot.com/2010/01/will-it-stick.html
  56. http://hydraraptor.blogspot.com/2010/01/hot-metal-and-serendipity.html
  57. http://hydraraptor.blogspot.com/2010/01/new-year-new-plastic.html
  58. http://hydraraptor.blogspot.com/2010/01/hot-bed.html
  59. ===Prusajr===
  60. A resistive wire heated plexiglass plate by prusajr:
  61. http://prusadjs.cz/
  62. with articles at:
  63. http://prusadjs.cz/2010/01/heated-reprap-print-bed-mk2/
  64. http://prusadjs.cz/2009/11/look-ma-no-warping-heated-reprap-print-bed/
  65. ===Pumpernickel2===
  66. A resistor heated aluminum plate by Pumpernickel2:
  67. http://dev.forums.reprap.org/profile.php?14,844
  68. with a picture at:
  69. http://dev.forums.reprap.org/file.php?14,file=1228,filename=heatedplate.jpg
  70. ===Zaggo===
  71. A resistor heated aluminum plate by Zaggo at Pleasant Software:
  72. http://pleasantsoftware.com/developer/3d/
  73. with articles at:
  74. ttp://pleasantsoftware.com/developer/3d/2009/12/05/raftless/
  75. http://pleasantsoftware.com/developer/3d/2009/11/15/living-in-times-of-warp-free-printing/
  76. http://pleasantsoftware.com/developer/3d/2009/11/12/canned-heat/
  77. ==Examples==
  78. The following examples chamber the file Screw Holder Bottom.stl. The examples are run in a terminal in the folder which contains Screw Holder Bottom.stl and chamber.py.
  79. > python chamber.py
  80. This brings up the chamber dialog.
  81. > python chamber.py Screw Holder Bottom.stl
  82. The chamber tool is parsing the file:
  83. Screw Holder Bottom.stl
  84. ..
  85. The chamber tool has created the file:
  86. Screw Holder Bottom_chamber.gcode
  87. > python
  88. Python 2.5.1 (r251:54863, Sep 22 2007, 01:43:31)
  89. [GCC 4.2.1 (SUSE Linux)] on linux2
  90. Type "help", "copyright", "credits" or "license" for more information.
  91. >>> import chamber
  92. >>> chamber.main()
  93. This brings up the chamber dialog.
  94. >>> chamber.writeOutput('Screw Holder Bottom.stl')
  95. Screw Holder Bottom.stl
  96. The chamber tool is parsing the file:
  97. Screw Holder Bottom.stl
  98. ..
  99. The chamber tool has created the file:
  100. Screw Holder Bottom_chamber.gcode
  101. """
  102. from __future__ import absolute_import
  103. #Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
  104. import __init__
  105. from fabmetheus_utilities.fabmetheus_tools import fabmetheus_interpret
  106. from fabmetheus_utilities import archive
  107. from fabmetheus_utilities import euclidean
  108. from fabmetheus_utilities import gcodec
  109. from fabmetheus_utilities import settings
  110. from skeinforge_application.skeinforge_utilities import skeinforge_craft
  111. from skeinforge_application.skeinforge_utilities import skeinforge_polyfile
  112. from skeinforge_application.skeinforge_utilities import skeinforge_profile
  113. import sys
  114. __author__ = 'Enrique Perez (perez_enrique@yahoo.com)'
  115. __date__ = '$Date: 2008/21/04 $'
  116. __license__ = 'GPL 3.0'
  117. def getCraftedText(fileName, text='', repository=None):
  118. "Chamber the file or text."
  119. return getCraftedTextFromText(archive.getTextIfEmpty(fileName, text), repository)
  120. def getCraftedTextFromText(gcodeText, repository=None):
  121. "Chamber a gcode linear move text."
  122. if gcodec.isProcedureDoneOrFileIsEmpty( gcodeText, 'chamber'):
  123. return gcodeText
  124. if repository == None:
  125. repository = settings.getReadRepository(ChamberRepository())
  126. if not repository.activateChamber.value:
  127. return gcodeText
  128. return ChamberSkein().getCraftedGcode(gcodeText, repository)
  129. def getNewRepository():
  130. "Get the repository constructor."
  131. return ChamberRepository()
  132. def writeOutput(fileName=''):
  133. "Chamber a gcode linear move file."
  134. fileName = fabmetheus_interpret.getFirstTranslatorFileNameUnmodified(fileName)
  135. if fileName == '':
  136. return
  137. skeinforge_craft.writeChainTextWithNounMessage( fileName, 'chamber')
  138. class ChamberRepository:
  139. "A class to handle the chamber settings."
  140. def __init__(self):
  141. "Set the default settings, execute title & settings fileName."
  142. skeinforge_profile.addListsToCraftTypeRepository('skeinforge_application.skeinforge_plugins.craft_plugins.chamber.html', self )
  143. self.fileNameInput = settings.FileNameInput().getFromFileName( fabmetheus_interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Chamber', self, '')
  144. self.openWikiManualHelpPage = settings.HelpPage().getOpenFromAbsolute('http://www.bitsfrombytes.com/wiki/index.php?title=Skeinforge_Chamber')
  145. self.activateChamber = settings.BooleanSetting().getFromValue('Activate Chamber:', self, True )
  146. self.bedTemperature = settings.FloatSpin().getFromValue( 20.0, 'Bed Temperature (Celcius):', self, 90.0, 60.0 )
  147. self.chamberTemperature = settings.FloatSpin().getFromValue( 20.0, 'Chamber Temperature (Celcius):', self, 90.0, 30.0 )
  148. self.holdingForce = settings.FloatSpin().getFromValue( 0.0, 'Holding Force (bar):', self, 100.0, 0.0 )
  149. self.executeTitle = 'Chamber'
  150. def execute(self):
  151. "Chamber button has been clicked."
  152. fileNames = skeinforge_polyfile.getFileOrDirectoryTypesUnmodifiedGcode(self.fileNameInput.value, fabmetheus_interpret.getImportPluginFileNames(), self.fileNameInput.wasCancelled)
  153. for fileName in fileNames:
  154. writeOutput(fileName)
  155. class ChamberSkein:
  156. "A class to chamber a skein of extrusions."
  157. def __init__(self):
  158. self.distanceFeedRate = gcodec.DistanceFeedRate()
  159. self.lineIndex = 0
  160. self.lines = None
  161. def getCraftedGcode(self, gcodeText, repository):
  162. "Parse gcode text and store the chamber gcode."
  163. self.repository = repository
  164. self.lines = archive.getTextLines(gcodeText)
  165. self.parseInitialization()
  166. for line in self.lines[self.lineIndex :]:
  167. self.parseLine(line)
  168. return self.distanceFeedRate.output.getvalue()
  169. def parseInitialization(self):
  170. 'Parse gcode initialization and store the parameters.'
  171. for self.lineIndex in xrange(len(self.lines)):
  172. line = self.lines[self.lineIndex]
  173. splitLine = gcodec.getSplitLineBeforeBracketSemicolon(line)
  174. firstWord = gcodec.getFirstWord(splitLine)
  175. self.distanceFeedRate.parseSplitLine(firstWord, splitLine)
  176. if firstWord == '(</extruderInitialization>)':
  177. self.distanceFeedRate.addLine('(<procedureDone> chamber </procedureDone>)')
  178. return
  179. self.distanceFeedRate.addLine(line)
  180. def parseLine(self, line):
  181. "Parse a gcode line and add it to the chamber skein."
  182. splitLine = gcodec.getSplitLineBeforeBracketSemicolon(line)
  183. if len(splitLine) < 1:
  184. return
  185. firstWord = splitLine[0]
  186. if firstWord == '(<extrusion>)':
  187. self.distanceFeedRate.addLine(line)
  188. self.distanceFeedRate.addParameter('M140', self.repository.bedTemperature.value ) # Set bed temperature.
  189. self.distanceFeedRate.addParameter('M141', self.repository.chamberTemperature.value ) # Set chamber temperature.
  190. self.distanceFeedRate.addParameter('M142', self.repository.holdingForce.value ) # Set holding pressure.
  191. return
  192. self.distanceFeedRate.addLine(line)
  193. def main():
  194. "Display the chamber dialog."
  195. if len(sys.argv) > 1:
  196. writeOutput(' '.join(sys.argv[1 :]))
  197. else:
  198. settings.startMainLoopFromConstructor( getNewRepository() )
  199. if __name__ == "__main__":
  200. main()