Complete the code to start the G-code preview by loading the file.
preview.load_file('[1]')
The G-code preview tool loads the G-code file, which usually has the extension .nc or .gcode. Other files like STL or config files are not G-code files.
Complete the code to start the simulation of the loaded G-code.
simulation.[1]()To run the G-code simulation, you use the start() method. Other methods like stop or pause control the simulation differently.
Fix the error in the code to correctly set the simulation speed.
simulation.set_speed([1])The speed should be set as a numeric value representing the simulation speed multiplier. Using a string or boolean will cause errors.
Fill both blanks to create a dictionary comprehension that maps layer numbers to their heights if the height is above 0.2mm.
{layer: [1] for layer, height in layers.items() if height [2] 0.2}The dictionary comprehension maps each layer number to its height only if the height is greater than 0.2mm. So the value is height and the condition uses >.
Fill all three blanks to create a dictionary comprehension that maps tool names in uppercase to their speeds if speed is at least 50.
{ [1]: [2] for tool, speed in tools.items() if speed [3] 50 }The dictionary comprehension uses the tool name in uppercase as the key, the speed as the value, and filters speeds greater than or equal to 50.