Changing filament assignments for a Multimaterial painting
Suppose I have a 3mf file in which a model has already been "painted" with the multimaterial painting option.
I have similar colors loaded up to the MMU3, but they are in a different order than in the original painting.
Can I change the extruder order for the painting in software, without redoing the painting? Or do I need to physically change the filament setup at the
MMU3?
Thanks!
Wes
RE: Changing filament assignments for a Multimaterial painting
I am hunting for the answer to the same question. Guess you have not received one yet.
RE: Changing filament assignments for a Multimaterial painting
I believe with painting, you need to move the filaments to match the paint scheme
Joan
I try to make safe suggestions,You should understand the context and ensure you are happy that they are safe before attempting to apply my suggestions, what you do, is YOUR responsibility.Location Halifax UK
RE: Changing filament assignments for a Multimaterial painting
Any update on this. It seems the multi painting tool should have a swap spool option where I can say select spool 1 and say "swap to spool x" and it would make global update so you don't need to go repaint every block. or swap spools around, as both are time consuming for some models.
RE: Changing filament assignments for a Multimaterial painting
Looking for an update to this info as well. Not being able to switch which extruder is assigned to the Multilateral Paint is not acceptable. I have an XL and one of the extruders is down, waiting for replacement parts from Prusa. This feature should have been an expected one when it was implemented.
RE: Changing filament assignments for a Multimaterial painting
Posting to keep this alive, as I agree that this should be an expected feature need for multi-color/material printing.
RE: Changing filament assignments for a Multimaterial painting
On My Mk3.9 with MMU3,
you can load a print file,
then you select print
then you get the filament allocation table where you can change the filament type
IF you rotate the LCD selector Backwards you get the option to either re allocate the filaments or use spool join.
I have only re allocated one filament in a session so far, but It's worth trying to re allocate more filaments
as I no longer have an MMU3 on my Mk3S I can't try this feature there...
I Suspect it would be restricted to 32bit controllers, only. Mk4, Mk3.9, Mk3.5.
regards Joan
I try to make safe suggestions,You should understand the context and ensure you are happy that they are safe before attempting to apply my suggestions, what you do, is YOUR responsibility.Location Halifax UK
RE: Changing filament assignments for a Multimaterial painting
I have found a way to do this. It's a bit involved, and I'm not sure if it will work with all files, but it worked for me. I used 7-Zip to access the files and Sublime Text to edit the files in some of the steps, but there may be other programs that work as well.
1. Load the project file into PrusaSlicer. I am using version 2.9.2
2. Change the object's extruder to extruder 2. The whole thing will be the same color, but we'll fix it later.
3. Save the project file as a new file.
4. Open the new 3mf file that you have created in 7-Zip, go into the 3D folder, and export the 3dmodel.model file into a folder on your computer.
5. Open this file in Sublime Text. I use Sublime because it has advanced search and replace features, but they are not needed here. Even notepad would work.
6. Search (ctrl+f) for 'slic3rpe:mmu_segmentation="8" '. Also search for 'slic3rpe:mmu_segmentation="4" '. This is the field that tells the program which extruder color it was painted with. If both are found, move onto the next step. If 'slic3rpe:mmu_segmentation="8" ' is the only one found, skip the next step. If 'slic3rpe:mmu_segmentation="4" ' is the only one found, skip the next next and swap the 4 and 8 in the next steps. If neither are found, search for mmu, and use the string you found in the next steps.
7. Replace (ctrl+h) all 'slic3rpe:mmu_segmentation="4" ' with an empty string. This changes all triangles that were painted with extruder 1 to use the one we set the object to in step 2.
8. Replace (ctrl+h) all 'slic3rpe:mmu_segmentation="8" ' with 'slic3rpe:mmu_segmentation="4" '. This changes all triangles that were set to use extruder 2 to use extruder 1. If anyone has any ideas to why it is 4 and 8 instead of 1 and 2, let me know. My best guess is it's using the 4 and 8 bits, but the why not the 1 and 2 bits?
9. Save the file
10. Copy the file back into the 3mf file where you got it from, overwriting the one that is in there.
11. Import the project into PrusaSlicer, it should be reversed!
RE: Changing filament assignments for a Multimaterial painting
The above post was very helpful to me. To take it a bit further. I found the following to be true on my MMU. The sequence of the extruders is: 4,8,0C,1C,2C
In case you need to go past the first couple.
RE: Changing filament assignments for a Multimaterial painting
How is this not a feature in PrusaSlicer?
RE: Changing filament assignments for a Multimaterial painting
Feature has already been requested here https://github.com/prusa3d/PrusaSlicer/issues/14903. Please add some comments to get visibility.
RE: Changing filament assignments for a Multimaterial painting
Fixed link to the Github issue:
https://github.com/prusa3d/PrusaSlicer/issues/14903
Can't believe this isn't a feature already.
RE:
So.... I started to write an old school shell script to do this. Currently it can "PERMUTE" the extruders but only for 'simple' colorings. What this means is that it can change the colors of the base objects as well as any triangles that have a SINGLE color. It can't handle more complex colorings. Basically if your painting split triangles it can't parse that. It doesn't introduce any errors it just does not reassign the colors in those situations.
The key to most of this is that inside the 3mf (its really a zip) file there is a file: 3D/3dmodel.model this file has lines that look like this:
The color information for that triangle is the 1C. basically that information is a sequence of 4bit values, each one represented by a hex digit. For simple situations where the entire triangle is one color you either have one or two 4 bit sequences. They can be:
4 - 0100 -> extruder 1
8 - 1000 -> extruder 2
0C - 0001 1100 -> extruder 3
1C - 0010 1100 -> extruder 4
2C - 0011 1100 -> extruder 5
I believe it continues through 3C etc.... Not sure how far.
So these are simple to change. My issue is that if the coloring 'split' the triangle you get a complex pile of bytes, which I have no idea how to parse.
so I can't currently handle these lines.
IN addition the default color of the object is specified in a different file: Metadata/Slic3r_PE_model.config
In this file the lines of interest are of the form:
where the values are: 1,2,3,4,5 🙂 as we would expect, and thus are much easier to change.
My shell is attached below, the instructions for the permutations to perform are the input to the awk program. I inserted the word STOP which stops it from proceeding through the entire list. In this list you specify the replacements for your current extruders.
#########<triangle v1="8992" v2="7051" v3="8994" slic3rpe:mmu_segmentation="3C"/>
#########<triangle v1="6072" v2="3874" v3="3871" slic3rpe:mmu_segmentation="4"/>
######## <triangle v1="7378" v2="8478" v3="7338" slic3rpe:mmu_segmentation="8"/>
####### <triangle v1="7233" v2="8631" v3="7187" slic3rpe:mmu_segmentation="1C"/>
###### <triangle v1="7636" v2="7593" v3="7638" slic3rpe:mmu_segmentation="0C"/>
function translate_extruder {
# I have not checked if this works for extruders beyond 6
typeset rtn=""
case "${1}" in
1) echo 4 ; break ;;
2) echo 8 ; break ;;
*) (( rtn = ${1} - 3 )) ; echo "${rtn}C" ; break ;;
esac
}
in_dir="/Users/kurt/Dropbox/Family Room/prusa/toys/crayon-container-model_files"
input3mf="crayon-hard-case-exp.3mf"
#in_dir="/Users/kurt/Dropbox/Family Room/prusa/shapes"
#input3mf="exp.3mf"
workdir="/tmp/permute$$"
mkdir "$workdir" || { echo ERROR cant create $workdir ; exit 1 ; }
amodel=3D/3dmodel.model
model="${workdir}/UNZIPED/${amodel}"
aconfig=Metadata/Slic3r_PE_model.config
config="${workdir}/UNZIPED/${aconfig}"
unzip "${in_dir}/${input3mf}" "${amodel}" -d "${workdir}/UNZIPED" || { echo ERROR cant UNZIP $input3mf for "${amodel}" ; exit 2 ; }
unzip "${in_dir}/${input3mf}" "${aconfig}" -d "${workdir}/UNZIPED" || { echo ERROR cant UNZIP $input3mf for "#{aconfig}" ; exit 3 ; }
permutes="$workdir/permutes"
## https://www.dcode.fr/permutations-generator
awk 'BEGIN { FS="," ; OFS="," }
/STOP/ { exit }
{
for (i = 1 ; i<= NF ; i++ ) $i = i ":" $i
print
}' >"${permutes}" <<!EOF!
2,3,4,5,1
STOP
4,1,2,3
2,1,3,4
3,1,2,4
1,3,2,4
2,3,1,4
3,2,1,4
3,2,4,1
2,3,4,1
4,3,2,1
3,4,2,1
2,4,3,1
4,2,3,1
4,1,3,2
1,4,3,2
3,4,1,2
4,3,1,2
1,3,4,2
3,1,4,2
2,1,4,3
1,2,4,3
4,2,1,3
2,4,1,3
1,4,2,3
!EOF!
sedtemplate="$workdir/sedtemplate"
sedfixed="$workdir/sedfixed"
cat >"${sedtemplate}" <<!EOF!
/^[^]/s;^([[:blank:]]*<triangle[[:blank:]]+v1="[[:digit:]]+"[[:blank:]]+v2="[[:digit:]]+"[[:blank:]]+v3="[[:digit:]]+"[[:blank:]]+slic3rpe:mmu_segmentation=")_FROM_("/>)$;\1_TO_\2;
!EOF!
cat >"${sedfixed}" <<!EOF!
s;<metadata name="Designer"></metadata>;<metadata name="Designer">PERMUTEDIRECTORY_NUM_</metadata>;
#
//s///
!EOF!
# <metadata type="object" key="extruder" value="5"/>
cat >"${sedtemplate}config" <<!EOF!
/^[^]/s;^([[:blank:]]*<metadata[[:blank:]]+type="object"[[:blank:]]+key="extruder"[[:blank:]]+value=")_FROM_("/>)$;\1_TO_\2;
!EOF!
cat >"${sedfixed}config" <<!EOF!
#
//s///
!EOF!
nl ${permutes} | sed 's/^/permutes: /'
nl ${sedtemplate} | sed 's/^/sedtemplate: /'
nl ${sedfixed} | sed 's/^/sedfixed: /'
nl ${sedtemplate}config | sed 's/^/sedtemplateconfig: /'
nl ${sedfixed}config | sed 's/^/sedfixedconfig: /'
echo in_dir=$in_dir input3mf=$input3mf
while read apermute
do
cleanpermute=$(echo "${apermute}" |sed -e 's/[:,]//g' )
OUTZIP="${workdir}/OUTZIPED.${cleanpermute}"
sedspermute="${workdir}/seds.${cleanpermute}"
newmodel="${OUTZIP}/${amodel}"
newconfig="${OUTZIP}/${aconfig}"
echo START apermute=$apermute cleanpermute=$cleanpermute sedspermute=$sedspermute newmodel=$newmodel newconfig=$newconfig
# Prepair result model file
mkdir -p $(dirname "${newmodel}")
touch "${newmodel}"
test -f "${newmodel}" || { echo ERROR cant file newmodel=$newmodel ; exit 5 ; }
mkdir - $(dirname "${newconfig}")
touch "${newconfig}"
test -f "${newconfig}" || { echo ERROR cant file newconfig=$newconfig ; exit 6 ; }
echo "${apermute}" |sed -e 's/:/ /g' -e 's/,/\
/g' |while read FROM TO
do
TFROM=$( translate_extruder $FROM )
TTO=$( translate_extruder $TO )
echo "# FROM=${FROM} TFROM=${TFROM} TO=${TO} TTO=${TTO}"
echo "#"
sed -e "s/_FROM_/${TFROM}/g" -e "s/_TO_/${TTO}/g" "${sedtemplate}"
echo "#"
done |tee "${sedspermute}" |cat -v |nl
sed "s/_NUM_/${cleanpermute}/" "${sedfixed}" >>"${sedspermute}"
sed -Ef "${sedspermute}" "${model}" > "${newmodel}" || { echo ERROR sed failed ${sedspermute} on ${model} ; exit 10 ; }
wc "${model}" "${newmodel}"
sdiff -s -w256 "${model}" "${newmodel}" |cat -v |sed "s/^/${cleanpermute}: /" > ${newmodel}.sdiff
echo "${apermute}" |sed -e 's/:/ /g' -e 's/,/\
/g' |while read FROM TO
do
echo "# FROM=${FROM} TO=${TO}"
echo "#"
sed -e "s/_FROM_/${FROM}/g" -e "s/_TO_/${TO}/g" "${sedtemplate}config"
echo "#"
done |tee "${sedspermute}config" |cat -v |nl
sed "s/_NUM_/${cleanpermute}/" "${sedfixed}config" >>"${sedspermute}config"
ls -l "${config}" "${sedspermute}config"
sed -Ef "${sedspermute}config" "${config}" > "${newconfig}" || { echo ERROR sed failed ${sedspermute}config on ${config} ; exit 11 ; }
wc "${config}" "${newconfig}"
sdiff -s -w256 "${config}" "${newconfig}" |cat -v |sed "s/^/${cleanpermute}: /" > ${newconfig}.sdiff
output3mf="${input3mf%.3mf}.${cleanpermute}.3mf"
outputzip="${input3mf%.3mf}.${cleanpermute}.zip"
cp "${in_dir}/${input3mf}" "${workdir}/${output3mf}" || { echo ERROR cant copy ${input3mf} TO ${output3mf} ; exit 12 ; }
mv "${workdir}/${output3mf}" "${workdir}/${outputzip}"
(
cd "${OUTZIP}"
zip -v "../${outputzip}" "${amodel}" "${aconfig}" || { echo ERROR cant zip $amodel AND $aconfig into $outputzip ; exit 20 ; }
#zip -v "../${outputzip}" "${amodel}" || { echo ERROR cant zip $amodel into $outputzip ; exit 21 ; }
#zip -v "../${outputzip}" "${aconfig}" || { echo ERROR cant zip $aconfig into $outputzip ; exit 22 ; }
)
mv "${workdir}/${outputzip}" "${workdir}/${output3mf}"
echo END apermute=$apermute cleanpermute=$cleanpermute sedspermute=$sedspermute newmodel=$newmodel
done < "${permutes}"
RE: Changing filament assignments for a Multimaterial painting
Oh, the INPUT 3mf file is specified INSIDE the shell, its not an argument, sorry its a prototype and you will find the output in a subdirectory of your /tmp directory
RE: Changing filament assignments for a Multimaterial painting
just a little note on my end. I sent this thread over to the slicer dev's along with the github ticket submitted.
Shane (AKA FromPrusa)
RE: Changing filament assignments for a Multimaterial painting
My problem is I have dug through the slicer source code, and I can't really find a good way of understanding the serialization of the triangles when coloring has split the triangles.
I can handle triangles where the entire triangle is ONE color, but if the triangle has been partially colored or colored with multiple colors, I dont understand how to interpret the mmu_segmentation. I have been trying to understand the code in: PrusaSlicer/src/libslic3r/TriangleSelector.cpp around line 1872, as well as PrusaSlicer/src/libslic3r/Model.cpp but so far the meaning of long strings as below and how to parse them is beyond me. Any assistance, reference to documentation etc might be helpful so I would know which. bytes one would alter
<triangle v1="1647" v2="1599" v3="0" slic3rpe:mmu_segmentation="00040020064404006044A6400200A20020400004A60604006044A244AA3003030000404006044A2446404006044A60A60030030341C41C44244641C44641C1CAA61C44244244A64434444441CAA21C1C6441C1C1C1C1C1C4AA61C21C44A31C41C41C1C61C44A641C1C21C1CA61C41C1C61C44A244A2444341C44244641C1C461CA21C1CA41C441C64641C1C21C1CA21C1CA41C41C44641C1CA61C44244A2330044244241C41C1C61C44A244641C1C1C1C4A61CA241C44441CA64641C44641C1CA21C1CAA1C44244631C41C1C21C1C21C1C61C41C1C21C1C61C1C41C1AA24443441C41C44641C1CA21C1C61C41C44641C1CA61C44244AA643441C21C1C21C1C21C1C6441C4461C21C1C21C1C21C41C1C21C1C61C41C1C61C44AAA33444444041AAA404424424464044244644090AAA1C41C1C21C1C61C41C1C61C44AA2446044244244244234044244640446440200AAA404006044A2446400044A60AA1C41C44641C1CA61C44244A244604006044A2442442344441CA21C1C21C1C6441C1C1C1C4A61C21C1C21C41C1C61C44AA3044244244241C41C4461C61C44244A641C1C21C1CA241C41C1C21C1C61C441C64A641C1C21C1C21C1CAA1C41C1C61C44A244633300004006044A2442442044244244A4044244640446440200AA63044244244244A40444444041AA230404424424464044244644090AA60033440400200200604402006044AA64344044440A2006044A6430440446400A2002002400200200A0400200604044606044244AA6330044002002002002000000401AAA300333"/>
RE: Changing filament assignments for a Multimaterial painting
Oh I updated all that I have written and collected it here: https://www.printables.com/article/3mf-file-color-specification-what-i-have-found-v1-YNYjaE5







