tl;dr
I wrote a python script to convert X3D .xhtml files into Camotics CNC machines and now you can add MPCNC, LowRider etc. to Camotics free open source gcode simulator/cut viewer. Everything’s on github dot com /Workshop88/camotics_machine_maker (I can’t post the link)
Camotics (camotics dot org) is an awesome free open source CNC simulator/gcode cut viewer capable of displaying a small variety of consumer machines while simulating machine operations (e.g. Shapeoko2/3, Taig, etc.). Unfortunately, Camotics lacks the MPCNC, Lowrider, and the ability to make your own machine designs or add additional machines. (See:github dot com /CauldronDevelopmentLLC/CAMotics/issues/403)
I wanted to create a model of a home built wooden CNC machine at my local makerspace Workshop 88 (workshop88 dot com) for use in Camotics but without a way to make additional machines I decided to hack this Python script together to convert X3D .xhtml files into the files needed by Camotics.
github dot com /Workshop88/camotics_machine_maker
The Camotics machine files have the same filenames as their names making them easy to find in the file system. In Windows I found mine in c:\Program Files (x86)\CAMotics\machines, which requires Administrator privilege to access. Machines are defined by two files, a .json file describing the machine and its parts, and a corresponding proprietary .tco file containing geometry for all the parts (points, lines, triangles). Both files are text and were straight forward to reverse engineer.
I chose X3D .xhtml as the input format because it contains triangles, colors, and edges (unlike STL), it is XML based, and it is visible in a browser to verify correct output from FreeCAD. I think .xhtml files from any source should work so long as the parts of the machines are separate Shapes (though too many Shapes may be unwieldy to configure). X3D .xhtml is an extremely flexible format with deeply nested groups of elements and some referencing so YMMV. I did my best to make it general purpose and document the code should you try to extend/repair it.
I created a basic CNC design in FreeCAD (freecad dot org) by modeling each moving part of the CNC machine in different files (both part and part design bodies work) and brought them all into a single assembly file. The assembly is nothing fancier than a collection of imported parts that are positioned at the origin of where I’d like to place a workpiece. Then I exported the parts into a .xhtml file.
The Python script converts the .xhtml file into a .json and .tco file for Camotics. The .json file needs a little touch up to tell Camotics which parts move with the tool commands from the gcode. This is simple text editing and I’ve provided complete instructions.
In the FOSS spirit I’ve shared this story, the script, the FreeCAD files, example output of the script (to verify correct operation), and the correctly modified .json file with instructions in the repository with the hope that this hack will enable other makers to bring their machines into the truly awesome Camotics gcode simulator.
So, let’s see a [simplified] MPCNC machine in Camotics!
If someone does this, please share it [ with me ]