← Back to team overview

kicad-developers team mailing list archive

Re: DXF import only works in default Canvas.

 

Hi Marco,
would you post the patch, so to try it?
(could you zip it?)

thank you
Maurice

On 29/07/2015 12.25, Marco Hess wrote:
Sorry Nick,

I could have worded that better. I am working on making the DXF import
as an area.
So I have a modified version of dxf2brd_items that in addPolyline
detects that
a 'fill_polygon' flag is set (in the modified dxfimport dialog) and when
the DXF is
then a closed polygon, it imports the poly as a PCB_ZONE_T and an S_POLYGON
shape (which I assume is the right type and shape).

Like this:

     // Closed polyline can be imported as a filled area when this
     // selected in the import dialog box.
     if( ( aData.flags & 1 ) && m_fillPolygons )
     {
         DRAWSEGMENT* poly = new DRAWSEGMENT( NULL );

         wxPoint startpoint;
         wxPoint polypoint;

         std::vector <wxPoint> pts;
         for( unsigned ii = 0; ii < aData.vertlist.size(); ii++ )
         {
             DRW_Vertex* vertex = aData.vertlist[ii];
             polypoint = wxPoint( mapX( vertex->basePoint.x ),
                                  mapY( vertex->basePoint.y ) );
             // Remember start point
             if( ii == 0 )
             {
                 startpoint = polypoint;
             }
             pts.push_back( polypoint );
         }

         // Close polygon back to the start point
         pts.push_back( startpoint );

         poly->SetType( PCB_ZONE_T );
         poly->SetShape( S_POLYGON );
         poly->SetLayer( ToLAYER_ID( m_brdLayer ) );
         poly->SetWidth( mapDim( 0.0001 ) );
         poly->SetPolyPoints( pts );

         m_newItemsList.push_back( poly );
     }
     else
             .....

This will result in a 'gr_poly' in pcbnew with the issues described of
importing only in
legacy mode and only showing in GL mode.

In the footprint editor this import results in an 'fp_poly' but will al
the points missing
in the footprint file. As yet I have not been able to track what the
issue there is.

So the DXF area import is not really ready for prime time as yet. My aim
is to eventually
import complex copper shapes like antennas onto the board from a DXF.

But the DXF import only working in legacy mode and not in the other
modes is a
definitely a bug I think.

Marco



Follow ups

References