Bug when mirroring custom footprint pad

I made a custom footprint for a coil (see below if the upload is not working, foo.kicad_mod (6.8 KB) ) and I needed to also create a mirrored copy.
When I mirror inside the footprint editor, by selecting all the components and doing a mirror by right clicking in the exact center of the axis and selecting mirror, what I see is exactly the mirror copy.
Then I save it and open it again and the custom pad shapes are all in the wrong place and not aligned anymore.
I am trying to figure out what is going wrong, but I am having a hard time on that.

For reference I post one of the offending custom pads in the following.

The original:

  (pad ~ smd custom (at 28.6745 -22.934) (size 0.5 0.5) (layers F.Cu)
    (zone_connect 0)
    (options (clearance outline) (anchor circle))
    (primitives
      (gr_line (start 0.28988 6.03002) (end -7.48989 -2.64001) (width 3))
      (gr_line (start -49.92998 48.35988) (end -7.48989 48.35988) (width 3))
      (gr_line (start -7.48989 -2.64001) (end -49.92998 -2.64001) (width 3))
      (gr_line (start -7.48989 48.35988) (end -3.20999 44.07998) (width 3))
      (gr_line (start -6.04005 -6.13988) (end -51.38007 -6.13988) (width 3))
      (gr_line (start -57.71 45.53007) (end -51.38007 51.86) (width 3))
      (gr_line (start -51.38007 51.86) (end -6.04005 51.86) (width 3))
      (gr_line (start -3.20999 44.07998) (end -3.20999 7.48011) (width 3))
      (gr_line (start -49.92998 -2.64001) (end -54.20988 1.63989) (width 3))
      (gr_line (start -7.513 7.48112) (end -3.20999 7.48011) (width 3))
      (gr_line (start -57.71 0.19005) (end -57.71 45.53007) (width 3))
      (gr_line (start -51.38007 -6.13988) (end -57.71 0.19005) (width 3))
      (gr_line (start -54.20988 44.07998) (end -49.92998 48.35988) (width 3))
      (gr_line (start -54.20988 1.63989) (end -54.20988 44.07998) (width 3))
      (gr_line (start -6.04005 51.86) (end 0.28988 45.53007) (width 3))
      (gr_line (start 0.28988 0.19005) (end -6.04005 -6.13988) (width 3))
      (gr_line (start 0.28988 45.53007) (end 0.28988 6.03002) (width 3))
    ))

and the mirrored version

  (pad ~ smd custom (at -28.6745 -22.934) (size 0.5 0.5) (layers F.Cu)
    (zone_connect 0)
    (options (clearance outline) (anchor circle))
    (primitives
      (gr_line (start -57.63888 6.03002) (end -49.85911 -2.64001) (width 3))
      (gr_line (start -7.41902 48.35988) (end -49.85911 48.35988) (width 3))
      (gr_line (start -49.85911 -2.64001) (end -7.41902 -2.64001) (width 3))
      (gr_line (start -49.85911 48.35988) (end -54.13901 44.07998) (width 3))
      (gr_line (start -51.30895 -6.13988) (end -5.96893 -6.13988) (width 3))
      (gr_line (start 0.361 45.53007) (end -5.96893 51.86) (width 3))
      (gr_line (start -5.96893 51.86) (end -51.30895 51.86) (width 3))
      (gr_line (start -54.13901 44.07998) (end -54.13901 7.48011) (width 3))
      (gr_line (start -7.41902 -2.64001) (end -3.13912 1.63989) (width 3))
      (gr_line (start -49.836 7.48112) (end -54.13901 7.48011) (width 3))
      (gr_line (start 0.361 0.19005) (end 0.361 45.53007) (width 3))
      (gr_line (start -5.96893 -6.13988) (end 0.361 0.19005) (width 3))
      (gr_line (start -3.13912 44.07998) (end -7.41902 48.35988) (width 3))
      (gr_line (start -3.13912 1.63989) (end -3.13912 44.07998) (width 3))
      (gr_line (start -51.30895 51.86) (end -57.63888 45.53007) (width 3))
      (gr_line (start -57.63888 0.19005) (end -51.30895 -6.13988) (width 3))
      (gr_line (start -57.63888 45.53007) (end -57.63888 6.03002) (width 3))
    ))

From those two I can see that the anchor is flipped around the zero (as I mirrored in the center of the axes) but there should be something wrong with the gr_line coordinates.

Am I doing something wrong or is this a known bug?
Thanks, Alex


Added this as a textfile as the upload was not working for some reason

(module foo (layer F.Cu) (tedit 5DD66039)
  (fp_text reference REF** (at -0.3055 -12.854) (layer F.SilkS)
    (effects (font (size 1 1) (thickness 0.15)))
  )
  (fp_text value 106 (at -0.3555 -15.474) (layer F.Fab)
    (effects (font (size 1 1) (thickness 0.15)))
  )
  (fp_poly (pts (xy 18.8845 -20.714) (xy 18.8845 -17.714) (xy 19.9845 -17.714) (xy 19.9845 -20.714)) (layer F.Cu) (width 0))
  (fp_poly (pts (xy 18.8645 -16.954) (xy 18.8645 -13.954) (xy 21.1545 -13.954) (xy 21.1545 -16.954)) (layer F.Cu) (width 0))
  (pad ~ thru_hole circle (at 28.9645 -24.024 180) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 29.5645 -22.844 180) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 30.1645 -22.844 180) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 27.7645 -22.844 180) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 29.5645 -22.244 180) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 28.9645 -22.244 180) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 29.5645 -21.644 180) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 28.9645 -21.644 180) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 28.3645 -21.644 180) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 28.9645 -22.844 180) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 28.3645 -22.244 180) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 28.3645 -22.844 180) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 27.7645 -22.244 180) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 30.1445 -22.244 180) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 28.3645 -23.444 180) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 29.5645 -23.444 180) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 28.9645 -23.444 180) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ smd custom (at 21.0945 -19.094) (size 0.5 0.5) (layers F.Cu F.Paste F.Mask)
    (zone_connect 0)
    (options (clearance outline) (anchor circle))
    (primitives
      (gr_poly (pts
         (xy -1.46 -1.62) (xy -1.46 1.38) (xy 1.536 1.38) (xy 1.536 -1.62)) (width 0))
    ))
  (pad 2 smd rect (at 16.1845 -15.444) (size 6 3) (layers F.Cu F.Paste F.Mask))
  (pad 1 smd rect (at 16.1845 -19.214) (size 6 3) (layers F.Cu F.Paste F.Mask))
  (pad ~ thru_hole circle (at 21.7345 -18.624) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 21.1345 -18.624) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 20.5345 -18.624) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 22.3345 -19.224) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 21.7345 -19.224) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 21.1345 -19.224) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 20.5345 -19.224) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 19.9345 -19.224) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 22.3345 -19.824) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 21.7345 -19.824) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 21.1345 -19.824) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 20.5345 -19.824) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 19.9345 -19.824) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 22.3345 -20.424) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 21.7345 -20.424) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 21.1345 -20.424) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 20.5345 -20.424) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ thru_hole circle (at 19.9345 -20.424) (size 0.4 0.4) (drill 0.3) (layers *.Cu))
  (pad ~ smd custom (at 28.6745 -22.934) (size 0.5 0.5) (layers F.Cu)
    (zone_connect 0)
    (options (clearance outline) (anchor circle))
    (primitives
      (gr_line (start 0.28988 6.03002) (end -7.48989 -2.64001) (width 3))
      (gr_line (start -49.92998 48.35988) (end -7.48989 48.35988) (width 3))
      (gr_line (start -7.48989 -2.64001) (end -49.92998 -2.64001) (width 3))
      (gr_line (start -7.48989 48.35988) (end -3.20999 44.07998) (width 3))
      (gr_line (start -6.04005 -6.13988) (end -51.38007 -6.13988) (width 3))
      (gr_line (start -57.71 45.53007) (end -51.38007 51.86) (width 3))
      (gr_line (start -51.38007 51.86) (end -6.04005 51.86) (width 3))
      (gr_line (start -3.20999 44.07998) (end -3.20999 7.48011) (width 3))
      (gr_line (start -49.92998 -2.64001) (end -54.20988 1.63989) (width 3))
      (gr_line (start -7.513 7.48112) (end -3.20999 7.48011) (width 3))
      (gr_line (start -57.71 0.19005) (end -57.71 45.53007) (width 3))
      (gr_line (start -51.38007 -6.13988) (end -57.71 0.19005) (width 3))
      (gr_line (start -54.20988 44.07998) (end -49.92998 48.35988) (width 3))
      (gr_line (start -54.20988 1.63989) (end -54.20988 44.07998) (width 3))
      (gr_line (start -6.04005 51.86) (end 0.28988 45.53007) (width 3))
      (gr_line (start 0.28988 0.19005) (end -6.04005 -6.13988) (width 3))
      (gr_line (start 0.28988 45.53007) (end 0.28988 6.03002) (width 3))
    ))
  (pad ~ smd custom (at 21.1645 -18.804) (size 0.5 0.5) (layers B.Cu)
    (zone_connect 0)
    (options (clearance outline) (anchor circle))
    (primitives
      (gr_line (start -42.41998 -6.77001) (end 0.02011 -6.77001) (width 3))
      (gr_line (start 0.02011 44.22988) (end -42.41998 44.22988) (width 3))
      (gr_line (start -0.03551 -0.40223) (end -0.02891 -6.73496) (width 3))
      (gr_line (start -42.41998 44.22988) (end -46.69988 39.94998) (width 3))
      (gr_line (start -43.87007 47.73) (end -50.2 41.40007) (width 3))
      (gr_line (start 1.46995 47.73) (end -43.87007 47.73) (width 3))
      (gr_line (start -46.69988 39.94998) (end -46.69988 -2.49011) (width 3))
      (gr_line (start -50.2 41.40007) (end -50.2 -3.93995) (width 3))
      (gr_line (start -46.69988 -2.49011) (end -42.41998 -6.77001) (width 3))
      (gr_line (start -50.2 -3.93995) (end -43.87007 -10.26988) (width 3))
      (gr_line (start 1.46995 -10.26988) (end 4.30001 -7.44007) (width 3))
      (gr_line (start 7.79988 41.40007) (end 1.46995 47.73) (width 3))
      (gr_line (start 4.30001 -7.44007) (end 4.30001 39.94998) (width 3))
      (gr_line (start 7.79988 -3.93995) (end 7.79988 41.40007) (width 3))
      (gr_line (start 4.30001 39.94998) (end 0.02011 44.22988) (width 3))
      (gr_line (start -43.87007 -10.26988) (end 1.46995 -10.26988) (width 3))
    ))
)

Hi Alex,

The file you sent cannot be download, I guess due to some forum issues. Please try wit a zipped file

I added the file as a textfile because I cannot make the upload to work, sorry.

Doing the transformation by hand it worked

  • reference point with x coordinate multiplied by -1
  • every point’s x coordinate multiplied by -1

I think the bug is the mirror function then.

May be you found this:

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.