15th Sep 2025 This is a work-in-progress version of a utility I'm writing that will allow you to take a series of OpenSCAD transformation calls, and output a shorter sequence of calls that should have the same effect. Note that the transformations (translate, rotate, mirror, and multmatrix) should have numeric parameters, not parameter names or expressions. This code only accepts the transformation calls, not full OpenSCAD statements, for example, these: rotate([ 0.00, 0.00, 90.00]) scale([1.00,2.00,1.00]) mirror([1,0,0]) translate([ 0.00, 0.00, 50.00]) mirror([0,1,0]) rotate([ 0.00, 90.00, 180.00]) scale([ 1.00, 0.50, 1.00]) (they don't have to be on separate lines) Running the utility can be done interactively as follows: $ ./conflate /dev/stdin rotate([90,0,0]) rotate([0,180,0]) ^D conflate: parsed "/dev/stdin" successfully /* maps to: multmatrix([ [-1.00, 0.00, 0.00, 0.00], [0.00, 0.00, 1.00, 0.00], [0.00, 1.00, 0.00, 0.00], [0.00, 0.00, 0.00, 1.00] ]) */ // which is equivalent to: rotate([ 90.00, 0.00, -180.00]) $ ./conflate /dev/stdin rotate([0,180,0]) rotate([90,0,0]) ^D conflate: parsed "/dev/stdin" successfully /* maps to: multmatrix([ [-1.00, 0.00, 0.00, 0.00], [0.00, 0.00, -1.00, 0.00], [0.00, -1.00, 0.00, 0.00], [0.00, 0.00, 0.00, 1.00] ]) */ // which is equivalent to: rotate([-90.00, 0.00, 180.00]) If you're interested in seeing how the code works, or want to make enhancements, the significant source file is conflate.g which is the combined grammar for CSG files and code to perform the simplification. Everything else in this directory is a copy of my parser generator. If this code were to be added to OpenSCAD, you would use the internal AST of OpenSCAD rather than parsing the output to recreate an AST. (And if anyone wanted an actual utility like this, I'ld recommend converting conflate.g into the format of whatever more well-known parser generator you prefer to use, for better portability. The main logic of the optimisation is all contained in the single function 'optimised_csg') There is a statically-linked intel (x86-64) binary of conflate in this directory if compiling from source is too daunting (though it shouldn't be - just copy the files and type 'make'. The zip file here contains all the other files.) conflate-aarch64 is the same binary, also compiled statically, for arm aarch64 (specifically raspberry pi). You may also be interested in a similar utility, flatten, in the directory above this one. It takes a .csg file and removes a lot of redundancy from it. However it does not apply these transformation conflations. Perhaps at some point in the future these two programs may be merged but that is not an immediate priority. Graham