probonopd
12/29/2016 - 12:08 PM

RF100.def.json

{
    "id": "RF100",
    "name": "RF100",
    "version": 2,
    "inherits": "fdmprinter",
    "metadata": {
        "visible": true,
        "author": "Rudimentary attempt at porting RF100.ini using https://github.com/Ultimaker/Cura/blob/master/plugins/LegacyProfileReader/DictionaryOfDoom.json",
        "manufacturer": "Renkforce",
        "category": "Other",
        "file_formats": "text/x-gcode",
        "platform_offset": [ 0, 0, 0]
    },

    "overrides": {
        "speed_topbottom": { "default_value": 30 },
        "speed_print": { "default_value": 50 },
        "machine_extruder_count": { "default_value": 1 },
        "machine_name": { "default_value": "RF100" },
        "machine_heated_bed": { "default_value": false },
        "machine_nozzle_size": { "default_value": 0.4 },
        "speed_layer_0": { "default_value": 20 },
        "machine_width": { "default_value": 100 },
        "machine_gcode_flavor": { "default_value": "RepRap (Marlin/Sprinter)" },
        "machine_depth": { "default_value": 100 },
        "speed_infill": { "default_value": 50 },
        "material_diameter": { "default_value": 1.75 },
        "machine_center_is_zero": { "default_value": false },
        "machine_height": { "default_value": 100 },
        "layer_height": { "default_value": 0.10 },
        "material_print_temperature": { "default_value": 210 },
        "retraction_amount": { "default_value": 2 },
        "speed_wall_0": { "default_value": 25 },
        "speed_travel": { "default_value": 50 },
        "infill_sparse_density": { "default_value": 15 },
        "machine_start_gcode": {
            "default": "G21 ;metric values\nG90 ;absolute positioning\nM82 ;set extruder to absolute mode\nM107  ;start with the fan off\nG28 X0 Y0  ;move X/Y to min endstops\nG28 Z0 ;move Z to min endstops\nG1 Z15.0 F{travel_speed} ;move the platform down 15mm\nG92 E0 ;zero the extruded length\nG1 F200 E3 ;extrude 3mm of feed stock\nG92 E0  ;zero the extruded length again\nG1 F{travel_speed}\n;Put printing message on LCD screen\nM117 Printing..."
        },
        "machine_end_gcode": {
            "default": "M104 S0 ;extruder heater off\nM140 S0 ;heated bed heater off (if you have it)\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\nG1 Z+0.5 E-5 X-20 Y-20 F{travel_speed} ;move Z up a bit and retract filament even more\nG28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way\nM84 ;steppers off\nG90 ;absolute positioning"
        }
    },
    "categories": {
        "material": {
            "settings": {
                "material_bed_temperature": {
                    "visible": false
                }
            }
        }
    }
}
[machine]
machine_name = RF100-PLA
machine_type = RepRap
machine_width = 100
machine_depth = 100
machine_height = 100
machine_center_is_zero = False
has_heated_bed = False
gcode_flavor = RepRap (Marlin/Sprinter)
extruder_amount = 1

[profile]
layer_height = 0.1
wall_thickness = 0.8
retraction_enable = True
solid_layer_thickness = 0.5
fill_density = 15
print_speed = 50
print_temperature = 210
print_temperature2 = 0
print_temperature3 = 0
print_temperature4 = 0
print_temperature5 = 0
print_bed_temperature = 70
support = None
platform_adhesion = Raft
support_dual_extrusion = Both
wipe_tower = False
wipe_tower_volume = 15
ooze_shield = False
filament_diameter = 1.75
filament_diameter2 = 0
filament_diameter3 = 0
filament_diameter4 = 0
filament_diameter5 = 0
filament_flow = 100.0
nozzle_size = 0.4
retraction_speed = 40.0
retraction_amount = 2
retraction_dual_amount = 16.5
retraction_min_travel = 1.5
retraction_combing = All
retraction_minimal_extrusion = 0.02
retraction_hop = 0.0
bottom_thickness = 0.3
layer0_width_factor = 100
object_sink = 0.0
overlap_dual = 0.15
travel_speed = 50.0
bottom_layer_speed = 30
infill_speed = 50
solidarea_speed = 30
inset0_speed = 25
insetx_speed = 35
cool_min_layer_time = 5
fan_enabled = True
skirt_line_count = 1
skirt_gap = 3.0
skirt_minimal_length = 150.0
fan_full_height = 0.5
fan_speed = 100
fan_speed_max = 100
cool_min_feedrate = 10
cool_head_lift = False
solid_top = True
solid_bottom = True
fill_overlap = 15
perimeter_before_infill = False
support_type = Lines
support_angle = 60
support_fill_rate = 15
support_xy_distance = 0.5
support_z_distance = 0.1
spiralize = False
simple_mode = False
brim_line_count = 20
raft_margin = 5.0
raft_line_spacing = 3.0
raft_base_thickness = 0.3
raft_base_linewidth = 1.0
raft_interface_thickness = 0.27
raft_interface_linewidth = 0.4
raft_airgap_all = 0.0
raft_airgap = 0.22
raft_surface_layers = 2
raft_surface_thickness = 0.27
raft_surface_linewidth = 0.4
fix_horrible_union_all_type_a = True
fix_horrible_union_all_type_b = False
fix_horrible_use_open_bits = False
fix_horrible_extensive_stitching = False
plugin_config = 
object_center_x = -1
object_center_y = -1

[alterations]
start.gcode = ;Sliced at: {day} {date} {time}
	;Basic settings: Layer height: {layer_height} Walls: {wall_thickness} Fill: {fill_density}
	;Print time: {print_time}
	;Filament used: {filament_amount}m {filament_weight}g
	;Filament cost: {filament_cost}
	;M190 S{print_bed_temperature} ;Uncomment to add your own bed temperature line
	;M109 S{print_temperature} ;Uncomment to add your own temperature line
	G21        ;metric values
	G90        ;absolute positioning
	M82        ;set extruder to absolute mode
	M107       ;start with the fan off
	G28 X0 Y0  ;move X/Y to min endstops
	G28 Z0     ;move Z to min endstops
	G1 Z15.0 F{travel_speed} ;move the platform down 15mm
	G92 E0                  ;zero the extruded length
	G1 F200 E3              ;extrude 3mm of feed stock
	G92 E0                  ;zero the extruded length again
	G1 F{travel_speed}
	;Put printing message on LCD screen
	M117 Printing...
end.gcode = ;End GCode
	M104 S0                     ;extruder heater off
	M140 S0                     ;heated bed heater off (if you have it)
	G91                                    ;relative positioning
	G1 E-1 F300                            ;retract the filament a bit before lifting the nozzle, to release some of the pressure
	G1 Z+0.5 E-5 X-20 Y-20 F{travel_speed} ;move Z up a bit and retract filament even more
	G28 X0 Y0                              ;move X/Y to min endstops, so the head is out of the way
	M84                         ;steppers off
	G90                         ;absolute positioning
	;{profile_string}
start2.gcode = ;Sliced at: {day} {date} {time}
	;Basic settings: Layer height: {layer_height} Walls: {wall_thickness} Fill: {fill_density}
	;Print time: {print_time}
	;Filament used: {filament_amount}m {filament_weight}g
	;Filament cost: {filament_cost}
	;M190 S{print_bed_temperature} ;Uncomment to add your own bed temperature line
	;M104 S{print_temperature} ;Uncomment to add your own temperature line
	;M109 T1 S{print_temperature2} ;Uncomment to add your own temperature line
	;M109 T0 S{print_temperature} ;Uncomment to add your own temperature line
	G21        ;metric values
	G90        ;absolute positioning
	M107       ;start with the fan off
	G28 X0 Y0  ;move X/Y to min endstops
	G28 Z0     ;move Z to min endstops
	G1 Z15.0 F{travel_speed} ;move the platform down 15mm
	T1                      ;Switch to the 2nd extruder
	G92 E0                  ;zero the extruded length
	G1 F200 E10             ;extrude 10mm of feed stock
	G92 E0                  ;zero the extruded length again
	G1 F200 E-{retraction_dual_amount}
	T0                      ;Switch to the first extruder
	G92 E0                  ;zero the extruded length
	G1 F200 E10             ;extrude 10mm of feed stock
	G92 E0                  ;zero the extruded length again
	G1 F{travel_speed}
	;Put printing message on LCD screen
	M117 Printing...
end2.gcode = ;End GCode
	M104 T0 S0                     ;extruder heater off
	M104 T1 S0                     ;extruder heater off
	M140 S0                     ;heated bed heater off (if you have it)
	G91                                    ;relative positioning
	G1 E-1 F300                            ;retract the filament a bit before lifting the nozzle, to release some of the pressure
	G1 Z+0.5 E-5 X-20 Y-20 F{travel_speed} ;move Z up a bit and retract filament even more
	G28 X0 Y0                              ;move X/Y to min endstops, so the head is out of the way
	M84                         ;steppers off
	G90                         ;absolute positioning
	;{profile_string}
start3.gcode = ;Sliced at: {day} {date} {time}
	;Basic settings: Layer height: {layer_height} Walls: {wall_thickness} Fill: {fill_density}
	;Print time: {print_time}
	;Filament used: {filament_amount}m {filament_weight}g
	;Filament cost: {filament_cost}
	;M190 S{print_bed_temperature} ;Uncomment to add your own bed temperature line
	;M104 S{print_temperature} ;Uncomment to add your own temperature line
	;M109 T1 S{print_temperature2} ;Uncomment to add your own temperature line
	;M109 T0 S{print_temperature} ;Uncomment to add your own temperature line
	G21        ;metric values
	G90        ;absolute positioning
	M107       ;start with the fan off
	G28 X0 Y0  ;move X/Y to min endstops
	G28 Z0     ;move Z to min endstops
	G1 Z15.0 F{travel_speed} ;move the platform down 15mm
	T2                      ;Switch to the 2nd extruder
	G92 E0                  ;zero the extruded length
	G1 F200 E10             ;extrude 10mm of feed stock
	G92 E0                  ;zero the extruded length again
	G1 F200 E-{retraction_dual_amount}
	T1                      ;Switch to the 2nd extruder
	G92 E0                  ;zero the extruded length
	G1 F200 E10             ;extrude 10mm of feed stock
	G92 E0                  ;zero the extruded length again
	G1 F200 E-{retraction_dual_amount}
	T0                      ;Switch to the first extruder
	G92 E0                  ;zero the extruded length
	G1 F200 E10             ;extrude 10mm of feed stock
	G92 E0                  ;zero the extruded length again
	G1 F{travel_speed}
	;Put printing message on LCD screen
	M117 Printing...
end3.gcode = ;End GCode
	M104 T0 S0                     ;extruder heater off
	M104 T1 S0                     ;extruder heater off
	M104 T2 S0                     ;extruder heater off
	M140 S0                     ;heated bed heater off (if you have it)
	G91                                    ;relative positioning
	G1 E-1 F300                            ;retract the filament a bit before lifting the nozzle, to release some of the pressure
	G1 Z+0.5 E-5 X-20 Y-20 F{travel_speed} ;move Z up a bit and retract filament even more
	G28 X0 Y0                              ;move X/Y to min endstops, so the head is out of the way
	M84                         ;steppers off
	G90                         ;absolute positioning
	;{profile_string}
start4.gcode = ;Sliced at: {day} {date} {time}
	;Basic settings: Layer height: {layer_height} Walls: {wall_thickness} Fill: {fill_density}
	;Print time: {print_time}
	;Filament used: {filament_amount}m {filament_weight}g
	;Filament cost: {filament_cost}
	;M190 S{print_bed_temperature} ;Uncomment to add your own bed temperature line
	;M104 S{print_temperature} ;Uncomment to add your own temperature line
	;M109 T2 S{print_temperature2} ;Uncomment to add your own temperature line
	;M109 T1 S{print_temperature2} ;Uncomment to add your own temperature line
	;M109 T0 S{print_temperature} ;Uncomment to add your own temperature line
	G21        ;metric values
	G90        ;absolute positioning
	M107       ;start with the fan off
	G28 X0 Y0  ;move X/Y to min endstops
	G28 Z0     ;move Z to min endstops
	G1 Z15.0 F{travel_speed} ;move the platform down 15mm
	T3                      ;Switch to the 4th extruder
	G92 E0                  ;zero the extruded length
	G1 F200 E10             ;extrude 10mm of feed stock
	G92 E0                  ;zero the extruded length again
	G1 F200 E-{retraction_dual_amount}
	T2                      ;Switch to the 3th extruder
	G92 E0                  ;zero the extruded length
	G1 F200 E10             ;extrude 10mm of feed stock
	G92 E0                  ;zero the extruded length again
	G1 F200 E-{retraction_dual_amount}
	T1                      ;Switch to the 2nd extruder
	G92 E0                  ;zero the extruded length
	G1 F200 E10             ;extrude 10mm of feed stock
	G92 E0                  ;zero the extruded length again
	G1 F200 E-{retraction_dual_amount}
	T0                      ;Switch to the first extruder
	G92 E0                  ;zero the extruded length
	G1 F200 E10             ;extrude 10mm of feed stock
	G92 E0                  ;zero the extruded length again
	G1 F{travel_speed}
	;Put printing message on LCD screen
	M117 Printing...
end4.gcode = ;End GCode
	M104 T0 S0                     ;extruder heater off
	M104 T1 S0                     ;extruder heater off
	M104 T2 S0                     ;extruder heater off
	M104 T3 S0                     ;extruder heater off
	M140 S0                     ;heated bed heater off (if you have it)
	G91                                    ;relative positioning
	G1 E-1 F300                            ;retract the filament a bit before lifting the nozzle, to release some of the pressure
	G1 Z+0.5 E-5 X-20 Y-20 F{travel_speed} ;move Z up a bit and retract filament even more
	G28 X0 Y0                              ;move X/Y to min endstops, so the head is out of the way
	M84                         ;steppers off
	G90                         ;absolute positioning
	;{profile_string}
support_start.gcode = 
support_end.gcode = 
cool_start.gcode = 
cool_end.gcode = 
replace.csv = 
preswitchextruder.gcode = ;Switch between the current extruder and the next extruder, when printing with multiple extruders.
	;This code is added before the T(n)
postswitchextruder.gcode = ;Switch between the current extruder and the next extruder, when printing with multiple extruders.
	;This code is added after the T(n)

Renkforce RF100

Mini review

Pros

  • Sturdy metal housing, doesn't look too fragile to transport in a car
  • Comes completely built
  • Reputable manufacturer with customer service in Germany and spare parts available
  • Has a safe appearance - power supply in metal housing, CE marks, etc.

Cons

  • GPL violation in the firmware. No source code mentioned or available despite it being a Marlin firmware. No reaction from Conrad over months
  • Toward the end of the included 250g filament, extruder only makes click-click noise and doesn't feed filament properly anymore. Nozzle does not seem clogged (can see trough)
  • Small print area. Glass plate does not even really use all of the available space
  • No cooler for the printed parts which leads to bad bridging results. There are printable fan ducts but this should be done properly out of the box
  • The printing bed was not manufactured properly, had to get replacement from manufacturer
  • Magnetic fixture of the printing bed has play, this can damage prints
  • Strange cover over the hotend
  • Hotend cooler runs at 100% all the time and is very loud

Room for improvement

  • Make connectors more easily accessible (e.g., serial connectors)
  • Document the mainboard and its connectors
  • Could include WLAN functionality
  • Could support Cura profiles by contributing to Cura upstream (I started doing that)
  • Can leave away the plastic to the left and right of the device - has no function and diminuishes the design

RF100.ini for Cura

Extracted from 001507428-up-01-en-SD_CARD_CONTENT_V1_1_RENKFORCE_RF100_3D_.zip (can be downloaded on the Conrad website)

Newer versions of Cura seem to require an entirely different .def.json format. I do not know yet how to convert these. A simple conversion from ini to json does not seem to match the required .def.json format. I have opened https://github.com/Ultimaker/Cura/issues/1316 for this.

https://github.com/Ultimaker/Cura/blob/master/plugins/LegacyProfileReader/DictionaryOfDoom.json seems to have a translation dictionary between the old and the new keys.

This is the response I got from Cura developers when I asked how to convert to the new format:

From a brief look at the profile you mentioned, I'd say you want to at least include the [machine] and [alterations] sections of the ini file in the definition. Then you need to figure out what to do with the [profile] section. Some of those can probably be set as new defaults in the definition, but some may simply have become irrelevant.

https://github.com/Ultimaker/Cura/issues/1316#issuecomment-271271814

Modifications

Leave a comment below if you have done any of those

  • Add cooling fan to the printhead to increase print precision with delicate parts. On Thingiverse, there is the Renkforce RF100 Fan Duct by by Oliver_D, published Dec 31, 2016. This is a super awesome part because it 1. blows the air from all sides due to its clever design and 2. re-uses the existing hotend fan to blow air over the model, so no extra fan or cabling is needed
  • Add heated bed (may not be suitable to print ABS anyway because the print head only does PLA temperatures)
  • Since the device seems to run some variant of the Marlin 3D Printer Firmware, can we flash our own Marlin versions? Can the original firmware be restored?

Teardown

Leave a comment below if you have a RF100 and can show photos of the inner workings (e.g., PCB).

Firmware

The device apparently runs Marlin 1.0.3 dev firmware out of the box as indicated by the logs below. This means that the firmware is under the GPL v3 and Conrad must 1. tell this their customers and 2. provide the source code upon request. I could not find anything about the GPL v3 in the online documentation for the printer.

m501

SENDING:M501
echo:Hardcoded Default Settings Loaded
echo:Steps per unit:
echo: M92 X78.82 Y78.82 Z200.00 E106.00
echo:Maximum feedrates (mm/s):
echo: M203 X300.00 Y300.00 Z5.00 E25.00
echo:Maximum Acceleration (mm/s2):
echo: M201 X500 Y500 Z100 E10000
echo:Accelerations: P=printing, R=retract and T=travel
echo: M204 P500.00 R3000.00 T3000.00
echo:Advanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum XY jerk (mm/s), Z=maximum Z jerk (mm/s), E=maximum E jerk (mm/s)
echo: M205 S0.00 T0.00 B20000 X20.00 Z0.40 E5.00
echo:Home offset (mm):
echo: M206 X0.00 Y0.00 Z0.00
echo:Material heatup parameters:
echo: M145 M0 H220 B70 F0
echo: M145 M1 H240 B110 F0
echo:PID settings:
echo: M301 P22.20 I1.08 D114.00 C1.00
echo:Filament settings: Disabled

m503

m503
SENDING:M503
echo:Steps per unit:
echo: M92 X78.82 Y78.82 Z200.00 E106.00
echo:Maximum feedrates (mm/s):
echo: M203 X300.00 Y300.00 Z5.00 E25.00
echo:Maximum Acceleration (mm/s2):
echo: M201 X500 Y500 Z100 E10000
echo:Accelerations: P=printing, R=retract and T=travel
echo: M204 P500.00 R3000.00 T3000.00
echo:Advanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum XY jerk (mm/s), Z=maximum Z jerk (mm/s), E=maximum E jerk (mm/s)
echo: M205 S0.00 T0.00 B20000 X20.00 Z0.40 E5.00
echo:Home offset (mm):
echo: M206 X0.00 Y0.00 Z0.00
echo:Material heatup parameters:
echo: M145 M0 H220 B70 F0
echo: M145 M1 H240 B110 F0
echo:PID settings:
echo: M301 P22.20 I1.08 D114.00 C1.00
echo:Filament settings: Disabled

Connect

Printer is now online.
echo:Marlin 1.0.3 dev
echo: Last Updated: Nov 8 2016 10:15:33 | Author: (none, default config)
Compiled: Nov 8 2016
echo: Free Memory: 4436 PlannerBufferBytes: 308
echo:Hardcoded Default Settings Loaded
echo:Steps per unit:
echo: M92 X78.82 Y78.82 Z200.00 E106.00
echo:Maximum feedrates (mm/s):
echo: M203 X300.00 Y300.00 Z5.00 E25.00
echo:Maximum Acceleration (mm/s2):
echo: M201 X500 Y500 Z100 E10000
echo:Accelerations: P=printing, R=retract and T=travel
echo: M204 P500.00 R3000.00 T3000.00
echo:Advanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum XY jerk (mm/s), Z=maximum Z jerk (mm/s), E=maximum E jerk (mm/s)
echo: M205 S0.00 T0.00 B20000 X20.00 Z0.40 E5.00
echo:Home offset (mm):
echo: M206 X0.00 Y0.00 Z0.00
echo:Material heatup parameters:
echo: M145 M0 H220 B70 F0
echo: M145 M1 H240 B110 F0
echo:PID settings:
echo: M301 P22.20 I1.08 D114.00 C1.00
echo:Filament settings: Disabled
echo:SD card ok

CAD applications

  • OpenSCAD for parametric models. When uploaded to Thingiverse, users can parametrize them online
  • Tinkercad for quick results. Nice ball joints. Very intuitive (does not need to draw sketches with degrees of freedom). But things that are super simple elsewhere (chamfered edges) don't seem to exist
  • FreeCAD probably very capable but complex/slow for beginners (need to draw sketches with degrees of freedom)
import os, sys, urllib, json, math
import configparser # sudo apt install python-configparser

also_include_default_values = False # Set to True if all values should be converted even if they are default

ini_url = "https://gist.githubusercontent.com/probonopd/0dc2afa55fc31caa5ce1f5eea0f3255b/raw/cb1296e900ff1b05abba5adeb35300d835af2097/RF100.ini"
ini_filename = os.path.basename(ini_url)

dict_url = "https://raw.githubusercontent.com/Ultimaker/Cura/master/plugins/LegacyProfileReader/DictionaryOfDoom.json"
dict_filename = os.path.basename(dict_url)

def get_file(url):
    if not os.path.isfile(os.path.basename(url)):
        urllib.urlretrieve (url, os.path.basename(url))

get_file(ini_url)
get_file(dict_url)

parser = configparser.ConfigParser(interpolation = None)
try:
    with open(ini_filename) as f:
        parser.readfp(f)  # Parse the INI file.
except Exception as e:
    print("Unable to open legacy profile %s: %s", file_name, str(e))

try:
    with open(dict_filename, "r") as f:
        dict_of_doom = json.load(f)  # Parse the Dictionary of Doom.
except IOError as e:
    print("Could not open DictionaryOfDoom.json for reading: %s", str(e))
except Exception as e:
    print("Could not parse DictionaryOfDoom.json: %s", str(e))

if "target_version" not in dict_of_doom:
    print("Dictionary of Doom has no target version. Is it the correct JSON file?")

if "translation" not in dict_of_doom:
    print("Dictionary of Doom has no translation. Is it the correct JSON file?")

def prepareDefaults(json):
    defaults = {}
    for key in json["defaults"]:  # We have to copy over all defaults from the JSON handle to a normal dict.
        defaults[key] = json["defaults"][key]
    return defaults

def prepareLocals(config_parser, config_section, defaults):
    copied_locals = defaults.copy()  # Don't edit the original!
    for option in config_parser.options(config_section):
        copied_locals[option] = config_parser.get(config_section, option)
    return copied_locals

section = ""
for found_section in parser.sections():
    if found_section.startswith("profile"):
        section = found_section
        break
if not section:  # No section starting with "profile" was found. Probably not a proper INI file.
    print("No section starting with 'profile' was found. Probably not a proper INI file.")

defaults = prepareDefaults(dict_of_doom)
legacy_settings = prepareLocals(parser, section, defaults) #Gets the settings from the legacy profile.

data = {}

data['id'] = parser.get('machine', 'machine_name')
data['name'] = parser.get('machine', 'machine_name')
data['version'] = 2 # FIXME: Do not hardcode
data['inherits'] = "fdmprinter" # FIXME: Do not hardcode
metadata = {}
metadata['visible'] = True
metadata['author'] = "Converted from %s" % (ini_filename)
metadata['manufacturer'] = parser.get('machine', 'machine_name')
metadata['category'] = "Other"
metadata['file_formats'] = "text/x-gcode" # FIXME: Do not hardcode
metadata['platform_offset'] = [0, 0, 0] # FIXME: Do not hardcode
data['metadata'] = metadata

overrides = {}

for new_setting in dict_of_doom["translation"]:
    old_setting_expression = dict_of_doom["translation"][new_setting]
    # print old_setting_expression
    compiled = compile(old_setting_expression, new_setting, "eval")
    try:
        new_value = eval(compiled, {"math": math}, legacy_settings)
        value_using_defaults = eval(compiled, {"math": math}, defaults)
    except Exception:
        print("Setting " + new_setting + " could not be set because the evaluation failed. Something is probably missing from the imported legacy profile.")
        continue
    if new_value != value_using_defaults:
        try:
            overrides[new_setting] = {"default_value": float(new_value)}
        except:
            try:
                if((new_value == "True") or (new_value == "False")):
                    overrides[new_setting] = {"default_value": bool(new_value)}
                else:
                    overrides[new_setting] = {"default_value": new_value}
            except:
                overrides[new_setting] = {"default_value": new_value}
    else:
        if(also_include_default_values):
            try:
                overrides[new_setting] = {"default_value": float(new_value)}
            except:
                try:
                    if((new_value == "True") or (new_value == "False")):
                        overrides[new_setting] = {"default_value": bool(new_value)}
                    else:
                        overrides[new_setting] = {"default_value": new_value}
                except:
                    overrides[new_setting] = {"default_value": new_value}
overrides["adhesion_type"] = {"default_value": "skirt"}
overrides["machine_name"] = {"default_value": parser.get('machine', 'machine_name')}
overrides["machine_width"] = {"default_value": int(parser.get('machine', 'machine_width'))}
overrides["machine_height"] = {"default_value": int(parser.get('machine', 'machine_height'))}
overrides["machine_depth"] = {"default_value": int(parser.get('machine', 'machine_depth'))}
mystring = parser.get('alterations', 'start.gcode').replace("travel_speed", "speed_travel")
while '  ' in mystring:
    mystring = mystring.replace('  ', ' ')
overrides["machine_start_gcode"] = {"default_value": mystring}
mystring = parser.get('alterations', 'end.gcode').replace("travel_speed", "speed_travel")
while '  ' in mystring:
    mystring = mystring.replace('  ', ' ')
overrides["machine_end_gcode"] = {"default_value":mystring}
overrides["machine_gcode_flavor"] = {"default_value": parser.get('machine', 'gcode_flavor')}
data['overrides'] = overrides

if(parser.get('machine', 'has_heated_bed') == "False"):
    categories = {}
    material = {}
    settings = {}
    material_bed_temperature = {}
    material_bed_temperature['visible'] = False
    settings['material_bed_temperature'] = material_bed_temperature
    material['settings'] = settings
    categories['material'] = material
    data['categories'] = categories

json_data = json.dumps(data)

print json.dumps(data, sort_keys=True, indent=4, separators=(',', ': '))

with open(parser.get('machine', 'machine_name').lower() + '.def.json', 'w') as outfile:
    json.dump(data, outfile, sort_keys=True, indent=4, separators=(',', ': '))
<?xml version="1.0" encoding="UTF-8"?>
<profile name="RF 100 Quality High v2" version="2017-02-28 20:38:32" app="S3D-Software 3.1.1">
  <baseProfile>Default</baseProfile>
  <printMaterial>PLA Pearl White Innofil</printMaterial>
  <printQuality>Medium</printQuality>
  <printExtruders/>
  <extruder name="Extruder 1">
    <toolheadNumber>0</toolheadNumber>
    <diameter>0.4</diameter>
    <autoWidth>1</autoWidth>
    <width>0.48</width>
    <extrusionMultiplier>1</extrusionMultiplier>
    <useRetract>1</useRetract>
    <retractionDistance>1.5</retractionDistance>
    <extraRestartDistance>0</extraRestartDistance>
    <retractionZLift>0</retractionZLift>
    <retractionSpeed>1800</retractionSpeed>
    <useCoasting>1</useCoasting>
    <coastingDistance>0.2</coastingDistance>
    <useWipe>1</useWipe>
    <wipeDistance>2</wipeDistance>
  </extruder>
  <primaryExtruder>0</primaryExtruder>
  <layerHeight>0.1</layerHeight>
  <topSolidLayers>8</topSolidLayers>
  <bottomSolidLayers>8</bottomSolidLayers>
  <perimeterOutlines>2</perimeterOutlines>
  <printPerimetersInsideOut>1</printPerimetersInsideOut>
  <startPointOption>2</startPointOption>
  <startPointOriginX>0</startPointOriginX>
  <startPointOriginY>0</startPointOriginY>
  <startPointOriginZ>0</startPointOriginZ>
  <sequentialIslands>0</sequentialIslands>
  <spiralVaseMode>0</spiralVaseMode>
  <firstLayerHeightPercentage>150</firstLayerHeightPercentage>
  <firstLayerWidthPercentage>100</firstLayerWidthPercentage>
  <firstLayerUnderspeed>0.5</firstLayerUnderspeed>
  <useRaft>0</useRaft>
  <raftExtruder>0</raftExtruder>
  <raftLayers>3</raftLayers>
  <raftOffset>3</raftOffset>
  <raftSeparationDistance>0.14</raftSeparationDistance>
  <raftInfill>85</raftInfill>
  <disableRaftBaseLayers>0</disableRaftBaseLayers>
  <useSkirt>1</useSkirt>
  <skirtExtruder>0</skirtExtruder>
  <skirtLayers>1</skirtLayers>
  <skirtOutlines>4</skirtOutlines>
  <skirtOffset>3</skirtOffset>
  <usePrimePillar>0</usePrimePillar>
  <primePillarExtruder>999</primePillarExtruder>
  <primePillarWidth>12</primePillarWidth>
  <primePillarLocation>7</primePillarLocation>
  <primePillarSpeedMultiplier>1</primePillarSpeedMultiplier>
  <useOozeShield>0</useOozeShield>
  <oozeShieldExtruder>999</oozeShieldExtruder>
  <oozeShieldOffset>2</oozeShieldOffset>
  <oozeShieldOutlines>1</oozeShieldOutlines>
  <oozeShieldSidewallShape>1</oozeShieldSidewallShape>
  <oozeShieldSidewallAngle>30</oozeShieldSidewallAngle>
  <oozeShieldSpeedMultiplier>1</oozeShieldSpeedMultiplier>
  <infillExtruder>0</infillExtruder>
  <internalInfillPattern>Rectilinear</internalInfillPattern>
  <externalInfillPattern>Rectilinear</externalInfillPattern>
  <infillPercentage>30</infillPercentage>
  <outlineOverlapPercentage>20</outlineOverlapPercentage>
  <infillExtrusionWidthPercentage>100</infillExtrusionWidthPercentage>
  <minInfillLength>5</minInfillLength>
  <infillLayerInterval>1</infillLayerInterval>
  <infillAngles>45,-45</infillAngles>
  <overlapInfillAngles>0</overlapInfillAngles>
  <generateSupport>0</generateSupport>
  <supportExtruder>0</supportExtruder>
  <supportInfillPercentage>40</supportInfillPercentage>
  <supportExtraInflation>0</supportExtraInflation>
  <denseSupportLayers>0</denseSupportLayers>
  <denseSupportInfillPercentage>70</denseSupportInfillPercentage>
  <supportLayerInterval>1</supportLayerInterval>
  <supportHorizontalPartOffset>0.3</supportHorizontalPartOffset>
  <supportUpperSeparationLayers>1</supportUpperSeparationLayers>
  <supportLowerSeparationLayers>1</supportLowerSeparationLayers>
  <supportType>0</supportType>
  <supportGridSpacing>2</supportGridSpacing>
  <maxOverhangAngle>45</maxOverhangAngle>
  <supportAngles>0</supportAngles>
  <temperatureController name="Extruder 1">
    <temperatureNumber>0</temperatureNumber>
    <isHeatedBed>0</isHeatedBed>
    <relayBetweenLayers>0</relayBetweenLayers>
    <relayBetweenLoops>0</relayBetweenLoops>
    <stabilizeAtStartup>1</stabilizeAtStartup>
    <setpoint layer="1" temperature="200"/>
  </temperatureController>
  <fanSpeed>
    <setpoint layer="1" speed="0"/>
    <setpoint layer="2" speed="100"/>
  </fanSpeed>
  <blipFanToFullPower>0</blipFanToFullPower>
  <adjustSpeedForCooling>1</adjustSpeedForCooling>
  <minSpeedLayerTime>15</minSpeedLayerTime>
  <minCoolingSpeedSlowdown>20</minCoolingSpeedSlowdown>
  <increaseFanForCooling>0</increaseFanForCooling>
  <minFanLayerTime>45</minFanLayerTime>
  <maxCoolingFanSpeed>100</maxCoolingFanSpeed>
  <increaseFanForBridging>0</increaseFanForBridging>
  <bridgingFanSpeed>100</bridgingFanSpeed>
  <use5D>1</use5D>
  <relativeEdistances>0</relativeEdistances>
  <allowEaxisZeroing>1</allowEaxisZeroing>
  <independentExtruderAxes>0</independentExtruderAxes>
  <includeM10123>0</includeM10123>
  <stickySupport>1</stickySupport>
  <applyToolheadOffsets>0</applyToolheadOffsets>
  <gcodeXoffset>0</gcodeXoffset>
  <gcodeYoffset>0</gcodeYoffset>
  <gcodeZoffset>0</gcodeZoffset>
  <overrideMachineDefinition>1</overrideMachineDefinition>
  <machineTypeOverride>0</machineTypeOverride>
  <strokeXoverride>100</strokeXoverride>
  <strokeYoverride>100</strokeYoverride>
  <strokeZoverride>100</strokeZoverride>
  <originOffsetXoverride>0</originOffsetXoverride>
  <originOffsetYoverride>0</originOffsetYoverride>
  <originOffsetZoverride>0</originOffsetZoverride>
  <homeXdirOverride>-1</homeXdirOverride>
  <homeYdirOverride>-1</homeYdirOverride>
  <homeZdirOverride>-1</homeZdirOverride>
  <flipXoverride>1</flipXoverride>
  <flipYoverride>-1</flipYoverride>
  <flipZoverride>1</flipZoverride>
  <toolheadOffsets>0,0|0,0|0,0|0,0|0,0|0,0</toolheadOffsets>
  <overrideFirmwareConfiguration>1</overrideFirmwareConfiguration>
  <firmwareTypeOverride>RepRap (Marlin/Repetier/Sprinter)</firmwareTypeOverride>
  <GPXconfigOverride>r2</GPXconfigOverride>
  <baudRateOverride>115200</baudRateOverride>
  <overridePrinterModels>0</overridePrinterModels>
  <printerModelsOverride/>
  <startingGcode>G28		; home all axes,M117 Printing...		; Put printing message on LCD screen</startingGcode>
  <layerChangeGcode/>
  <retractionGcode/>
  <toolChangeGcode/>
  <endingGcode>M104 S0                     		;extruder heater off,G91                                    		;relative positioning,G1 E-1 F300                            		;retract the filament a bit before lifting the nozzle to release some of the pressure,G1 Z+0.5 E-5 X-20 Y-20 F{travel_speed} 	;move Z up a bit and retract filament even more,G28 X0 Y0                              		;move X/Y to min endstops so the head is out of the way,G1 Z30.0 F{travel_speed} 		;move the platform down 30mm,M84                         		;steppers off,G90                         		;absolute positioning,</endingGcode>
  <exportFileFormat>gcode</exportFileFormat>
  <celebration>0</celebration>
  <celebrationSong>Random Song</celebrationSong>
  <postProcessing/>
  <defaultSpeed>2400</defaultSpeed>
  <outlineUnderspeed>0.8</outlineUnderspeed>
  <solidInfillUnderspeed>0.8</solidInfillUnderspeed>
  <supportUnderspeed>0.8</supportUnderspeed>
  <rapidXYspeed>4800</rapidXYspeed>
  <rapidZspeed>1002</rapidZspeed>
  <minBridgingArea>50</minBridgingArea>
  <bridgingExtraInflation>0</bridgingExtraInflation>
  <bridgingExtrusionMultiplier>1</bridgingExtrusionMultiplier>
  <bridgingSpeedMultiplier>1</bridgingSpeedMultiplier>
  <filamentDiameter>1.75</filamentDiameter>
  <filamentPricePerKg>46</filamentPricePerKg>
  <filamentDensity>1.25</filamentDensity>
  <useMinPrintHeight>0</useMinPrintHeight>
  <minPrintHeight>0</minPrintHeight>
  <useMaxPrintHeight>0</useMaxPrintHeight>
  <maxPrintHeight>0</maxPrintHeight>
  <useDiaphragm>0</useDiaphragm>
  <diaphragmLayerInterval>20</diaphragmLayerInterval>
  <robustSlicing>1</robustSlicing>
  <mergeAllIntoSolid>0</mergeAllIntoSolid>
  <onlyRetractWhenCrossingOutline>1</onlyRetractWhenCrossingOutline>
  <retractBetweenLayers>1</retractBetweenLayers>
  <useRetractionMinTravel>0</useRetractionMinTravel>
  <retractionMinTravel>3</retractionMinTravel>
  <retractWhileWiping>1</retractWhileWiping>
  <onlyWipeOutlines>1</onlyWipeOutlines>
  <avoidCrossingOutline>0</avoidCrossingOutline>
  <maxMovementDetourFactor>3</maxMovementDetourFactor>
  <toolChangeRetractionDistance>12</toolChangeRetractionDistance>
  <toolChangeExtraRestartDistance>-0.5</toolChangeExtraRestartDistance>
  <toolChangeRetractionSpeed>600</toolChangeRetractionSpeed>
  <allowThinWallGapFill>1</allowThinWallGapFill>
  <thinWallAllowedOverlapPercentage>25</thinWallAllowedOverlapPercentage>
  <horizontalSizeCompensation>0</horizontalSizeCompensation>
  <autoConfigureMaterial name="PLA">
    <globalExtruderTemperature>210</globalExtruderTemperature>
    <globalBedTemperature>60</globalBedTemperature>
    <globalExtrusionMultiplier>1</globalExtrusionMultiplier>
    <fanSpeed>
      <setpoint layer="1" speed="0"/>
      <setpoint layer="2" speed="100"/>
    </fanSpeed>
  </autoConfigureMaterial>
  <autoConfigureMaterial name="ABS">
    <globalExtruderTemperature>225</globalExtruderTemperature>
    <globalBedTemperature>100</globalBedTemperature>
    <globalExtrusionMultiplier>1</globalExtrusionMultiplier>
    <fanSpeed>
      <setpoint layer="1" speed="0"/>
    </fanSpeed>
  </autoConfigureMaterial>
  <autoConfigureMaterial name="PVA">
    <globalExtruderTemperature>195</globalExtruderTemperature>
    <globalBedTemperature>80</globalBedTemperature>
    <globalExtrusionMultiplier>1</globalExtrusionMultiplier>
    <fanSpeed>
      <setpoint layer="1" speed="0"/>
      <setpoint layer="2" speed="100"/>
    </fanSpeed>
  </autoConfigureMaterial>
  <autoConfigureMaterial name="Nylon">
    <globalExtruderTemperature>220</globalExtruderTemperature>
    <globalBedTemperature>80</globalBedTemperature>
    <globalExtrusionMultiplier>1</globalExtrusionMultiplier>
    <fanSpeed>
      <setpoint layer="1" speed="0"/>
    </fanSpeed>
  </autoConfigureMaterial>
  <autoConfigureQuality name="Fast">
    <layerHeight>0.3</layerHeight>
    <topSolidLayers>3</topSolidLayers>
    <bottomSolidLayers>3</bottomSolidLayers>
    <skirtLayers>1</skirtLayers>
    <infillPercentage>15</infillPercentage>
    <supportInfillPercentage>25</supportInfillPercentage>
  </autoConfigureQuality>
  <autoConfigureQuality name="Medium">
    <layerHeight>0.1</layerHeight>
    <topSolidLayers>8</topSolidLayers>
    <bottomSolidLayers>8</bottomSolidLayers>
    <skirtLayers>1</skirtLayers>
    <infillPercentage>30</infillPercentage>
    <supportInfillPercentage>40</supportInfillPercentage>
  </autoConfigureQuality>
  <autoConfigureQuality name="High">
    <layerHeight>0.2</layerHeight>
    <topSolidLayers>4</topSolidLayers>
    <bottomSolidLayers>4</bottomSolidLayers>
    <skirtLayers>1</skirtLayers>
    <infillPercentage>15</infillPercentage>
    <supportInfillPercentage>40</supportInfillPercentage>
  </autoConfigureQuality>
  <autoConfigureMaterial name="PLA Pearl White Innofil">
    <globalExtruderTemperature>200</globalExtruderTemperature>
    <globalBedTemperature>60</globalBedTemperature>
    <globalExtrusionMultiplier>1</globalExtrusionMultiplier>
    <fanSpeed>
      <setpoint layer="1" speed="0"/>
      <setpoint layer="2" speed="100"/>
    </fanSpeed>
  </autoConfigureMaterial>
</profile>