since desktop 3d printers are not completely reliable , fairly robust error detection and correction is necessary for true automation . this patent application discusses several software and hardware techniques to further automate and optimize the 3d printing process . automated process control involves building a computational model of the 3d printing process . the goal is to optimally select printing parameters based on the cad file and dimensional and structural specifications and tolerances . the model is continuously improved by automatically and / or manually evaluating resulting outputs to provide feedback to the computational model . input features are gathered from both the cad file and user - specified parameters . the cad file is analyzed to determine relevant characteristics such as cross - sectional area along any closed surface or layer , contact area and perimeter with the printing surface , wall thickness , required support material , and angles of supported features . the user may specify dimensional tolerances and strength requirements along a multitude of axes and surface finish requirements for designated faces . these input features are used to estimate the optimal slicing parameters . slicing parameters include information such as printing surface and nozzle temperature , rotational orientation , layer height , maximum speeds and accelerations for each axis , and infill patterns and densities . once the settings are determined , the cad file is sliced and sent to the printer . during printing , computer vision algorithms monitor for failures . in fig1 a , a camera 10 is located for viewing a printing surface 12 . corners of the printing surface 12 are determined and defects show up as glare regions 14 as shown in fig1 b . the algorithms are tuned to predict the cause of the error . for example , if an error is detected very early in the print there is likely an issue with the levelness or coating of the printing surface . if the error is sudden and drastic later on in the print , it is likely that the part became detached from the printing surface and the cause of failure is poor bed adhesion and / or warping . after printing , the system gathers a variety of outputs . dimensional accuracy and surface finish are estimated from a 3d scan of the object provided by the integrated 3d scanner . print surface adhesion can be estimated from the amount of power drawn by the motor powering the removal system . all of the information gathered can be used as feedback for the computational model . over time , various failure modes will become associated with corresponding slicing parameters . for example , poor bed adhesion is likely caused by incorrect temperature settings or printing orientation . failure to meet dimensional tolerances is likely caused by incorrect acceleration , speed , or layer height . the machine learning algorithm determines the degree of correlation between each input and each failure mode . the system maintains a print queue for upcoming jobs , and each job includes metadata such as the amount of filament consumed and an estimated print time . additionally , the system tracks the amount and type of filament for each printer . before shipping to the customer , the material supplier can perform various quality control and calibration processes on a given material cartridge . for example , the supplier measures the precise filament diameter and runs a calibration routine to determine the optimal printing temperatures for both the nozzle and printing surface . the cartridge is tagged with a unique id number , which is entered into a web interface along with the corresponding calibration information . by having the material supplier perform these steps , calibration can be done on a per - batch basis . this is much more efficient than having the end user calibrate for each material cartridge . it minimizes variability from an assumed mean value , resulting in much higher accuracy than assuming that batches will have the same properties . the system stores the active cartridge id for each printer , as well as calibration and remaining material information for each cartridge id . whenever a user wishes to replace the material in the printer , she must first input the new cartridge id . the system will update the corresponding printer &# 39 ; s active material and re - slice objects in the queue based on the calibration information associated with that material cartridge id . after each print job ( successful or failed ) the system updates the amount of material remaining for the relevant material id . whenever a new job is added to the printing queue , the system checks if there will be enough remaining material for the job to complete . if there is an insufficient amount of material remaining , the system will schedule a material replacement and notify the operator . later , if another job is submitted that requires less material such that it can be completed before the material replacement , the system will automatically move the new job ahead in the queue . the system performs these material checks as each part is added to the queue . this means that rather than detecting insufficient material supplies immediately before each print starts , the system detects such shortages well in advance . this allows for a variety of optimizations . smaller jobs that require less material can be moved up in the queue to avoid wasting material at the end of a cartridge . material replacement can be scheduled far in advance , allowing operators to plan their schedules around the replacement . the system maintains an average rate of material consumption for each printer . this combined with information about the supplier and shipment lead time allows the system to automatically order replacement material and have it arrive just in time . this avoids issues associated with getting replacement material at the wrong time : too early and the unused material may degrade before being used , too late and there may be unnecessary machine down - time while waiting for material to arrive . note that users may change material even before the current active material is running low , for example if they require a different color or material type . the old cartridge can be re - installed at a later time . in fact , an old cartridge could even be installed on a different printer connected to the system . this is possible because the system stores remaining material information on a per - cartridge basis , not per - printer . one - way mirrors can be used to facilitate a stable lighting environment for computer vision algorithms . allowing light to exit the printing volume but not to enter it means that operators will still be able to observe the machine , but that external lighting conditions will not affect the accuracy of the computer vision algorithms . internal lighting conditions are stable and can be integrated into the scenes used to generate renders as shown in fig2 that will be compared to images . controlling for varying external lighting conditions with one - way glass will improve the accuracy and consistency of the computer vision algorithms . fig2 a and 2 b illustrate layer - by - layer camera verification . as shown in fig2 a a partially printed part 16 is compared with a render of the partial part 18 . if the partially printed part 16 differs beyond a selected threshold from the render 18 , the part 16 is defective and the system should shut down so that the partially printed part 16 may be removed and discarded . fully automated 3d printers utilize some form of automated part removal to clear the printing surface between prints . a computer vision algorithm is used to verify that the removal was successful and that the printing surface is clean enough for the next print to begin . the process consists of a calibration routine , techniques to compensate for varying lighting environments , and a print surface clearness verification routine . see fig1 a and 1 b . calibration is a manual process involving a human operator . the operator first confirms that the print surface is completely clear . the system then moves the surface to the home position and captures a reference image . next an edge detection or other computer vision algorithm is used to identify the corners of the printing surface in order to determine which pixels in the reference picture represent the print surface . the human operator verifies or corrects this print surface isolation . see fig2 a and 2 b . next the operator cycles through various lighting conditions the printer may encounter . this includes turning on and off lights , opening and closing window shades , and testing during both day and night time . for every possible combination of lighting conditions , the human operator signals to the computer system to capture a glare calibration image with the print surface in the home position . the webcam and / or external sensors on the printer measure ambient lighting conditions associated with each glare calibration image . this concludes the calibration process . after an attempted removal , the system performs the print surface clearness verification routine . first the printer measures the ambient lighting conditions to determine the current most likely lighting conditions . it uses these conditions to select which glare calibration image to use for glare reduction . next the printer moves the print surface into the home position and captures a verification image . glare reduction techniques such as feature recognition or thresholding remove as much of the glare as possible from the verification image . finally , edge detection algorithms are run on the glare - reduced verification image . if no edges are detected within the print surface then the printer is notified that the print volume is clear so it may begin the next print . if edges are detected , the printer is notified to run the removal routine again . if the system detects a failed removal multiple times in a row , the operator is notified to inspect the system and manually remove the part . layer - by - layer verification is used to detect errors during the printing process . if an error is detected , the system can cancel and remove the failed print before either retrying the job or moving to the next job in the queue . layer - by - layer verification consists of a calibration routine , an augmented slicing routine , and a per - layer verification routine . the calibration routine identifies the boundaries of the print surface depending on its height ( the z - height ) and distance from the camera . first a human operator must verify that the surface is clear . next the printer moves to a variety of z - heights and captures a calibration image that is associated with that z - height . for each calibration image , the corners of the print surface are identified either automatically by an edge detection algorithm or manually by a human operator . layer - by - layer verification requires a specialized slicing technique . rather than only generating g - code for every layer , the slicer must also generate a predictive render of what the part will look like after each layer is printed . this takes into account not only the shape of the partially printed objects , but also other slicing parameters such as layer height and infill pattern and density . these renders are adjusted to accommodate material shrinkage based on the material being used and the ambient and printing temperatures . this information is combined with the calibration image of the print surface at the appropriate z - height and distance from the camera to generate a render of what the print should look like after each layer is printed . the per - layer verification routine requires a technique to capture images after every layer of a 3d print . this could include a custom g - code inserted into the g - code file for the print at the end of each layer . when the firmware executes this custom g - code it signals to the webcam to capture a layer verification image . the print can continue uninterrupted while a remote or local server processes the layer verification image . only if the verification process detects a variation from the acceptable tolerances will the print be cancelled . once the layer verification image is captured and sent to the remote or local server , the system compares the verification image with the predictive render associated with the current z - height from the slicing routine . this verification involves edge detection , feature recognition , and other computer vision techniques to determine how close the current print is to the predicted render . if the difference between the image and the render is below a threshold value the print may proceed . otherwise the print job is cancelled and removed , after which the print job can either be attempted again ( potentially with adjusted parameters ) or skipped so the next job on the queue can be printed . the verification algorithm compares not only the shape of the part , but also it &# 39 ; s position relative to the printing surface . this allows the system to detect when parts become either partially or completely detached from the printing surface . this is a common failure mode that cannot be recovered from without restarting the job , and can potentially cause damage to the printer if the failed job is not terminated . detecting shadows is very useful for detecting failures , particularly when the material is a very similar color to the printing surface or background . the lighting conditions of the printer are included in the scene used to generate renders , so shadows are present in both the render and the image . comparing these shadows provides additional data on if the print is succeeding . with reference now to fig3 a and 3 b , lights 20 form an array of lights . the lights 20 may be light emitting diodes . as shown in fig3 a and 3 b , the lights cast shadows from the feature a being observed . in order to improve the ability of the algorithm to predict if a print has failed , users can annotate which frame of a time lapse generated from the layer verification images as the point of failure . all previous images can be used as negative training examples ( no errors ) and all subsequent images can be used as positive training examples ( error ) for an error detecting classification algorithm . layer - by - layer verification also enables automatic printer self - preservation . some failed prints potentially result in the printer damaging itself , for example by crashing the print head after the motor skips or by getting stray material stuck in components such as belts , pulleys , and bearings . by detecting failures in - process , the machine is much less likely to continue a failed print long enough to cause serious damage . to facilitate continuous improvement of the entire 3d printing process , the system uses a combination of computer vision and machine learning techniques to evaluate prints and improve parameter optimization for the slicing process . this involves various relevant inputs to the slicing software and features of the model being printed , as well as relevant features of both successful and unsuccessful prints . the system evaluates the features of the 3d model to select the inputs for the slicing software , and then evaluates either 2d images or 3d scans of the printed part to provide feedback . over time , the system will learn how to best optimize the slicer settings in order to produce high - quality prints . features of 3d models may include cross sectional area at various heights , print surface contact area , user - annotated force vectors , wall thickness , user - specified print time requirements , and other relevant features . slicer parameters may include layer height , infill pattern and density , extrusion width , printing temperatures , and various other parameters of the slicing software . feedback from models may include metrics such as dimensional accuracy , surface finish , measured print time , and user - supplied strength ratings . 3d scanning and / or computer vision are used to verify the quality of the part . this allows an operator to print a part and know that it will meet specifications . the system uses a 3d scan and / or computer vision algorithms to compare the outer surface of the completed or partially completed part to the cad model and specifications . if a job does not meet specifications , it can automatically be resubmitted , optionally with altered settings to increase the likelihood of compliance with specifications . the operator no longer needs to iteratively set parameters , print , and measure the part , since the system performs all steps of this process automatically . a variety of machine learning algorithms may be suitable to map these features and develop a model for 3d printing slicer parameters . these include hidden markov models , bayesian inference , and artificial neural network algorithms . part evaluation can be performed on a layer - by - layer basis . this allows the system to verify tolerances on internal features that may not be visible when the print has finished . all of the techniques from this section can be integrated into the layer - by - layer routine to provide in - process feedback to the machine learning algorithms . when new feedback causes drastic changes to the model , old slicing paramters may no longer be optimal . the system can detect such drastic changes and re - slice parts waiting in a queue to take advantage of the updated model . if the system learns from one or more printers that adjusting a certain parameter greatly improves quality of a related feature , other printers can use this information to re - slice queued parts based on the improved model . there are many tools available to view and manipulate 3d models , both in the cloud through the browser and with locally installed software . however , none of these tools provide direct feedback on how various slicing settings will affect the object being printed . our system includes 3d print preview , which gives users real - time visual feedback of how input settings will affect the printed shape . 3d print preview incorporates relevant context attributes to generate accurate real - time renderings of a potential 3d print . for example , the system selects the color of the print preview based on the color of filament currently loaded into the user &# 39 ; s printer . additionally , the object is rendered within a to - scale representation of the print volume . 3d print preview updates the rendering in real time as users adjust print settings . for example , when a user adjusts the speed vs . quality setting the system adjusts the layer height used to print the object . the render of the object includes a representation of the layer height , which is adjusted in real time as the user adjusts the speed vs . quality slider . since layer height is very small relative to the size of most parts , anti - aliasing techniques are necessary to avoid unwanted artifacts in the render . unlike toolpath visualization tools which require complex pre - processing on a model before rendering , 3d print preview generates a computationally - efficient visualization of the model . even the fastest pre - processors ( aka slicers ) can take 10 - 20 seconds to generate a toolpath from an average sized file . these preprocessors must run again after every parameter update . 3d print preview loads quickly in the user &# 39 ; s web browser and responds in real - time to sliders that control key printing parameters before slicing the cad file . conventional 3d scanners generally require rotation of a laser and camera relative to the object being scanned . integrating this rotation with a cartesian 3d printer to make a dual 3d printer / scanner can be difficult . we propose a system with a small number of standard webcams and an array of lights to generate 3d scans without moving the camera relative to the object . fig3 a and 3 b illustrate a suitable array of lights to gather 2 - d projections from the object being printed . the system uses the array of lights to gather 2d projections ( shadows ) of the object from various angles . the lights must emit a spectral range that is within what the cameras can detect , but this range may or may not fall within the visible spectrum . the lights are turned on one at a time or in specific groups and an image of the object is gathered with each webcam . the shadow of the object can be used to reconstruct a profile view from the point of view of each light . several of these profile views can be used to reconstruct a 3d model of the object . the system can be improved by using a printing surface with a precise grid to provide reference points for the computer vision algorithm . additionally , the system can align axes with specified dimensional tolerances with one or more lights to guarantee that the relevant dimension can be measured . finally , the system can move the printing surface along the z axis or move the webcam in order to get necessary views . the difference between scanning an arbitrary object and checking if a manufactured part meets specifications is subtle but important . since the system knows what the object should look like , it can predict what shadows a particular light combination will create , then verify if those shadows appear as expected . this is a much simpler process than attempting to generate an entire 3d model from a small selection of profile views . this technique could potentially be optimized by using multi - color lights or lights with different wavelengths . if the camera can accurately identify any possible combination of lights , a single image can be used for the above process . camera filters can be used to isolate a specific spectrum . based on the color measured at each pixel of the image , the system would determine which lights are shining on that point unobstructed . this would result again in a series of shadows from each light view , which can be used to generate profile views and in turn a reconstructed 3d model of the object . fig4 shows an overall system diagram . this figure shows both the remote and local aspects of the system . fig5 illustrates the automated process control of the invention with layer - by - layer verification .