Individual Assignment
Group Assignment:
Velichappad is a light painting machine that operates using a Core XY mechanism to control the precise movement of light. Its working principle involves opening a camera shutter for a long exposure, during which the machine guides a light source along a programmed path. The path is defined by G-code instructions generated from a design. As the light moves, it creates intricate light trails that are captured in the long-exposure photograph, producing visually stunning light paintings.
I took the responsibility of planning and coordinating the project activities.
We began with brainstorming sessions to explore various mechanisms and ideas, deciding which features to include or leave out based on feasibility and relevance. After finalizing the concept, I prepared a project schedule and assigned tasks to each team member based on their skills and interests.
The project timeline and task distribution are outlined below to guide the development process.
Task distribution,
My tasks were Project palnning, Programming G Code, Fabrication, Testing and Assembly.
Before proceeding with the fabrication of the machine components, it was essential to verify the design dimensions to ensure accuracy in the final manufactured parts. To do this, I conducted a nut fitment test, and the results are detailed below.
![]() |
![]() |
I designed it in Fusion 360 and printed it and the results are shown below,
![]() |
![]() |
For fabricating the components of our machine, we required a 3D printer, laser cutter, and PCB milling machine. Noel and I focused primarily on fabricating the parts using the 3D printer. After completing the design and getting it verified by our instructors, we promptly began the fabrication process without delay. Surprisingly, we managed to complete the 3D printing ahead of schedule, which gave us the added advantage of starting the assembly phase earlier than planned.
Ashish was assigned the task of testing the firmware. We had access to an existing plotter with a Core XY mechanism, which we used as a test platform. He did an excellent job running the machine and modifying the firmware to suit the requirements of our project. Meanwhile, my responsibility was to generate G-codes for testing. I used Fusion 360 for G-code generation and, with the help of ChatGPT, developed a Python script to post-process the G-code specifically for our machine.
I imported the Super Fablab Kerala's logo to Fusion 360. Scaled it to the machine's bed size.
Changed the workspace from Design to Manufacturing. Initially specified the stock size and box point. To set the stock select the stock set up marked as 1. Change the orientation to Z axis/plane & X axis and specify te Z axis and the X axis of the work piece. Follow the steps marked as 2, 3 and 4. Select the Box point as bottom left marked as 5.
As we needed the G code for the plotter I chose the Trace toolpath from 2D. This toolpath just follows the countour we selected.
![]() |
![]() |
![]() |
After these changes, I post processed the tool path to get the G code.Right click on the Trace tool path to access the Post process. I used HAAS(pre-NGC) post. Changed the file name and selected the Post.
![]() |
![]() |
Similarly created the Trace tool path for next 2 and generated the G code.
The G code generated was for HAAS milling machine and I needed to make some changes so that I can run this code on the Firmware Ashish was working on. I decided to make a python script so that I can easily make the changes. The Tool number and the head part and the tail part of the program needed to be deleted fron the code. As we were using a light painting machine we needed to turn ON and OFF the light precicely to get the optimal output. Initially the code generated have Block numbers in it as N followed by numbers and I needed to eleminate it from the program. Also the light needed to be turn ON whrn the Z value becomes 0 and the light needed to be turned OFF when the Z value become positive. There should be multiple feed rates in the program and I needed to make the feed rates as 2000. I used ChatGPT for generating the python code as I was not tried the python language before. I provided my requirements and it generated the code for me.
The G Code generated from the post of Fusion 360 was in .nc file extension so I needed to change it to .gcode extension to load that into the firmware. So I manually changed the extension.
Created a folder and pasted all the G Codes and the python file in it and opened it in VS Code.
![]() |
![]() |
In the python code type the file names of the G Code in the position marked as 1 and change the output file name at 2 and type python followed by the name of the file of python file. In this case I named the python file as python.py so I typed python python.py and type enter.
Then the changed file was saved as the name we specified in the output folder section.
This file is loaded on the machine's firmware and the output is shown below.
The test was almost Ok but the light was not turning OFF but the axis moved perfectly as of the G Code.
import re
def process_gcode_line(line):
# Remove 'N' numbers (e.g., N100)
line = re.sub(r'\bN\d+\s*', '', line)
# Replace all feedrate values with F2000
line = re.sub(r'F\d+(\.\d+)?', 'F2000', line)
# Replace lines based on Z values
z_match = re.search(r'Z([-+]?[0-9]*\.?[0-9]+)', line)
if z_match:
z_val = float(z_match.group(1))
if z_val > 0:
return "M5\n"
elif z_val == 0:
return "M3\n"
return line
def process_file(filename):
with open(filename, 'r') as f:
lines = f.readlines()
# Remove lines up to and including the one with 'M8'
start_index = 0
for i, line in enumerate(lines):
if 'M8' in line:
start_index = i + 1
break
lines = lines[start_index:]
# Remove lines from 'M5' onward
end_index = len(lines)
for i, line in enumerate(lines):
if 'M5' in line:
end_index = i
break
lines = lines[:end_index]
# Process each remaining line
processed_lines = [process_gcode_line(line) for line in lines]
# Add G4 P20 at the end
processed_lines.append("G4 P20\n")
return processed_lines
def merge_processed_files(file_list, output_file):
merged_lines = []
for file in file_list:
processed = process_file(file)
merged_lines.extend(processed)
merged_lines.append('\n') # Optional: newline between files
with open(output_file, 'w') as out:
out.writelines(merged_lines)
print(f"✅ Merged and processed G-code saved to: {output_file}")
# 🔽 List your G-code files here in order
input_files = [
'file1.gcode',
'file2.gcode',
'file3.gcode'
]
# 🔼 Output file name
output_file = 'merged_output.gcode'
# 🔁 Run the process
merge_processed_files(input_files, output_file)
ChatGPT promt:
I want to alter g code and i need a python Script.
1. I need to remove all N followed by numbers from my code.
2. Remove all till M8 and from M5.
3. If the Z value is positive replace the line with M5 and if Z is 0 replace the line with M3.
4. Replace all F values to F2000
5. I have multiple G code files. So initially take 1st file and make these changes then take the next file and make changes. individually make changes to all the files and at last make it as a single file. the merging is done according to the files I listed in the input.
After all these process I along with Noel and Ancy started to assemble the machine. As we were using the aluminium extrusion we needed the corner brackets to join the extrusions. As there was no corner brackets available in the inventory we just took it from our instructor Saheen's small milling machine which he was trying to make it work for the past 5 years 😜 😁.
With his permission we took the brackets and assembled the frame.
![]() |
![]() |