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.
|
||||
render () {
|
||||
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
|
||||
custom=Metadata/Prusa_Slicer_custom_gcode_per_print_z.xml
|
||||
(
|
||||
echo '<?xml version="1.0" encoding="utf-8"?>'
|
||||
echo '<custom_gcodes_per_print_z>'
|
||||
sed -n 's/ECHO: "CUSTOM##\(.*\)"/\1/p' $basename.log
|
||||
echo '<mode value="SingleExtruder"/>'
|
||||
echo '</custom_gcodes_per_print_z>'
|
||||
) > $custom
|
||||
cat $logfile | while IFS=# read _ _ custom type path text _; do
|
||||
[ "$custom#$type" = "CUSTOM#3mf" ] || continue
|
||||
echo $text >> $path
|
||||
done
|
||||
|
||||
run zip $basename $custom
|
||||
|
||||
rm $custom $basename.log
|
||||
rm $custom $logfile
|
||||
rmdir Metadata
|
||||
}
|
||||
|
||||
|
|
|
@ -84,17 +84,28 @@ module EngraveText(text) {
|
|||
text(text, size=3.2, valign="center", font=Font);
|
||||
}
|
||||
|
||||
module Custom(text) {
|
||||
echo(str("CUSTOM##", text));
|
||||
// Ouptut special code to add to 3mf file
|
||||
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() {
|
||||
cube([25, 5, PlateHeight]); // Floor plate
|
||||
for (tier = [0 : 1 : Tiers-1]) {
|
||||
z = PlateHeight + (5 * tier);
|
||||
temp = TempBase + (TempIncrease * tier);
|
||||
Custom(str(
|
||||
ZCodeWrite(str(
|
||||
"<code print_z=\"", z, "\"",
|
||||
" type=\"4\"",
|
||||
" extruder=\"1\"",
|
||||
|
@ -115,4 +126,10 @@ difference() {
|
|||
rotate([90, -90, -90])
|
||||
EngraveText(SideText);
|
||||
}
|
||||
}
|
||||
ZCodeWrite("<mode value=\"SingleExtruder\"/>");
|
||||
ZCodeWrite("</custom_gcodes_per_print_z>");
|
||||
}
|
||||
|
||||
main();
|
||||
|
||||
|
|
Loading…
Reference in New Issue