← Back to team overview

kicad-developers team mailing list archive

Re: patch to fix bug in DXF plot

 

On 12/17/2013 5:03 AM, Cirilo Bernardo wrote:
> Hi folks,
> 
>  There is a bug in DXF plot which changes the included angle of arcs. To demonstrate the bug:
> 
> 1. in the edge cutout layer, create a rectangle with rounded corners and plot the layer to DXF. Since KiCad will write a PCB file with all angles = +90, everything is OK.
> 
> 2. Delete the cutout layer and import the DXF. At this point everything should look OK.
> 
> 3. Plot the dxf again; this time things go bad because the DXF importer marked some angles as -90 in Step 2.
> 
> 4. Import the bad DXF (or view it with MCAD software).
> 
> I have only fixed the bug in BRDITEMS_PLOTTER::PlotDrawSegment and only for DXF plotting. I did not create tests to check if the problem exists with other types of plotting routines (it is possible others are affected, but not necessarily so) and I did not investigate problems with exporting an Arc in BRDITEMS_PLOTTER::Plot_1_EdgeModule.
> 
> Cheers,
> Cirilo

Your patch does not work for the attached board edge cuts layer so I am
reluctant to commit it.  It may work for your case but it may have
broken another corner case.  Don't feel bad, the current DXF plot does
not plot this board correctly either.  I've known about this problem for
a while but have been too lazy to fix it.  There is some oddness in the
way the DXF defines arcs that I am not completely familiar with.  If you
can get the attached board to plot correctly without breaking all of the
other DXF arc plotting, you'll get a hardy pat on back and your patch
committed. :)  Also, your editor is leaving trailing white space which
is a violation of the coding policy.

What I really would like to see is converting our DXF plotting over to
use the dxflib that JP recently added to the project.  It seems like a
much more complete solution which could give us better results in terms
of layer and color support.  Arcs with width would be nice too.  Maybe
you could become the guru of DXF plotting.

Thanks,

Wayne
(kicad_pcb (version 3) (host pcbnew "(2013-12-14 BZR 4555)-product")

  (general
    (links 18)
    (no_connects 0)
    (area 133.390641 88.811099 150.811654 105.5243)
    (thickness 1.6002)
    (drawings 5)
    (tracks 35)
    (zones 0)
    (modules 10)
    (nets 7)
  )

  (page A)
  (title_block
    (title "PCA168 BAE DUAL HALL EFFECT BOARD")
    (rev -)
    (company "Motion Sensors, Inc.")
  )

  (layers
    (15 Front signal)
    (0 Back signal)
    (16 B.Adhes user)
    (17 F.Adhes user)
    (18 B.Paste user)
    (19 F.Paste user)
    (20 B.SilkS user)
    (21 F.SilkS user)
    (22 B.Mask user)
    (23 F.Mask user)
    (24 Dwgs.User user)
    (25 Cmts.User user)
    (26 Eco1.User user)
    (27 Eco2.User user)
    (28 Edge.Cuts user)
  )

  (setup
    (last_trace_width 0.254)
    (trace_clearance 0.254)
    (zone_clearance 0.254)
    (zone_45_only no)
    (trace_min 0.1778)
    (segment_width 0.381)
    (edge_width 0.381)
    (via_size 0.889)
    (via_drill 0.635)
    (via_min_size 0.635)
    (via_min_drill 0.381)
    (uvia_size 0.508)
    (uvia_drill 0.127)
    (uvias_allowed no)
    (uvia_min_size 0.381)
    (uvia_min_drill 0.127)
    (pcb_text_width 0.3048)
    (pcb_text_size 1.524 2.032)
    (mod_edge_width 0.127)
    (mod_text_size 0.7112 0.762)
    (mod_text_width 0.127)
    (pad_size 3.2104 2.8077)
    (pad_drill 0)
    (pad_to_mask_clearance 0.0762)
    (solder_mask_min_width 0.1016)
    (aux_axis_origin 0 0)
    (visible_elements 7FFFFF7F)
    (pcbplotparams
      (layerselection 271613953)
      (usegerberextensions false)
      (excludeedgelayer false)
      (linewidth 0.150000)
      (plotframeref false)
      (viasonmask false)
      (mode 1)
      (useauxorigin false)
      (hpglpennumber 1)
      (hpglpenspeed 20)
      (hpglpendiameter 15)
      (hpglpenoverlay 2)
      (psnegative false)
      (psa4output false)
      (plotreference true)
      (plotvalue false)
      (plotothertext false)
      (plotinvisibletext false)
      (padsonsilk false)
      (subtractmaskfromsilk false)
      (outputformat 3)
      (mirror false)
      (drillshape 2)
      (scaleselection 1)
      (outputdirectory drawings/))
  )

  (net 0 "")
  (net 1 /CH1_COM)
  (net 2 /CH1_DOUT)
  (net 3 /CH1_VIN)
  (net 4 /CH2_DOUT)
  (net 5 /~CH1_DOUT)
  (net 6 /~CH2_DOUT)

  (net_class Default "This is the default net class."
    (clearance 0.254)
    (trace_width 0.254)
    (via_dia 0.889)
    (via_drill 0.635)
    (uvia_dia 0.508)
    (uvia_drill 0.127)
    (add_net "")
  )

  (net_class Signal ""
    (clearance 0.1778)
    (trace_width 0.1778)
    (via_dia 0.635)
    (via_drill 0.381)
    (uvia_dia 0.508)
    (uvia_drill 0.127)
    (add_net /CH1_COM)
    (add_net /CH1_DOUT)
    (add_net /CH1_VIN)
    (add_net /CH2_DOUT)
    (add_net /~CH1_DOUT)
    (add_net /~CH2_DOUT)
  )

  (gr_line (start 148.9583 92.71) (end 148.9583 100.584) (angle 90) (layer Edge.Cuts) (width 0.381))
  (gr_arc (start 142.1384 96.647) (end 148.9583 92.71) (angle -300) (layer Edge.Cuts) (width 0.381))
)

Follow ups

References