I tried to implement trace functions which make it easier to track down issues. Users without knowledge can provide detailed trace information for more knowledgeable contributes to look at and see exactly what is happening.
I would like to know what you think of this attempt before I make this feature more complete. For now only gridfinity-rebuilt-utility.scad has trace calls and the gridfinity-rebuilt-bins.scad file is for now the only one compatible which contains an overall trace on/off variable in the UI.
Things that might need more attention:
openscad is not a fully featured programming language. If you want to print a lot of information on one line, only one echo call can be used.
I could not find a more beautiful way to print arguments of a module. There is no vargs as in c/c++ or kwargs as in python. However, this functionality is available for only the echo functions. But this means that the echo needs to be called inside the traced module. Which resulted in:
The current (second) option is shorter in characters, but more readable. However it produces 2 trace lines which is not really wanted in my opinion regarding tracing
I miss information when openscad is executed from cli, I think because $parent-modules has a different value. So the current implementation only works (correctly) with the openscad UI.
Tracing
I tried to implement trace functions which make it easier to track down issues. Users without knowledge can provide detailed trace information for more knowledgeable contributes to look at and see exactly what is happening.
I would like to know what you think of this attempt before I make this feature more complete. For now only
gridfinity-rebuilt-utility.scad
has trace calls and thegridfinity-rebuilt-bins.scad
file is for now the only one compatible which contains an overall trace on/off variable in the UI.Things that might need more attention:
vargs
as in c/c++ orkwargs
as in python. However, this functionality is available for only theecho
functions. But this means that the echo needs to be called inside the traced module. Which resulted in:instead of
The current (second) option is shorter in characters, but more readable. However it produces 2 trace lines which is not really wanted in my opinion regarding tracing
$parent-modules
has a different value. So the current implementation only works (correctly) with the openscad UI.Example
Example trace output
``` Compiling design (CSG Tree generation)... ECHO: "gridfinityInit: entry: gx=1,gy=1,h=37,h0=0,l=42" ECHO: "| block_bottom: entry: h=36.9,gx=1,gy=1,l=42" ECHO: "| | rounded_rectangle: entry: length=41.2625,width=41.2625,height=36.9,rad=4.01" ECHO: "| | rounded_rectangle: entry" ECHO: "| | rounded_rectangle: exit" ECHO: "| block_bottom: exit" ECHO: "| cutEqual: entry: ndiv_x=1,ndivy=1,style_tab=1,scoop_weight=1" ECHO: "| | cut: entry: x=0,y=0,w=1,h=1,t=1,s=1" ECHO: "| | | cut_move: entry: x=0,y=0,w=1,h=1" ECHO: "| | | | cut_move_unsafe: entry: x=0,y=0,w=1,h=1" ECHO: "| | | | | block_cutter: entry: x=0,y=0,w=1,h=1,t=1,s=1" ECHO: "| | | | | | fillet_cutter: entry: t=1,c=seagreen" ECHO: "| | | | | | | transform_main: entry: xlen=36.3071" ECHO: "| | | | | | | | profile_cutter: entry: h=34.8,l=23.7552,s=1" ECHO: "| | | | | | | | profile_cutter: exit" ECHO: "| | | | | | | transform_main: exit" ECHO: "| | | | | | fillet_cutter: exit" ECHO: "| | | | | | fillet_cutter: entry: t=0,c=hotpink" ECHO: "| | | | | | | transform_main: entry: xlen=39.6" ECHO: "| | | | | | | | profile_cutter: entry: h=34.8,l=37.9536,s=1" ECHO: "| | | | | | | | profile_cutter: exit" ECHO: "| | | | | | | | profile_cutter_tab: entry: h=34.8,tab=15.85,ang=36" ECHO: "| | | | | | | | profile_cutter_tab: exit" ECHO: "| | | | | | | transform_main: exit" ECHO: "| | | | | | | transform_main: entry: xlen=79.2" ECHO: "| | | | | | | | profile_cutter_tab: entry: h=34.8,tab=3.09645,ang=45" ECHO: "| | | | | | | | profile_cutter_tab: exit" ECHO: "| | | | | | | transform_main: exit" ECHO: "| | | | | | | transform_main: entry: xlen=79.2" ECHO: "| | | | | | | | profile_cutter_tab: entry: h=34.8,tab=3.09645,ang=45" ECHO: "| | | | | | | | profile_cutter_tab: exit" ECHO: "| | | | | | | transform_main: exit" ECHO: "| | | | | | fillet_cutter: exit" ECHO: "| | | | | block_cutter: exit" ECHO: "| | | | cut_move_unsafe: exit" ECHO: "| | | cut_move: exit" ECHO: "| | cut: exit" ECHO: "| cutEqual: exit" ECHO: "| block_wall: entry: gx=1,gy=1,l=42" ECHO: "| | sweep_rounded: entry: w=33.499,h=33.499" ECHO: "| | | pattern_circular: entry: n=2" ECHO: "| | | | copy_mirror: entry: vec=[1, 0, 0]" ECHO: "| | | | | profile_wall: entry" ECHO: "| | | | | | profile_wall_sub: entry" ECHO: "| | | | | | | profile_wall_sub_sub: entry" ECHO: "| | | | | | | profile_wall_sub_sub: exit" ECHO: "| | | | | | | profile_base: entry" ECHO: "| | | | | | | profile_base: exit" ECHO: "| | | | | | profile_wall_sub: exit" ECHO: "| | | | | | profile_wall_sub: entry" ECHO: "| | | | | | | profile_wall_sub_sub: entry" ECHO: "| | | | | | | profile_wall_sub_sub: exit" ECHO: "| | | | | | | profile_base: entry" ECHO: "| | | | | | | profile_base: exit" ECHO: "| | | | | | profile_wall_sub: exit" ECHO: "| | | | | profile_wall: exit" ECHO: "| | | | | profile_wall: entry" ECHO: "| | | | | | profile_wall_sub: entry" ECHO: "| | | | | | | profile_wall_sub_sub: entry" ECHO: "| | | | | | | profile_wall_sub_sub: exit" ECHO: "| | | | | | | profile_base: entry" ECHO: "| | | | | | | profile_base: exit" ECHO: "| | | | | | profile_wall_sub: exit" ECHO: "| | | | | | profile_wall_sub: entry" ECHO: "| | | | | | | profile_wall_sub_sub: entry" ECHO: "| | | | | | | profile_wall_sub_sub: exit" ECHO: "| | | | | | | profile_base: entry" ECHO: "| | | | | | | profile_base: exit" ECHO: "| | | | | | profile_wall_sub: exit" ECHO: "| | | | | profile_wall: exit" ECHO: "| | | | copy_mirror: exit" ECHO: "| | | | profile_wall: entry" ECHO: "| | | | | profile_wall_sub: entry" ECHO: "| | | | | | profile_wall_sub_sub: entry" ECHO: "| | | | | | profile_wall_sub_sub: exit" ECHO: "| | | | | | profile_base: entry" ECHO: "| | | | | | profile_base: exit" ECHO: "| | | | | profile_wall_sub: exit" ECHO: "| | | | | profile_wall_sub: entry" ECHO: "| | | | | | profile_wall_sub_sub: entry" ECHO: "| | | | | | profile_wall_sub_sub: exit" ECHO: "| | | | | | profile_base: entry" ECHO: "| | | | | | profile_base: exit" ECHO: "| | | | | profile_wall_sub: exit" ECHO: "| | | | profile_wall: exit" ECHO: "| | | | profile_wall: entry" ECHO: "| | | | | profile_wall_sub: entry" ECHO: "| | | | | | profile_wall_sub_sub: entry" ECHO: "| | | | | | profile_wall_sub_sub: exit" ECHO: "| | | | | | profile_base: entry" ECHO: "| | | | | | profile_base: exit" ECHO: "| | | | | profile_wall_sub: exit" ECHO: "| | | | | profile_wall_sub: entry" ECHO: "| | | | | | profile_wall_sub_sub: entry" ECHO: "| | | | | | profile_wall_sub_sub: exit" ECHO: "| | | | | | profile_base: entry" ECHO: "| | | | | | profile_base: exit" ECHO: "| | | | | profile_wall_sub: exit" ECHO: "| | | | profile_wall: exit" ECHO: "| | | | copy_mirror: entry: vec=[1, 0, 0]" ECHO: "| | | | | profile_wall: entry" ECHO: "| | | | | | profile_wall_sub: entry" ECHO: "| | | | | | | profile_wall_sub_sub: entry" ECHO: "| | | | | | | profile_wall_sub_sub: exit" ECHO: "| | | | | | | profile_base: entry" ECHO: "| | | | | | | profile_base: exit" ECHO: "| | | | | | profile_wall_sub: exit" ECHO: "| | | | | | profile_wall_sub: entry" ECHO: "| | | | | | | profile_wall_sub_sub: entry" ECHO: "| | | | | | | profile_wall_sub_sub: exit" ECHO: "| | | | | | | profile_base: entry" ECHO: "| | | | | | | profile_base: exit" ECHO: "| | | | | | profile_wall_sub: exit" ECHO: "| | | | | profile_wall: exit" ECHO: "| | | | | profile_wall: entry" ECHO: "| | | | | | profile_wall_sub: entry" ECHO: "| | | | | | | profile_wall_sub_sub: entry" ECHO: "| | | | | | | profile_wall_sub_sub: exit" ECHO: "| | | | | | | profile_base: entry" ECHO: "| | | | | | | profile_base: exit" ECHO: "| | | | | | profile_wall_sub: exit" ECHO: "| | | | | | profile_wall_sub: entry" ECHO: "| | | | | | | profile_wall_sub_sub: entry" ECHO: "| | | | | | | profile_wall_sub_sub: exit" ECHO: "| | | | | | | profile_base: entry" ECHO: "| | | | | | | profile_base: exit" ECHO: "| | | | | | profile_wall_sub: exit" ECHO: "| | | | | profile_wall: exit" ECHO: "| | | | copy_mirror: exit" ECHO: "| | | | profile_wall: entry" ECHO: "| | | | | profile_wall_sub: entry" ECHO: "| | | | | | profile_wall_sub_sub: entry" ECHO: "| | | | | | profile_wall_sub_sub: exit" ECHO: "| | | | | | profile_base: entry" ECHO: "| | | | | | profile_base: exit" ECHO: "| | | | | profile_wall_sub: exit" ECHO: "| | | | | profile_wall_sub: entry" ECHO: "| | | | | | profile_wall_sub_sub: entry" ECHO: "| | | | | | profile_wall_sub_sub: exit" ECHO: "| | | | | | profile_base: entry" ECHO: "| | | | | | profile_base: exit" ECHO: "| | | | | profile_wall_sub: exit" ECHO: "| | | | profile_wall: exit" ECHO: "| | | | profile_wall: entry" ECHO: "| | | | | profile_wall_sub: entry" ECHO: "| | | | | | profile_wall_sub_sub: entry" ECHO: "| | | | | | profile_wall_sub_sub: exit" ECHO: "| | | | | | profile_base: entry" ECHO: "| | | | | | profile_base: exit" ECHO: "| | | | | profile_wall_sub: exit" ECHO: "| | | | | profile_wall_sub: entry" ECHO: "| | | | | | profile_wall_sub_sub: entry" ECHO: "| | | | | | profile_wall_sub_sub: exit" ECHO: "| | | | | | profile_base: entry" ECHO: "| | | | | | profile_base: exit" ECHO: "| | | | | profile_wall_sub: exit" ECHO: "| | | | profile_wall: exit" ECHO: "| | | pattern_circular: exit" ECHO: "| | sweep_rounded: exit" ECHO: "| block_wall: exit" ECHO: "gridfinityInit: exit" ECHO: "gridfinityBase: entry: gx=1,gy=1,l=42,dx=0,dy=0,style_hole=3,off=0,final_cut=true" ECHO: "| rounded_rectangle: entry: length=41.502,width=41.502,height=1.46667,rad=4.251" ECHO: "| rounded_rectangle: entry" ECHO: "| rounded_rectangle: exit" ECHO: "| rounded_rectangle: entry: length=41.505,width=41.505,height=16,rad=4.251" ECHO: "| rounded_rectangle: entry" ECHO: "| rounded_rectangle: exit" ECHO: "| pattern_linear: entry: x=1,y=1,sx=42,sy=42" ECHO: "| | block_base_solid: entry: dbnx=1,dbny=1,l=42,o=0" ECHO: "| | | rounded_rectangle: entry: length=35.55,width=35.55,height=5,rad=0.8" ECHO: "| | | rounded_rectangle: entry" ECHO: "| | | rounded_rectangle: exit" ECHO: "| | | rounded_rectangle: entry: length=37.15,width=37.15,height=4.2,rad=1.6" ECHO: "| | | rounded_rectangle: entry" ECHO: "| | | rounded_rectangle: exit" ECHO: "| | | rounded_rectangle: entry: length=37.15,width=37.15,height=2.4,rad=1.6" ECHO: "| | | rounded_rectangle: entry" ECHO: "| | | rounded_rectangle: exit" ECHO: "| | | rounded_rectangle: entry: length=41.95,width=41.95,height=1.1,rad=4.25" ECHO: "| | | rounded_rectangle: entry" ECHO: "| | | rounded_rectangle: exit" ECHO: "| | block_base_solid: exit" ECHO: "| pattern_linear: exit" ECHO: "| pattern_linear: entry: x=1,y=1,sx=42,sy=0" ECHO: "| | pattern_circular: entry: n=4" ECHO: "| | | block_base_hole: entry: style_hole=3,o=0" ECHO: "| | | | copy_mirror: entry: vec=[0, 1, 0]" ECHO: "| | | | copy_mirror: exit" ECHO: "| | | block_base_hole: exit" ECHO: "| | | block_base_hole: entry: style_hole=3,o=0" ECHO: "| | | | copy_mirror: entry: vec=[0, 1, 0]" ECHO: "| | | | copy_mirror: exit" ECHO: "| | | block_base_hole: exit" ECHO: "| | | block_base_hole: entry: style_hole=3,o=0" ECHO: "| | | | copy_mirror: entry: vec=[0, 1, 0]" ECHO: "| | | | copy_mirror: exit" ECHO: "| | | block_base_hole: exit" ECHO: "| | | block_base_hole: entry: style_hole=3,o=0" ECHO: "| | | | copy_mirror: entry: vec=[0, 1, 0]" ECHO: "| | | | copy_mirror: exit" ECHO: "| | | block_base_hole: exit" ECHO: "| | pattern_circular: exit" ECHO: "| pattern_linear: exit" ECHO: "gridfinityBase: exit" Compiling design (CSG Products generation)... Geometries in cache: 110 Geometry cache size in bytes: 1261752 CGAL Polyhedrons in cache: 18 CGAL cache size in bytes: 682464 Compiling design (CSG Products normalization)... Normalized tree has 14 elements! Compile and preview finished. Total rendering time: 0:00:00.161 ```