Index: bug_files/dxf_drill/fid.txt =================================================================== --- bug_files/dxf_drill/fid.txt (revision 39706) +++ bug_files/dxf_drill/fid.txt (nonexistent) @@ -1,77 +0,0 @@ -librnd-20240924/src/librnd/core/color.h contains: - - #define rnd_color_is_drill(clr) (strcmp((clr)->str, "drill") == 0) - -and pcb-rnd-20241010 src_plugins/export_dxf/dxf.c has: - - static void dxf_set_color(rnd_hid_gc_t gc, const rnd_color_t *color) - { - if (rnd_color_is_drill(color) == 0) - gc->drawing_hole = 1; - } - -compare this to librnd-20240924/src/librnd/plugins/lib_exp_text/draw_svg.c: - - void rnd_svg_set_color(rnd_svg_t *pctx, rnd_hid_gc_t gc, const -rnd_color_t *color) - { - ... - gc->drill = 0; - ... - if (rnd_color_is_drill(color)) { - name = "#ffffff"; - gc->drill = 1; - } - } - -and compare it to pcb-rnd-20241010/src_plugins/export_gerber/gerber.c: - - static void gerber_set_color(rnd_hid_gc_t gc, const rnd_color_t *color) - { - if (rnd_color_is_drill(color)) { - ... - gc->drill = 1; - } - else { - ... - gc->drill = 0; - } - } - -It appears that the dxf_set_color logic is inverted (and missing a -clearing of drawing_hole). - -I ran into this after modifying the current DXF export so that -dxf_fill_circle is used to draw round end caps for copper traces. -I do not have a test case for the stock pcb-rnd. - -Given: - - static void dxf_fill_circle(...) - ... - /* hatch for fill circle: use it for copper or if explicitly -requested */ - if (ctx->drill_fill || !gc->drawing_hole) { - ... - } - ... - -I was expecting a filled circle to be drawn. Using a debugger to -trace the code I saw dxf_set_color being called with the correct color -for the top copper, however it then proceeded to set gc->drawing_hole -which is why the copper circle wasn't filled. - -Changing src_plugins/export_dxf/dxf.c dxf_set_color to: - - gc->drawing_hole = rnd_color_is_drill(color); - -produced the expected results (and appears to be consist with other -areas of the librnd / pcb-rnd code). - -As a side effect of the dxf_set_color logic inversion I found it -necessary to change the default setting of drill-fill option to be -true in order to produce the same DXF output as before. - --- John - - Index: bug_files/dxf_drill/fid.pcb =================================================================== --- bug_files/dxf_drill/fid.pcb (revision 39706) +++ bug_files/dxf_drill/fid.pcb (nonexistent) @@ -1,53 +0,0 @@ -# release: pcb 4.3.0 - -# To read pcb files, the pcb version (or the git source date) must be >= the file version -FileVersion[20091103] - -PCB["" 6000.00mil 5000.00mil] - -Grid[10.00mil 0.0000 0.0000 0] -PolyArea[3100.006200] -Thermal[0.500000] -DRC[10.00mil 10.00mil 10.00mil 10.00mil 15.00mil 10.00mil] -Flags("nameonpcb,uniquename,clearnew,snappin") -Groups("1,c:2:3:4:5:6,s:7:8") -Styles["Signal,10.00mil,36.00mil,20.00mil,10.00mil:Power,25.00mil,60.00mil,35.00mil,10.00mil:Fat,40.00mil,60.00mil,35.00mil,10.00mil:Skinny,6.00mil,24.02mil,11.81mil,6.00mil"] - -Attribute("PCB::grid::unit" "mil") - -Element["" "Fiducial mark, no drill, .050 diameter pad" "FID" "FID" 2670.00mil 2060.00mil -35.00mil -175.00mil 0 100 ""] -( - Pad[0.0000 0.0000 0.0000 0.0000 50.00mil 90.00mil 130.00mil "" "1" "nopaste"] - ElementArc [0.0000 0.0000 75.00mil 75.00mil 0.000000 360.000000 10.00mil] - - ) -Layer(1 "top" "copper") -( -) -Layer(2 "ground" "copper") -( -) -Layer(3 "signal2" "copper") -( -) -Layer(4 "signal3" "copper") -( -) -Layer(5 "power" "copper") -( -) -Layer(6 "bottom" "copper") -( -) -Layer(7 "outline" "copper") -( -) -Layer(8 "spare" "copper") -( -) -Layer(9 "bottom silk" "silk") -( -) -Layer(10 "top silk" "silk") -( -) Index: bug_files/TODO/dxf_drill/fid.pcb =================================================================== --- bug_files/TODO/dxf_drill/fid.pcb (nonexistent) +++ bug_files/TODO/dxf_drill/fid.pcb (revision 39707) @@ -0,0 +1,53 @@ +# release: pcb 4.3.0 + +# To read pcb files, the pcb version (or the git source date) must be >= the file version +FileVersion[20091103] + +PCB["" 6000.00mil 5000.00mil] + +Grid[10.00mil 0.0000 0.0000 0] +PolyArea[3100.006200] +Thermal[0.500000] +DRC[10.00mil 10.00mil 10.00mil 10.00mil 15.00mil 10.00mil] +Flags("nameonpcb,uniquename,clearnew,snappin") +Groups("1,c:2:3:4:5:6,s:7:8") +Styles["Signal,10.00mil,36.00mil,20.00mil,10.00mil:Power,25.00mil,60.00mil,35.00mil,10.00mil:Fat,40.00mil,60.00mil,35.00mil,10.00mil:Skinny,6.00mil,24.02mil,11.81mil,6.00mil"] + +Attribute("PCB::grid::unit" "mil") + +Element["" "Fiducial mark, no drill, .050 diameter pad" "FID" "FID" 2670.00mil 2060.00mil -35.00mil -175.00mil 0 100 ""] +( + Pad[0.0000 0.0000 0.0000 0.0000 50.00mil 90.00mil 130.00mil "" "1" "nopaste"] + ElementArc [0.0000 0.0000 75.00mil 75.00mil 0.000000 360.000000 10.00mil] + + ) +Layer(1 "top" "copper") +( +) +Layer(2 "ground" "copper") +( +) +Layer(3 "signal2" "copper") +( +) +Layer(4 "signal3" "copper") +( +) +Layer(5 "power" "copper") +( +) +Layer(6 "bottom" "copper") +( +) +Layer(7 "outline" "copper") +( +) +Layer(8 "spare" "copper") +( +) +Layer(9 "bottom silk" "silk") +( +) +Layer(10 "top silk" "silk") +( +) Index: bug_files/TODO/dxf_drill/fid.txt =================================================================== --- bug_files/TODO/dxf_drill/fid.txt (nonexistent) +++ bug_files/TODO/dxf_drill/fid.txt (revision 39707) @@ -0,0 +1,77 @@ +librnd-20240924/src/librnd/core/color.h contains: + + #define rnd_color_is_drill(clr) (strcmp((clr)->str, "drill") == 0) + +and pcb-rnd-20241010 src_plugins/export_dxf/dxf.c has: + + static void dxf_set_color(rnd_hid_gc_t gc, const rnd_color_t *color) + { + if (rnd_color_is_drill(color) == 0) + gc->drawing_hole = 1; + } + +compare this to librnd-20240924/src/librnd/plugins/lib_exp_text/draw_svg.c: + + void rnd_svg_set_color(rnd_svg_t *pctx, rnd_hid_gc_t gc, const +rnd_color_t *color) + { + ... + gc->drill = 0; + ... + if (rnd_color_is_drill(color)) { + name = "#ffffff"; + gc->drill = 1; + } + } + +and compare it to pcb-rnd-20241010/src_plugins/export_gerber/gerber.c: + + static void gerber_set_color(rnd_hid_gc_t gc, const rnd_color_t *color) + { + if (rnd_color_is_drill(color)) { + ... + gc->drill = 1; + } + else { + ... + gc->drill = 0; + } + } + +It appears that the dxf_set_color logic is inverted (and missing a +clearing of drawing_hole). + +I ran into this after modifying the current DXF export so that +dxf_fill_circle is used to draw round end caps for copper traces. +I do not have a test case for the stock pcb-rnd. + +Given: + + static void dxf_fill_circle(...) + ... + /* hatch for fill circle: use it for copper or if explicitly +requested */ + if (ctx->drill_fill || !gc->drawing_hole) { + ... + } + ... + +I was expecting a filled circle to be drawn. Using a debugger to +trace the code I saw dxf_set_color being called with the correct color +for the top copper, however it then proceeded to set gc->drawing_hole +which is why the copper circle wasn't filled. + +Changing src_plugins/export_dxf/dxf.c dxf_set_color to: + + gc->drawing_hole = rnd_color_is_drill(color); + +produced the expected results (and appears to be consist with other +areas of the librnd / pcb-rnd code). + +As a side effect of the dxf_set_color logic inversion I found it +necessary to change the default setting of drill-fill option to be +true in order to produce the same DXF output as before. + +-- John + +