Commit 5a6665ec authored by Cirilo Bernardo's avatar Cirilo Bernardo Committed by jean-pierre charras
Browse files

Dxf import fix (patch from Cirilo Bernardo, with a minor change)

parent 9ef56278
Loading
Loading
Loading
Loading
+4 −17
Original line number Diff line number Diff line
@@ -52,7 +52,6 @@ DXF2BRD_CONVERTER::DXF2BRD_CONVERTER() : DRW_Interface()
    m_xOffset   = 0.0;      // X coord offset for conversion (in mm)
    m_yOffset   = 0.0;      // Y coord offset for conversion (in mm)
    m_Dfx2mm    = 1.0;      // The scale factor to convert DXF units to mm
    m_dxf       = NULL;
    m_brd       = NULL;
    m_version   = 0;
    m_defaultThickness = 0.1;
@@ -84,28 +83,16 @@ int DXF2BRD_CONVERTER::mapDim( double aDxfValue )
}


/**
 * Implementation of the method used for communicate
 * with this filter.
 *
 * @param aFile = the full filename.
 * @param aLayersList = where to store the list of layer names
 */
bool DXF2BRD_CONVERTER::ImportDxfFile( const wxString& aFile, BOARD* aBoard )
{
    m_brd = aBoard;

    m_dxf = new dxfRW( aFile.ToUTF8() );
    bool success = m_dxf->read( this, true );
    dxfRW* dxf = new dxfRW( aFile.ToUTF8() );
    bool success = dxf->read( this, true );

    if( success==false )
    {
        return false;
    }
    delete dxf;

    delete m_dxf;
    m_dxf = NULL;
    return true;
    return success;
}

// Add aItem the the board
+7 −2
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@
#include "drw_interface.h"
#include "wx/wx.h"

class dxfRW;
class BOARD;
class BOARD_ITEM;

@@ -54,7 +53,6 @@ private:
    int    m_brdLayer;      // The board layer to place imported dfx items
    int m_version;          // the dxf version, not used here
    std::string m_codePage; // The code page, not used here
    dxfRW* m_dxf;           // the dxf reader

public:
    DXF2BRD_CONVERTER();
@@ -80,6 +78,13 @@ public:
     */
    void SetBrdLayer( int aBrdLayer ) { m_brdLayer = aBrdLayer; }

    /**
     * Implementation of the method used for communicate
     * with this filter.
     *
     * @param aFile = the full filename.
     * @param aBoard = where to store the graphical items and text
     */
    bool ImportDxfFile(  const wxString& aFile, BOARD * aBoard );

    /**