← Back to team overview

kicad-developers team mailing list archive

Re: dxf: import 4 arcs

 

I 'rewrote' the DXF R12 conversion procedure for the manual as follows.

I checked it like this and this works with the original DXF file from Marcos.

Does this reflect the general understanding?

==== Notes on importing DXF files

The *DXF* import capability in KiCad is limited as there is no support
for 'advanced' shapes like *POLYLINES* and *ELLIPSIS*. For best results,
*POLYLINES* need to be broken into their original simpler shapes and
*ELLIPSIS* and other advanced curve shapes need to be converted into a
series of short line segments to approximate the shape.

That an entity in a DXF drawing is a *POLYLINE* , can be noted in
LibreCAD when you try to select the shape and the whole shape
consisting of multiple curves and lines gets selected as one.

To break up such a *POLYLINES*, use LibreCAD as follows:
. Ensure you leave the *POLYLINE* *unselected*.
. In the 'Modify' menu, select 'Explode'
. Click on the *POLYLINE* to select.
. Press ENTER.
. Click on parts of the original shape and notice that you can
  select/un-select individual segments of the shape.

The conversion of the complex curves like *ELLIPSIS* can now be achieved
by simply exporting the DXF drawing to the 'old' *DXF R12* file format.
This format does not support shapes like *ELLIPSIS* and exporting to the
*DXF R12* format 'forces' the CAD software to 'approximate' the shape with
line segments that can then be successfully imported into KiCad.

With the DXF open in LibreCAD, export to the *DXF R12* format as follows:
. In the 'File' menu, use 'Save As...'
. Towards the bottom of 'Save Drawing As' dialog, select
  'Drawing Exchange DXF R12 (*.dxf)' in the 'Save as type:' selection.
. Enter a different file name, if you like to preserve your original DXF file.

Here is an example of an DXF import with a board that had several
elliptical segments approximated by a number of short line segments:

image:images/Pcbnew_board_outline_imported_from_a_DXF.png[]





On 09-Sep-15 23:01, Marcos Chaparro wrote:
Thanks a lot Maurice,
so the solution for a complex outline is to draw it directly in librecad. Its good to know that exporting to R12 is not bulletproof. I don't see exporting upgrades coming into freecad, or polyline support coming into kicad either.

As Cirilo told us, it seems reasonable to me that the mcad could reduce the representation to a more complex (and simpler at the same time) representation.

A 'cheap' improvement would be to add a warning in the import dialog saying "polyline not supported". It would narrow down the problem for the user, right now all the feedback we have is a shape with lines instead of arcs.

Its interesting that it doesn't totally fail, the import actually manages to draw lines with the correct start/finish points, it only loses angle information, see attached.


Marcos

On Wed, Sep 9, 2015 at 6:24 AM, easyw <easyw@xxxxxxxxxxxx <mailto:easyw@xxxxxxxxxxxx>> wrote:

    Hi Marcos and Marco,

    please find attached the dxf that I did from scratch using 4 arcs
    in LibreCAD
    I copied manually the path from palta2.dxf, then exported in dxf R12
    The result is fine in kicad and I get a closed path also for Edge
    cuts.

    in kicad there are 4 arcs
      (gr_arc (start 178.564202 123.937945) (end 153.273203 83.107373)
    (angle -26.04011298) (layer Edge.Cuts) (width 0.1))
      (gr_arc (start 156.68577 88.642784) (end 162.837792 90.749678)
    (angle -140.5586133) (layer Edge.Cuts) (width 0.1))
      (gr_arc (start 196.246745 102.229265) (end 162.837792 90.749678)
    (angle -22.2858684) (layer Edge.Cuts) (width 0.1))
      (gr_arc (start 148.500893 105.004408) (end 137.915937 98.354967)
    (angle -215.4739741) (layer Edge.Cuts) (width 0.1))

    If you search inside palta2.dxf you find POLYLINE that are not
    supported by kicad

    attached a comparison of dxf files

    I suspect that the problem is when exporting dxf from FreeCAD...
    I had some trouble with a different board path exported from
    FreeCAD...
    In FreeCAD you cannot select which version of dxf you want to use,
    if I remember correctly...

    Maurice








    On 09/09/2015 07.43, Marco Hess wrote:

        Definitely a problem with the DXF importer I would say as the
        resulting
        data in the PCB file are just  straight line segments:

           (gr_line (start 42.68541 28.017695) (end 52.25 35.66) (layer
        Edge.Cuts) (width 0.1))
           (gr_line (start 27.328145 43.265288) (end 42.68541
        28.017695) (layer
        Edge.Cuts) (width 0.1))
           (gr_line (start 50.392159 49.187096) (end 27.328145
        43.265288) (layer
        Edge.Cuts) (width 0.1))
           (gr_line (start 52.25 35.66) (end 50.392159 49.187096) (layer
        Edge.Cuts) (width 0.1))

        Marco

        On 09-Sep-15 14:58, Marco Hess wrote:

            Hi Marcos,

            Apologies, but I did not see your original email where you
            said you
            tried the R12 format alreayd.

            I tried it as well and and it indeed seems to do something
            strange
            with just connecting the end points of the circles or
            something.

            Regards,

            Marco

            On 09-Sep-15 14:29, Marco Hess wrote:

                KiCad DXF import for those kind of segments don't work
                very well. You
                need to re-export the DXF in a DXF R12 format.

                You can do that easily by opening the DXF in LibreCAD
                and then
                reexporting in R12 format.

                See
                http://docs.kicad-pcb.org/Pcbnew/Pcbnew.html#_creating_a_board

                Section 6.1.2 and 6.1.3.

                Cheers,

                Marco


                On 09-Sep-15 14:24, Marcos Chaparro wrote:


                            Seems that is kind of Berzier Curve, not
                    few arcs. Probably
                            that shape needs to

                        split to single arcs before import.


                    Um, I don't know if its converted to a bezier
                    curve, but I'm sure I
                    made it from 4 arcs, see attached.


                    _______________________________________________
                    Mailing
                    list:https://launchpad.net/~kicad-developers
                    <https://launchpad.net/%7Ekicad-developers>
                    Post to     :kicad-developers@xxxxxxxxxxxxxxxxxxx
                    <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
                    Unsubscribe
                    :https://launchpad.net/~kicad-developers
                    <https://launchpad.net/%7Ekicad-developers>
                    More help   :https://help.launchpad.net/ListHelp


                --
                Marco Hess
                Through IP Pty. Ltd. - AUSTRALIA
                www.through-ip.com <http://www.through-ip.com>
                 |marco.hess@xxxxxxxxxxxxxx
                <mailto:marco.hess@xxxxxxxxxxxxxx>
                p: +61 407 78 55 66 | f: +61 8 8121 6191


                _______________________________________________
                Mailing list:https://launchpad.net/~kicad-developers
                <https://launchpad.net/%7Ekicad-developers>
                Post to     :kicad-developers@xxxxxxxxxxxxxxxxxxx
                <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
                Unsubscribe :https://launchpad.net/~kicad-developers
                <https://launchpad.net/%7Ekicad-developers>
                More help   :https://help.launchpad.net/ListHelp




            _______________________________________________
            Mailing list:https://launchpad.net/~kicad-developers
            <https://launchpad.net/%7Ekicad-developers>
            Post to     :kicad-developers@xxxxxxxxxxxxxxxxxxx
            <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
            Unsubscribe :https://launchpad.net/~kicad-developers
            <https://launchpad.net/%7Ekicad-developers>
            More help   :https://help.launchpad.net/ListHelp


        --
        Marco Hess
        Through IP Pty. Ltd. - AUSTRALIA
www.through-ip.com <http://www.through-ip.com> |marco.hess@xxxxxxxxxxxxxx <mailto:marco.hess@xxxxxxxxxxxxxx>
        p: +61 407 78 55 66 | f: +61 8 8121 6191



        _______________________________________________
        Mailing list: https://launchpad.net/~kicad-developers
        <https://launchpad.net/%7Ekicad-developers>
        Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
        <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
        Unsubscribe : https://launchpad.net/~kicad-developers
        <https://launchpad.net/%7Ekicad-developers>
        More help   : https://help.launchpad.net/ListHelp


    _______________________________________________
    Mailing list: https://launchpad.net/~kicad-developers
    <https://launchpad.net/%7Ekicad-developers>
    Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
    <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
    Unsubscribe : https://launchpad.net/~kicad-developers
    <https://launchpad.net/%7Ekicad-developers>
    More help   : https://help.launchpad.net/ListHelp




_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp

--
Marco Hess
Through IP Pty. Ltd. - AUSTRALIA
www.through-ip.com  | marco.hess@xxxxxxxxxxxxxx
p: +61 407 78 55 66 | f: +61 8 8121 6191


References