Created
April 12, 2011 21:44
-
-
Save garyhodgson/916493 to your computer and use it in GitHub Desktop.
A small script that extracts skeinforge settings from a profile folder and prints out a html report
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env groovy | |
import groovy.xml.MarkupBuilder | |
// 1st param is profile directory, or use default given below | |
def settingsPath = (this.args.length > 0)? this.args[0] : "C:\\Users\\Gary Hodgson\\Desktop\\skeinforge settings\\profiles\\extrusion\\Mendeln05l04PLA" | |
list= [] | |
new File(settingsPath).eachFileRecurse{ list<< it } | |
settingsMap = [:] | |
list.each | |
{ f1 -> | |
valMap = [:] | |
f1.eachLine{ line, lineNo -> | |
if (lineNo >= 5) | |
{ | |
pair = line.split('\t') | |
if (pair.length == 2) | |
{ | |
valMap[pair[0]] = pair[1] | |
} | |
} | |
} | |
settingsMap[f1.name] = valMap | |
} | |
def now = new Date() | |
def writer = new StringWriter() | |
def build = new MarkupBuilder(writer) | |
build.html { | |
head { | |
title("Skeinforge Settings: " + now) | |
style(type:"text/css", ''' | |
table, td { | |
border: 1px solid Black; | |
border-collapse: collapse; | |
} | |
th { | |
background-color: lightgrey; | |
} | |
''') | |
} | |
body | |
{ | |
div(id:"skeingforge_settings") | |
{ | |
h1("Skeinforge Settings: " + now) | |
hr() | |
div(id:"important_settings") | |
{ | |
table(cellpadding:2,cellspacing:0) | |
{ | |
tr | |
{ | |
td("Layer Thickness (mm): ") | |
td(settingsMap['carve.csv']."Layer Thickness (mm):") | |
} | |
tr | |
{ | |
td("Perimeter Width over Thickness (ratio): ") | |
td(settingsMap['carve.csv']."Perimeter Width over Thickness (ratio):") | |
} | |
tr | |
{ | |
td("Infill Solidity (ratio): ") | |
td(settingsMap['fill.csv']."Infill Solidity (ratio):") | |
} | |
tr | |
{ | |
td("Feed Rate (mm/s): ") | |
td(settingsMap['speed.csv']."Feed Rate (mm/s):") | |
} | |
tr | |
{ | |
td("Flow Rate Setting (float): ") | |
td(settingsMap['speed.csv']."Flow Rate Setting (float):") | |
} | |
tr | |
{ | |
td("Object Next Layers Temperature (Celcius): ") | |
td(settingsMap['temperature.csv']."Object Next Layers Temperature (Celcius):") | |
} | |
} | |
} | |
a(href:"javascript://",onclick:"document.getElementById('more_settings').style.display = 'block'", "Show All Settings") | |
hr() | |
div(id:"more_settings",style:"display:none") | |
{ | |
settingsMap.each | |
{ settingFileName, values -> | |
def settingName = settingFileName.minus(".csv") | |
a(href:"#$settingName", settingName) | |
} | |
table(cellpadding:2,cellspacing:0) | |
{ | |
settingsMap.each | |
{ settingFileName, values -> | |
def settingName = settingFileName.minus(".csv") | |
tr | |
{ | |
th("colspan":"2") | |
{ | |
a(name:settingName, settingName) | |
} | |
} | |
values.each { name, value -> | |
tr | |
{ | |
td(name) | |
td(value) | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
println writer.toString() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment