<p>I would like to be able to add custom commands/script to be executed during a print.</p>

<p>For example I would like to write some software to take a picture check the print hasn't moved off the bead between layers. </p>

<p>Does anyone know if any of the available software/firmware allows custom scripts or calling back to the computer before continuing printing?</p>

<p>I am happy to build/buy a new printer if anyone knows a control board that has this sort of feature. </p>

[{'answer_id': 5809, 'author': 'profesor79', 'author_id': 9730, 'author_profile': 'https://3dprinting.stackexchange.com/users/9730', 'pm_score': 2, 'selected': False, 'text': '<p>One of the solutions could be adding a layer change script (simplifi3d has that out of the  box) and then using marlin firmware you could set a value to digital pin that could triger external actions.</p>\n\n<blockquote>\n  <p><a href="https://forum.simplify3d.com/viewtopic.php?t=1959" rel="nofollow noreferrer">Layer Change G-Code</a>: I personally haven\'t had to use this, but I\'m\n  sure that there are some excellent reasons/ideas to use for this. If\n  you\'d like for a G-Code script to be inserted in-between each layer,\n  than you can simply place it in this tab. One interesting use of this,\n  is for the FlashForge Dreamer, to have the lights blink in between\n  each layer, however that can be a bit too much at times! </p>\n</blockquote>\n\n<p>The syntax for the M42 command is: M42 S(value to be written to pin) P (pin number) e.g. To set digital pin 30 high, you would use M42 S1 P30</p>\n\n<blockquote>\n  <p><a href="http://forums.reprap.org/read.php?146,168237,173098" rel="nofollow noreferrer">The MARLIN firmware will</a> not enable you to change the status / write\n  values to any of the pins in use for things such as the heaters,\n  thermistors, end stops etc. The command will let you send values other\n  than 0 and 1 to any pins which can output analogue values. (0-255)</p>\n</blockquote>\n'}, {'answer_id': 5812, 'author': '0scar', 'author_id': 5740, 'author_profile': 'https://3dprinting.stackexchange.com/users/5740', 'pm_score': 2, 'selected': False, 'text': '<p>A solution I use involves a 3d print server. I have defined shell scripts that address the GPIO ports of the Raspberry Pi that runs OctoPrint. OctoPrint is a 3d print server that can be accessed over your home network.</p>\n\n<p>From the <a href="https://octoprint.org/" rel="nofollow noreferrer">OctoPrint homepage</a>:</p>\n\n<blockquote>\n  <p>OctoPrint is the snappy web interface for your 3D printer that allows\n  you to control and monitor all aspects of your printer and print jobs,\n  right from your browser.</p>\n</blockquote>\n\n<p>This print server application allows for specification of custom Gcode commands (linked to system commands for instance; note this is a plug-in called "GCODE Systems Commands", see image below). </p>\n\n<p>As an example, e.g. OCTO100 is scheduled to run fan_on.sh shell script. This script in its turn drives a relay to switch the annoying extruder cooling fan that is always on when the printer is powered. These codes can then be used throughout your sliced file to do stuff you want (e.g. by using the TweakAtZ plugin of Cura). E.g. my extruder fan will stay on several minutes before it is scheduled off after a successful print through OCTO110 which in itself runs the script fan_off.sh.</p>\n\n<p><a href="https://i.stack.imgur.com/1CaMa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1CaMa.png" alt="enter image description here"></a></p>\n\n<p>The scripts from the figure could be setup to schedule to do something, e.g. fan_on.sh controls a relay using port 22 of the GPIO of the Raspberry PI:</p>\n\n<pre><code>#!/bin/bash\ngpio export 22 out\ngpio -g write 22 0\n</code></pre>\n\n<p>So to disable the fan you would need fan_off.sh to be:</p>\n\n<pre><code>#!/bin/bash\ngpio export 22 out\ngpio -g write 22 1\n</code></pre>\n'}, {'answer_id': 5814, 'author': 'Fernando Baltazar', 'author_id': 4454, 'author_profile': 'https://3dprinting.stackexchange.com/users/4454', 'pm_score': 1, 'selected': False, 'text': '<p>I saw this 3 years ago, this is a <a href="https://www.youtube.com/watch?time_continue=33&amp;v=L-_5KsAOVko" rel="nofollow noreferrer">closed loop control</a>, I think is better that taking a photo then analyze it with a kind of optical recognition software which needs some of possible failures.</p>\n\n<p>The video has also the link for the <a href="https://www.youmagine.com/designs/dc-motor-closed-loop-control-software" rel="nofollow noreferrer">additional resources</a> the 3d printer will need according his author.</p>\n'}]
['https://3dprinting.stackexchange.com/questions/5807', 'https://3dprinting.stackexchange.com', 'https://3dprinting.stackexchange.com/users/1476/']