Programming

From ShapeOko
Jump to: navigation, search

Naturally, programming may be used in many ways for CNC. The earliest example was of course direct G-Code generation which was the original focus of this page.

Cf.: Interactive G-Code Generators and https://github.com/NRSoft/GSharp . Pre-processor which extends Grbl to include much of G-code: https://github.com/NRSoft/GSharp [1]

The Communication / Control program bCNC supports a Python-based macro language for G-code.

In addition, Will Winder's Java Universal-G-Code-Sender has gained a number of features for manipulating G-Code files.

Excellent examples of directly programming G-code: http://www.sawmillcreek.org/showthread.php?244397-Some-CNC-work

Languages and IDEs which have been used for CNC

Type Name/Link Description
Language and IDE (opensource) Processing Processing is an open source programming language and environment to create images, animations, and interactions. See GCtrl and SuperSkein 1.0.

https://medium.com/@ProcessingOrg/thoughts-on-software-a8a82c95e1ad#.5epe1jlml

Used to make DXFs for the designs at: http://atfab.co/

https://github.com/TPMoyer/Grbl4P --- GUI interface to GRBL V1.1 CNC control using Processing 3.

Language and IDE (opensource) NodeBox Cross-platform, node-based GUI for efficient data visualizations and generative design. Used to make a sundial https://www.nodebox.net/code/data/media/sundial-slant.pdf .


Spirograph example sent to a CNC machine and milled.

Note that it uses pixels/points, and scaling and other values are limited in precision, work which requires accuracy would have to be specified in terms of native units.

Vector graphic languages

Logo is notable for being the first, and there are many implementations.

3D Modeling Libraries and Languages

Best represented by OpenSCAD (and ImplicitCAD) there are a wide variety of ways to use a representational language which may be described as "Programmatic CAD" and several similar programs are either listed here, or on the CAD page.

3 dimensional control of a beetle (replacement turtle) allows programmatic design of 3D objects in: http://beetleblocks.com/

Library which provides PHP 7 functionality for reading and writing from and to 3D objects stored in STereoLithography (STL) files: https://packagist.org/packages/php3d/stl [2]

Type Name/Link Description
3D parametric modeling (Opensource) OpenSCAD Software for creating solid 3D CAD objects, available for Linux/UNIX, MS Windows and Mac OS X. A 3D-compiler that reads in a script file that describes the object and renders the 3D model. Similar on-line tools include CoffeeScad, OpenJsCad and fabfabbers running openscad converted to JavaScript. See also SolidPy, a Python script for manipulating objects. Cf., RapCAD, a system optimized for RepRap 3D printers, Developer’s blog. There is also an app for Android, ScorchCAD.

See also the graphical version https://www.blockscad3d.com/editor/# or Ulticreator, an interactive front-end for CoffeeSCAD

See also http://www.loria.fr/~slefebvr/icesl/ which adds slicing for 3D printing.

3D modeling (opensource Linux/Mac) Antimony Computer-aided design (CAD) tool inspired by LISP, based on: framework for tracking information flow through directed acyclic graphs, geometry engine for doing CSG and includes a standard library of shapes and transforms.[3]

Hackaday: Otherworldy CAD software hails from a parallel universe

Available for Mac OS X and Linux, there is an effort to build it on Microsoft Windows.

Based on Kokopelli [4] --- deprecated, c.f., https://github.com/mkeeter/antimony and https://github.com/libfive/libfive [5]

An early stage of this work was written up in: http://mattkeeter.com/research/thesis.pdf

3D modeling (Opensource) Flood Free (MIT license) modeling program/programming language source available at: http://www.github.com/pboyer/flood

https://tutorial45.com/free-solidworks-alternative/

https://www.reddit.com/r/hobbycnc/comments/bdvd9h/floodeditor_parametric_cad_system_under_mit/

https://www.reddit.com/r/cad/comments/bdvcnt/parametric_cad_system_under_mit_license/

Python front-end for OpenSCAD SolidyPy Use a Python IDE and the Python language to treat objects like objects (not text), use existing OpenSCAD modules, manipulate objects and copy shapes. Extensible.
Python front-end for OpenSCAD SolidPython A python frontend for solid modelling.

https://pypi.org/project/viewscad/ --- Jupyter Notebook interface

Python front-end for OpenSCAD openpyscad Python library to generate OpenSCAD source intuitively.


Java front-end for OpenSCAD JavaSCAD Representation of OpenSCAD primitive objects with Java objects allowing the building of more complex ones from them.
Python development framework PythonOCC 3D CAD/CAE/PLM development framework for the Python programming language --- provides advanced 2d and 3d geometry modeling structures and algorithms: Bézier BSplines Extrude/revolve/sweep.

https://www.reddit.com/r/Python/comments/2ukppo/python_occ_a_parametric_3d_cad_software/

Javascript query-like language CadQuery Python based language for building parametric 3D CAD models. Switching to PythonOCC from FreeCAD. Forum: https://groups.google.com/forum/#!forum/cadquery Originally at: https://github.com/dcowden/cadquery

https://pythonhosted.org/cadquery/intro.html

Stand-alone GUI under development: https://github.com/jmwright/cadquery-gui

Go

https://github.com/deadsy/sdfx --- A simple CAD package using signed distance functions to make STLs (golang -> stl). [6]

Python

https://www.codelv.com/projects/declaracad/ --- language and application to build 3D models using a subset of the python language called enaml

https://github.com/orbingol/NURBS-Python [7] http://www.pyxplot.org.uk/

http://savannah.nongnu.org/projects/soya3d/

http://pythoncad.sourceforge.net/dokuwiki/doku.php?id=program_code_description

https://vpython.org/

Python stuff to add for OpenSCAD from the mailing list (find link in forum for footnote)

...and https://github.com/SquirrelCZE/pycad/

...and https://github.com/vishnubob/pyscad

...and https://github.com/bjbsquared/SolidPy

...and https://github.com/acrobotic/py2scad

...and https://github.com/TheZoq2/py-scad

...and https://github.com/defnull/pyscad

...and https://github.com/jed-frey/CNC3018

OpenSCAD interface extensible with Python

http://graphscad.blogspot.com/

Groovy (IDE)

https://vrl-studio.mihosoft.eu/ --- IDE for Groovy with visual programming options. Used in: https://www.thingiverse.com/thing:3101675 using https://github.com/miho/VRL-VCSG

CAD

http://tenko.github.io/occmodel/index.html#examples

https://code.google.com/archive/p/caddd/

http://runten.tripod.com/NURBS/ --- port of Mark Spink's SCILAB/MATLAB toolbox to python

http://diyhpl.us/cgit/lolcad

Other

http://c-csg.com/ --- for use with Linux and GCC

http://blackjk3.github.io/threefab/

https://github.com/thi-ng/morphogen

http://structuresynth.sourceforge.net/ [8]

https://github.com/avalero/OOML https://hackaday.com/2017/01/03/ditch-openscad-for-c/ https://www.researchgate.net/publication/254034593_Boosting_mechanical_design_with_the_C_OOML_and_open_source_3D_printers

http://www.omnigia.com/SchemeCad/

www.dia.uniroma3.it/~scorzell/cscheme/index.htm --- integration of OpenCascade and MzScheme

http://www.plasm.net/ --- embedded in Python as pyplasm

https://github.com/farrellm/scad-clj OpenSCAD DSL in Clojure https://github.com/adereth/dactyl-keyboard https://www.youtube.com/watch?v=uk3A41U0iO4 [9]

http://hyperfun.org/wiki/doku.php?id=hyperfun:main --- specialized high-level programming language intended for modeling geometric objects and their internal volumetric properties

https://github.com/arnholm/angelcad https://www.abmesh.com/try-angelcad/ https://github.com/arnholm/angelcad-docs https://github.com/arnholm/angelcad-samples [10]

http://verbnurbs.com/ https://github.com/pboyer/verb

https://github.com/OpenNURBS/OpenNURBS

http://libnurbs.sourceforge.net/

https://tinyspline.org/

Guile/Scheme: https://libfive.com/ --- https://github.com/libfive/libfive --- Linux/Mac OS X

http://www.curv3d.org/ GitHub --- Linux/Mac OS X

Blockly: https://blockly-demo.appspot.com/static/demos/code/index.html

3D printing

3D printing oriented: https://github.com/jminardi/mecode

JavaScript

http://snapsvg.io/

https://github.com/tasn/scadjs --- JavaScript library for making OpenSCAD code [13]

https://github.com/ghemingway/cad.js/tree/master

https://www.viewstl.com/plugin/

Maker.js

Maker.js --- a Microsoft Garage project, a JavaScript library for creating and sharing modular line drawings for CNC

OpenJsCAD

(Renamed to jsCAD, but either is acceptable)

Announced on Thingiverse: https://www.thingiverse.com/thing:16272 Early project: https://www.thingiverse.com/thing:16329

https://github.com/jscad

Documentation:

Implementations:

Gallery:

Articles:

Sample Files:

Interface exemplar:

https://gen.haxit.org/organizer/ [14] https://www.reddit.com/r/lasercutting/comments/7x5wug/i_made_a_parametric_organizer_with_openjscad/

Image albums:

Blockly: http://openjscad.azurewebsites.net/blockly/index.html --- Blocks seem not to work, generating errors

https://makerscad.com/

G-Code Libraries and Languages

Type Name/Link Description
JavaScript-derived programming language TPL (Tool Path Language) Programming language for creating machine tool paths for CNCs.[15] CAMotics (formerly openscam) has support. Now has an associated project sharing site: https://projects.buildbotics.com/doug/TPL_Helper_Library
Python halftoning program pixel machining[16] Python program to make halftone images out of pixel maps using the Python Imaging Library.
G-Code pre-processor written in Python Mecode Convenient, human-readable layer just above GCode. Written in Python.
G-Code pre-processor JGCGen A G-Code preprocessor and generator based on Apache Velocity. http://www.vagrearg.org/content/gcmc
G-Code pre-processor gcmc Compiler with a context-free grammar and procedural format, which runs scripts to make G-code for a CNC mill. Supports variables and advanced math (scalars, vectors and vector-lists) including mil/mm unit-conversions.[17]
G-Code library written in Python preGrbl Checks and validates g-code compatibility, converts g-code into a more grbl-friendly format, and provides a way to implement and translate canned cycles and other high-level tasks. Written in Python.
TCL g-code preprocessor code gcode and example.tcl TCL program which allows one to program in G-code using TCL to implement loops and other control structures.
PostScript to G-Code Converter ps2gc source Command-line utility to convert from (some) PostScript formats to G-Code --- affords the possibility of using tools like Asymptote or METAPOST, may be what was used for NodeBox (above). CF the reverse, gcode2eps which would be very useful for previewing on systems which have Display PostScript.
Python and CNC presentation Python: A "Toy" Language PyCon presentation on using Python (and IPy Notebook) to generate G-code.
Python utilities gctools[18] A set of Python scripts to help create and manipulate CNC gcode files.
Python library pyfab Python library for fab/lab control.See also dxf 1.1.1 a Python library to generate DXFs.
Apt interpreter APTOS Opensource Apt translator project. Consists of several CAM applications, based on the Apt programming language. See APT Tutorial.
G-code utility grecode Opensource command line utility to shift, rotate, mirror, align gcode. See also JavaScript G-Code Translate, Scale (but not Rotate yet).
G-code utility padder Utility to add spaces to G-Code (also includes Scan2 CNC (convert image to G-Code) and Wrapper (wrap a toolpath around a cylinder for those who have a lathe as a 4th Axis).
G-code utility CNC G Code Arcs to Lines Conversion Program Utility to convert all arcs to straight line segments.


An interesting development is ShopBot's opensourcing of their control language, OpenSBP.


Ruby

https://github.com/kodaxx/Rcode --- open source project to create a layer on top of Gcode that is a bit more readable, based on Ruby, and as such has access to all of Ruby.[19]

https://github.com/jglauche/CrystalScad --- framework for programming 2d and 3d OpenSCAD models in Ruby

G-Code editors

See also http://nc-corrector.inf.ua/index_EN.htm (listed on the Previewing G-Code page) and https://sourceforge.net/projects/gcodedownloader/ (listed on Communication / Control).

File formats

DXF

https://github.com/yofu/dxf [24]

Python

https://pypi.org/project/dxf/

STL

https://help.github.com/articles/3d-file-viewer/

SVG

Arguably SVG itself can be hand-coded (the same can be said of PostScript). There are a number of SVG-specific tools:

Discussions

http://galaxykate0.tumblr.com/post/139774965871/so-you-want-to-build-a-generator

https://emacstragic.net/2013/05/27/programmatic-cad-openscad-alternatives/

References

https://rosettacode.org/wiki/Yin_and_yang#Metapost