Exporting polygon to dxf

Is there a way to extract just the outline of the polygon that is created when you do a pour?
I can export to dxf the entire layer but then I have to delete all the tracks, footprints and other stuff.

As a quick test I just created a simple copper zone:

Then selected it, copied it, and pasted it in a text editor, and the result looks like:

  (zone (net 35) (net_name "+5V") (layer "F.Cu") (tstamp 260e7c1c-5b26-4c11-bb61-6fcae20c7bf2) (hatch edge 0.508)
    (connect_pads (clearance 0.3))
    (min_thickness 0.254)
    (fill (thermal_gap 0.508) (thermal_bridge_width 0.508))
    (polygon
      (pts
        (xy 5.009728 6.455642)
        (xy -4.690272 6.355642)
        (xy -4.090272 0.255642)
        (xy 5.509728 -0.344358)
      )
    )
  )

In a “real” application it would be a bit more complicated then this. The copy & Paste operation also pasted all layer names and all net names into the text file, but I did not post those here.

If there is any sort of cutout (such as for via’s or pads) in the zone, then KiCad creates a lot of internal geometry for the zone.

The pasted text is in the form of an S-expression, and this is a fairly common data format and I suppose most scripting languages have a library for handling this format.

Is there a way to extract just the outline of the polygon that is created when you do a pour?

currently not directly as dxf.
workaround (assumed the zone is on top-copper layer):

  • make sure board is complete, refill the zone a last time, save board
  • CTRL+A to select all items on the board
  • with Shift+CTRL+LMB-click remove the zone in question from the selection
  • Delete all items, only the unselected zone remains
  • File–>Plot -->DXF , with only Top-copper-layer enabled.
    You get a question “zone fill not up-to-date – refilling?”. click “NO” to get the shape of the old copper-pour.
  • close board editor and than reopen board-editor (to get rid of the delete-action)

This results in a dxf-file with the complete copper-pour, without additional pads+tracks.

Thanks, that will work for me, don’t have to do it very often so don’t need to automate it.