← Back to team overview

kicad-developers team mailing list archive

Importing DXF polygons in pcbnew vs. footprint editor

 

I am experimenting some more with importing DXF files into pcbnew and the footprint editor as a filled polygon and I have added some code to DXF2BRD_CONVERTER::addPolyline() to do that so like so:

{
        DRAWSEGMENT* poly = new DRAWSEGMENT( NULL );

        std::vector <wxPoint> pts;
        for( unsigned ii = 0; ii < aData.vertlist.size(); ii++ )
        {
            DRW_Vertex* vertex = aData.vertlist[ii];
            pts.push_back( wxPoint( mapX( vertex->basePoint.x ),
                                    mapY( vertex->basePoint.y ) ) );
        }
        poly->SetType( PCB_ZONE_T );
        poly->SetShape( S_POLYGON );
        poly->SetLayer( ToLAYER_ID( m_brdLayer ) );
        poly->SetWidth( mapDim( 0.001 ) );
        poly->SetPolyPoints( pts );

        m_newItemsList.push_back( poly );
}

This works in pcbnew and an imported polygon shape comes out in the pcb file as:

(gr_poly (pts (xy 40 -1) (xy 40 0) (xy 50 0) (xy 50 -11) (xy 46 -11) (xy 46 -12) (xy 50 -12) (xy 50 -15) (xy 46 -15) (xy 46 -16) (xy 50 -16) (xy 50 -20) (xy 45 -20) (xy 45 -18) (xy 49 -18) (xy 49 -17) (xy 45 -17) (xy 45 -14) (xy 49 -14) (xy 49 -13) (xy 45 -13) (xy 45 -10) (xy 49 -10) (xy 49 -8) (xy 40 -8) (xy 40 -7) (xy 49 -7) (xy 49 -1)) (layer F.Cu) (width 0.001))

However, doing the same in the footprint editor, nothings shows up, but when I save the footprint it has the following:

(fp_poly (pts) (layer F.Cu) (width 0.001))

So a fp_poly but with the XY points missing.

Anybody any idea where this is going wrong in the import. I can see some differences (not pretending I fully understand them) between InvokeDXFDialogBoardImport and InvokeDXFDialogModuleImport but I think the problem seems to be much deeper.

Any pointers?

Marco