HOME

cnc.html

Since some people have had problems getting the virtual mill to run, here is a picture of what the vmill currently looks like.

 

This page will document the stages of construction for a 3 axis CNC milling table that I hope to be able to mill PCB's with depending on the table's resolution.

Since I don't quite have all of the parts together to build the actual CNC table, I decided to implement a virtual milling machine that will convert various CAD/CAM outputs(Gcode, HPGL, DXF, GERBER, etc) and be able to actually run the machine codes on the virtual hardware so you can see what the part will look like before you machine it in a real milling machine. This Project will also give me the opportunity to dabble in Java3D, something that I have wanted to do for some time now.

Java3D is very different than OpenGL Lib calls from within C/C++. Java3D uses a conceptual graph structure to optimize the display and transformation/translation of the matrices. After playing with it for a while, I can see that I need to brush up on my linear algebra since it has been a few years since I have hacked matrices. The tree structure of Java3D seems very non-intuitive to me right now, but I am sure that I will get used to it in time. It is definitely wise to model and understand the structure on paper before doing any coding so that you can more accurately define the interrelationship between the BG's(Branch Groups), TG's(Transformation Groups), and leaf or Graphic nodes.

So far, I have a few parts of the mill modeled as well as a crude UI.

11.13.01 UPDATE! I now have the mill, xy Table, UI, view/lighting, and file load capabilities integrated. I have run into some crazy problems trying to model how a block of steel is cut with a virtual tool bit. I initially tried a granular approach where the block was composed of thousands of tiny grain objects each with its own collision detection property. When the tool bit triggered the collision detection property, the grain would disappear. Although this sounds good in theory, you run into some serious memory problems when trying to allocate thousands of objects. This essentially did not work because I would run out of memory when modeling anything bigger than a 1/8" cube. I investigated the use of clipping to perform the material removal but this leads to some difficult matrix math that I'd rather avoid. The only other solution that I can think of is to implement a look-ahead buffer in the g-code virtual machine and design a transparent cut object with the shape of the upcoming tool path and push it into the block object as the tool bit moves. I am not sure if this will work yet, but I am thinking about it. I may end up writing a clipping library in the end, who knows!

For now, the sample program is limited to moving the xy table in a square motion. I haven't finished the g-code virtual machine due to the complexity of the linear and circular interpolation routines, so I just used a few loops so you can see what the table looks like in motion. The rough saw blade edges of the table look pretty sad, but this is due to the minute movements that the table makes. I haven't looked into how Java3D handles anti-aliasing yet, but I may in the future to clean up the edges if possible.

Another fix is going to be converting the whole animation algorithm to multi-thread capability. This is essential for two reasons. First, the digital readout needs to be updated and redrawn by the browser during graphics transformation/translation. Without threads, this is impossible in Java3D. Second, if the viewpoint is going to be changed during a milling operation, we need threads. So, the next update should include a multi-threaded version that allows you to do other things during the milling operation.

Enjoy!

VirtualCNC applet runs in a Java2 enabled browser with Java3D plugin. VirtualCNC Applet