PageRenderTime 47ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://github.com/sialan/autonomous-sprayer
Python | 234 lines | 202 code | 19 blank | 13 comment | 10 complexity | ef2857043542b27ec3a06397731e73f4 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://fabmetheus.crsndoo.com/wiki/index.php/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. """
  88. from __future__ import absolute_import
  89. #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.
  90. import __init__
  91. from fabmetheus_utilities.fabmetheus_tools import fabmetheus_interpret
  92. from fabmetheus_utilities import archive
  93. from fabmetheus_utilities import euclidean
  94. from fabmetheus_utilities import gcodec
  95. from fabmetheus_utilities import settings
  96. from skeinforge_application.skeinforge_utilities import skeinforge_craft
  97. from skeinforge_application.skeinforge_utilities import skeinforge_polyfile
  98. from skeinforge_application.skeinforge_utilities import skeinforge_profile
  99. import sys
  100. __author__ = 'Enrique Perez (perez_enrique@yahoo.com)'
  101. __date__ = '$Date: 2008/21/04 $'
  102. __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
  103. def getCraftedText(fileName, text='', repository=None):
  104. "Chamber the file or text."
  105. return getCraftedTextFromText(archive.getTextIfEmpty(fileName, text), repository)
  106. def getCraftedTextFromText(gcodeText, repository=None):
  107. "Chamber a gcode linear move text."
  108. if gcodec.isProcedureDoneOrFileIsEmpty( gcodeText, 'chamber'):
  109. return gcodeText
  110. if repository == None:
  111. repository = settings.getReadRepository(ChamberRepository())
  112. if not repository.activateChamber.value:
  113. return gcodeText
  114. return ChamberSkein().getCraftedGcode(gcodeText, repository)
  115. def getNewRepository():
  116. 'Get new repository.'
  117. return ChamberRepository()
  118. def writeOutput(fileName, shouldAnalyze=True):
  119. "Chamber a gcode linear move file."
  120. skeinforge_craft.writeChainTextWithNounMessage(fileName, 'chamber', shouldAnalyze)
  121. class ChamberRepository:
  122. "A class to handle the chamber settings."
  123. def __init__(self):
  124. "Set the default settings, execute title & settings fileName."
  125. skeinforge_profile.addListsToCraftTypeRepository('skeinforge_application.skeinforge_plugins.craft_plugins.chamber.html', self )
  126. self.fileNameInput = settings.FileNameInput().getFromFileName( fabmetheus_interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Chamber', self, '')
  127. self.openWikiManualHelpPage = settings.HelpPage().getOpenFromAbsolute('http://fabmetheus.crsndoo.com/wiki/index.php/Skeinforge_Chamber')
  128. self.activateChamber = settings.BooleanSetting().getFromValue('Activate Chamber:', self, True )
  129. self.bedTemperature = settings.FloatSpin().getFromValue( 20.0, 'Bed Temperature (Celcius):', self, 90.0, 60.0 )
  130. self.chamberTemperature = settings.FloatSpin().getFromValue( 20.0, 'Chamber Temperature (Celcius):', self, 90.0, 30.0 )
  131. self.holdingForce = settings.FloatSpin().getFromValue( 0.0, 'Holding Force (bar):', self, 100.0, 0.0 )
  132. self.executeTitle = 'Chamber'
  133. def execute(self):
  134. "Chamber button has been clicked."
  135. fileNames = skeinforge_polyfile.getFileOrDirectoryTypesUnmodifiedGcode(self.fileNameInput.value, fabmetheus_interpret.getImportPluginFileNames(), self.fileNameInput.wasCancelled)
  136. for fileName in fileNames:
  137. writeOutput(fileName)
  138. class ChamberSkein:
  139. "A class to chamber a skein of extrusions."
  140. def __init__(self):
  141. self.distanceFeedRate = gcodec.DistanceFeedRate()
  142. self.lineIndex = 0
  143. self.lines = None
  144. def getCraftedGcode(self, gcodeText, repository):
  145. "Parse gcode text and store the chamber gcode."
  146. self.repository = repository
  147. self.lines = archive.getTextLines(gcodeText)
  148. self.parseInitialization()
  149. for line in self.lines[self.lineIndex :]:
  150. self.parseLine(line)
  151. return self.distanceFeedRate.output.getvalue()
  152. def parseInitialization(self):
  153. 'Parse gcode initialization and store the parameters.'
  154. for self.lineIndex in xrange(len(self.lines)):
  155. line = self.lines[self.lineIndex]
  156. splitLine = gcodec.getSplitLineBeforeBracketSemicolon(line)
  157. firstWord = gcodec.getFirstWord(splitLine)
  158. self.distanceFeedRate.parseSplitLine(firstWord, splitLine)
  159. if firstWord == '(</extruderInitialization>)':
  160. self.distanceFeedRate.addLine('(<procedureName> chamber </procedureName>)')
  161. return
  162. self.distanceFeedRate.addLine(line)
  163. def parseLine(self, line):
  164. "Parse a gcode line and add it to the chamber skein."
  165. splitLine = gcodec.getSplitLineBeforeBracketSemicolon(line)
  166. if len(splitLine) < 1:
  167. return
  168. firstWord = splitLine[0]
  169. if firstWord == '(<crafting>)':
  170. self.distanceFeedRate.addLine(line)
  171. self.distanceFeedRate.addParameter('M140', self.repository.bedTemperature.value ) # Set bed temperature.
  172. self.distanceFeedRate.addParameter('M141', self.repository.chamberTemperature.value ) # Set chamber temperature.
  173. self.distanceFeedRate.addParameter('M142', self.repository.holdingForce.value ) # Set holding pressure.
  174. return
  175. self.distanceFeedRate.addLine(line)
  176. def main():
  177. "Display the chamber dialog."
  178. if len(sys.argv) > 1:
  179. writeOutput(' '.join(sys.argv[1 :]))
  180. else:
  181. settings.startMainLoopFromConstructor( getNewRepository() )
  182. if __name__ == "__main__":
  183. main()