More general file creation
This commit is contained in:
parent
2d9aff43c1
commit
78ae418a35
19
build.sh
19
build.sh
|
@ -17,20 +17,19 @@ run () {
|
||||||
# It does this by kludging together a PrusaSlicer-specific Metadata file.
|
# It does this by kludging together a PrusaSlicer-specific Metadata file.
|
||||||
render () {
|
render () {
|
||||||
basename=$1; shift
|
basename=$1; shift
|
||||||
run openscad -o $basename "$@" temp-tower.scad 2>&1 | tee $basename.log
|
logfile=$basename.log
|
||||||
|
run openscad -o $basename "$@" temp-tower.scad 2>&1 | tee $logfile
|
||||||
|
|
||||||
|
rm -rf Metadata
|
||||||
mkdir -p Metadata
|
mkdir -p Metadata
|
||||||
custom=Metadata/Prusa_Slicer_custom_gcode_per_print_z.xml
|
cat $logfile | while IFS=# read _ _ custom type path text _; do
|
||||||
(
|
[ "$custom#$type" = "CUSTOM#3mf" ] || continue
|
||||||
echo '<?xml version="1.0" encoding="utf-8"?>'
|
echo $text >> $path
|
||||||
echo '<custom_gcodes_per_print_z>'
|
done
|
||||||
sed -n 's/ECHO: "CUSTOM##\(.*\)"/\1/p' $basename.log
|
|
||||||
echo '<mode value="SingleExtruder"/>'
|
|
||||||
echo '</custom_gcodes_per_print_z>'
|
|
||||||
) > $custom
|
|
||||||
run zip $basename $custom
|
run zip $basename $custom
|
||||||
|
|
||||||
rm $custom $basename.log
|
rm $custom $logfile
|
||||||
rmdir Metadata
|
rmdir Metadata
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,17 +84,28 @@ module EngraveText(text) {
|
||||||
text(text, size=3.2, valign="center", font=Font);
|
text(text, size=3.2, valign="center", font=Font);
|
||||||
}
|
}
|
||||||
|
|
||||||
module Custom(text) {
|
// Ouptut special code to add to 3mf file
|
||||||
echo(str("CUSTOM##", text));
|
module ZCodeWrite(text) {
|
||||||
|
echo(str(
|
||||||
|
"#",
|
||||||
|
"#CUSTOM",
|
||||||
|
"#3mf",
|
||||||
|
"#Metadata/Prusa_Slicer_custom_gcode_per_print_z.xml",
|
||||||
|
"#", text,
|
||||||
|
"##"
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
difference() {
|
module main() {
|
||||||
|
ZCodeWrite("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
|
||||||
|
ZCodeWrite("<custom_gcodes_per_print_z>");
|
||||||
|
difference() {
|
||||||
union() {
|
union() {
|
||||||
cube([25, 5, PlateHeight]); // Floor plate
|
cube([25, 5, PlateHeight]); // Floor plate
|
||||||
for (tier = [0 : 1 : Tiers-1]) {
|
for (tier = [0 : 1 : Tiers-1]) {
|
||||||
z = PlateHeight + (5 * tier);
|
z = PlateHeight + (5 * tier);
|
||||||
temp = TempBase + (TempIncrease * tier);
|
temp = TempBase + (TempIncrease * tier);
|
||||||
Custom(str(
|
ZCodeWrite(str(
|
||||||
"<code print_z=\"", z, "\"",
|
"<code print_z=\"", z, "\"",
|
||||||
" type=\"4\"",
|
" type=\"4\"",
|
||||||
" extruder=\"1\"",
|
" extruder=\"1\"",
|
||||||
|
@ -115,4 +126,10 @@ difference() {
|
||||||
rotate([90, -90, -90])
|
rotate([90, -90, -90])
|
||||||
EngraveText(SideText);
|
EngraveText(SideText);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
ZCodeWrite("<mode value=\"SingleExtruder\"/>");
|
||||||
|
ZCodeWrite("</custom_gcodes_per_print_z>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
main();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue