Skip to content

Workshop88/camotics_machine_maker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Camotics Machine Maker

A Python script to create a Camotics CNC Simulator machines from X3D .xhtml files.

Background

Camotics is an awesome open source CNC simulator/gcode cut viewer capable of displaying a small variety of consumer machines while simulating machine operations. Unfortunately, Camotics lacks native tools/interfaces to import your own machine designs. (See:CauldronDevelopmentLLC/CAMotics#403)

I wanted to create a model of a wooden CNC machine at my local makerspace Workshop 88 for use in Camotics but there is no built into the program to make additional machines so I hacked this Python script together to read X3D .xhtml files I create in FreeCAD and write the necessary files for Camotics. Workshop 88 Wooden CNC Workshop 88 Wooden CNC Closeup

The machine files have the same filenames as their names in Camotics making them easy to find in the file system. In Windows I found mine in C:\Program Files (x86)\CAMotics\machines, which requires Administrator privelege 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 and edges (unlike STL), it is XML based, and it is visible in a browser to verify correct output from FreeCAD. I think any .xhtml file should work from any source so long as the parts of the machines are separate Shapes (though too many Shapes may be unwieldly to configure). Unfortunately X3D .xhtml is an extremely flexible format with deeply nested groups of elements and some referencing resulting in a script that may "work on my machine" or "work on my file" and maybe not yours, though I did my best to make it general purpose and document the code should you try to extend/repair it.

Usage

python camotics_machine_maker.py filespec.xhtml

This will parse filespec.xhtml then generate filespec.json, and filespec.tco in the same location as filespec.xhtml. The script will silently overwrite preexisting files.

Note: filespec.json will require additional manual editing to tell Camotics which components move with X, Y, and Z movement of the tool in the simulated gcode. See /example/data/Camotics for detailed instructions.

Example commandline

python src\camotics_machine_maker.py "example\data\Wooden CNC.xhtml"

This will run the included script on the included example data to recreate the .json and .tco files in the example\data folder. This can be used to validate the script works on your machine and generates output that agrees with the files in source control.

Installation

To install a machine in Camotics:

  1. Copy your .json and .tco files to the directory containing the other Camotics machines. On my Windows machine that isC:\Program Files (x86)\CAMotics\machines which will require Administrator privileges.
  2. Start (or restart) Camotics.
  3. Be sure to enable Toggle Machine Display Toggle Machine Display
  4. Go to Settings from the tools menu Settings from Tools menu
  5. Select your machine from the dropdown list and click Save Select machine
  6. Test your machine by running the default or your own gcode to verify the parts are moving correctly and iterate if necessary.

Examples

I hope it works for you!

I can't wait to see machines like MPCNC, and silly stuff like Hello Kitty, and NutterButter CNC machines crazy internet people make for Camotics!

About

Python script to create a Camotics CNC Simulator machine.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published