Index of /OpenSCAD/colorsep
Name Last modified Size Description
Parent Directory -
colorsep.c 2025-06-29 20:41 14K
colorsep-filter.c 2025-06-29 20:41 26K
colorsep.g 2025-06-29 20:41 2.9K
colorsep-main.c 2025-06-29 20:41 7.5K
flex.c 2025-06-29 20:41 9.2K
flex.h 2025-06-29 20:41 9.4K
gencomp.c 2025-06-29 20:41 12K
Makefile 2025-06-29 20:41 3.5K
parser.h 2025-06-29 20:41 842
regen.c 2025-06-29 20:41 10K
regexp-lexer.c 2025-06-29 20:41 43K
regexp-lexer.h 2025-06-29 20:41 1.3K
takeon.c 2025-06-29 20:41 24K
takeon-checks.c 2025-06-29 20:41 24K
takeon-output.c 2025-06-29 20:41 32K
uparse.c 2025-06-29 20:42 60K
uparse-main.c 2025-06-29 20:42 9.5K
colorsep.h 2025-06-29 20:42 17K
colorsep.zip 2025-06-29 21:27 93K
colorsep.tar 2025-06-29 21:28 330K
colorsep.g.html 2025-06-29 22:00 6.2K
README.txt 2025-07-04 09:37 5.0K
https://gtoal.com/OpenSCAD/colorsep/
This is a *WORK IN PROGRESS* snapshot of a utility I'm currently developing,
which should eventually allow us to go straight from an OpenSCAD design, to a
.3mf file usable in Bambu Studio for printing objects in more than one colour.
Creating files that allow multicolour printing at the moment, using the current
OpenSCAD and Bambu Studio, does involve a bit of manual tweaking that this is
intended to eventually do away with and for now at least reduce.
It's working sufficiently now that I thought I might ask if anyone here (who
has to be able to compile C source code) is interested in alpha-testing it for
me. If you are, just copy the files from here (there's also a zip or a tar
archive containing the same files for easier downloading) and type 'make' after
unpacking them. The executable this creates is called 'colorsep' and it takes
one parameter: a .csg file - email me at gtoal@gtoal.com if (or rather when)
you find problems with the rewritten csg output - if it fails, I need to know
in what ways. (And if it works out of the box, I'ld appreciate hearing that
too!)
(Note there is quite a bit of code in this directory for building the parser,
which came from another project of mine, 'uparse' (a Unicode-friendly parser
generator) at https://github.com/gtoal/uparse - I included the minimum from
that project to build the converter (which needed a CSG parser). It's a bit of
a quick hack and when this project is working I'll try to repackage it in a way
that doesn't include all the extra code from the parser project... but you won't
have to look at any of the C code at all! (But if you do want to look at the
actual code, it's colorsep-filter.c that does the relevant work.) Anyway, as I
said above, everything should just build after you unpack it and type 'make'.)
I just now (30 June 2026, at 9pm) printed my first test using this method, and
I'm pleased to report that it printed correctly and there were no problems in
the workflow. Here's what you'll need to do to try it out yourself, once you've
compiled the colorsep binary...
* Write a .scad script to generate your bi-coloured piece. The colours can be
freely mixed within the object - unlike the current method, you don't have to
create separate top-level objects in each colour.
* Process your .scad file using the 'nightly' version of openscad. This is
important otherwise you can't export the multicoloured object correctly.
* export the result from OpenSCAD as a .csg file. If you use the command-line
interface, the command may look something like:
openscad -o file.csg file.scad
* run my utility on the .csg file to restructure the .csg file, e.g:
./colorsep file.csg > file-updated.csg
* load the updated .csg file back into openscad and export immediately as a .3mf
file - be sure to select the “Use colors from model and color scheme” option on
the export screen in the 'Colors' section, and also check that “Export color
as” is set to “Color” in the 'Format' section.
The command-line version of that may be something like:
openscad -o file.csg file.scad
Although I haven't yet looked into how to set those export parameters from the
command line - I've been doing this step manually with the GUI for the moment.
I expect that once I've worked out how to do that, it'll be more convenient to
merge the last 3 steps into a single command-line script. Eventually I'ld like
to script the entire process but that's still some time off.
* load the .3mf file into Bambu Studio. It'll be seen as a non-Bambu format file
but that's not a problem, just accept it.
* in the 'Prepare' stage, without first selecting any objects, set the 'Process'
'Global/Objects' choice to 'Objects' and assign the filaments on the plate to
the appropriate type & colour with a right-click/'Change filament'.
The manual stage above is pretty much the same as you would have done if you
created a .scad file with separate top-level objects; the advantage of this
method is that you did not have to manually separate the colours, or mess about
with Bambu Studio dropping the different components on to the plate, with you
having to manually reposition them so that the coloured pieces are all aligned
correctly with each other.
You may get a warning from Bambu Studio that there are unsupported components,
when you run the slicer, but that warning should be ignored as the parts are in
fact already in the correct position for printing.
* At this stage, if you want to, you can re-export the .3mf file from Bambu
Studio if you plan to upload the file to Makerworld or give it to other people
to print. It should now load with your colours in place and filaments assigned,
and should no longer issue the initial warning about not having been created by
Bambu Studio.
* Send the sliced design to the printer!
Feedback - good and bad equally welcomed - to gtoal@gtoal.com. I'm
thick-skinned so don't feel you have to choose your words carefully! Thanks.
Graham