8181default_virtual_machine = {
8282 "absolute_position" : True ,
8383 "absolute_extrusion" : True ,
84+ "extrusion_volumetric" : False ,
8485 "units" : "SI (mm)" ,
8586 "initial_position" : None ,
8687 # general properties
@@ -208,21 +209,21 @@ def dict_list_traveler(line_dict_list: List[dict], initial_machine_setup: dict)
208209
209210 """
210211
211- def apply_extrusion (line_dict : dict , virtual_machine : dict , command : str , initial_machine_setup : dict ) -> dict :
212+ def apply_extrusion (line_dict : dict , virtual_machine : dict , command : str ) -> dict :
212213 import math
213214
214215 e_value = line_dict [command ]["E" ]
215216
216217 # volumetric to length conversion
217218 # (1) V = (d/2)^2 * pi * E
218219 # (2) E = V / ((d/2)^2 * pi)
219- if initial_machine_setup .get ("extrusion_volumetric" , False ):
220+ if virtual_machine .get ("extrusion_volumetric" , False ):
220221 # volumetric extrusion
221- e_value = e_value / (math .pi * (initial_machine_setup ["filament_diam" ] / 2 ) ** 2 )
222+ e_value = e_value / (math .pi * (virtual_machine ["filament_diam" ] / 2 ) ** 2 )
222223
223- if virtual_machine ["absolute_extrusion" ] is True :
224+ if virtual_machine ["absolute_extrusion" ]:
224225 virtual_machine ["E" ] = e_value
225- if virtual_machine [ "absolute_extrusion" ] is False : # redundant
226+ else :
226227 virtual_machine ["E" ] = virtual_machine ["E" ] + e_value
227228
228229 return virtual_machine
@@ -245,17 +246,15 @@ def apply_extrusion(line_dict: dict, virtual_machine: dict, command: str, initia
245246 layer_counter = 0
246247
247248 # overwrite default values from initial machine setup
248- """TODO: depending on the setting the user should be informed that a default value is used.
249- I prepared a warning below.
250- Are all these settings necessary?"""
251249 for key in default_virtual_machine :
252250 if initial_machine_setup is not None and key in initial_machine_setup :
253251 virtual_machine [key ] = initial_machine_setup [key ]
254252 else :
255- """print (
253+ custom_print (
256254 f"The parameter '{ key } ' was not specified in your machine presets. "
257- f"Using the the default value of '{default_virtual_machine[key]}' to continue."
258- )"""
255+ f"Using the the default value of '{ default_virtual_machine [key ]} ' to continue." ,
256+ lvl = 3 ,
257+ )
259258 virtual_machine [key ] = default_virtual_machine [key ]
260259
261260 # initial state creation
@@ -318,7 +317,7 @@ def apply_extrusion(line_dict: dict, virtual_machine: dict, command: str, initia
318317
319318 # look for extrusion commands and apply abs/rel
320319 if "E" in line_dict [command ]:
321- virtual_machine = apply_extrusion (line_dict , virtual_machine , command , initial_machine_setup )
320+ virtual_machine = apply_extrusion (line_dict , virtual_machine , command )
322321
323322 # feed rates in unit/min to unit/sec
324323 if "F" in line_dict [command ]:
0 commit comments