Loading include/wxBasePcbFrame.h +0 −1 Original line number Original line Diff line number Diff line Loading @@ -80,7 +80,6 @@ public: FOOTPRINT_EDIT_FRAME* m_ModuleEditFrame; FOOTPRINT_EDIT_FRAME* m_ModuleEditFrame; protected: protected: // EDA_RECT m_BoundaryBox; // Board size and position BOARD* m_Pcb; BOARD* m_Pcb; GENERAL_COLLECTOR* m_Collector; GENERAL_COLLECTOR* m_Collector; Loading pcbnew/export_gencad.cpp +298 −275 Original line number Original line Diff line number Diff line Loading @@ -96,7 +96,7 @@ static const wxString GenCADLayerNameFlipped[32] = static int GencadOffsetX, GencadOffsetY; static int GencadOffsetX, GencadOffsetY; /* GerbTool chokes on units different than INCH so this is the conversion /* GerbTool chokes on units different than INCH so this is the conversion factor */ * factor */ const static double SCALE_FACTOR = 10000.0; const static double SCALE_FACTOR = 10000.0; Loading @@ -108,11 +108,13 @@ static double MapXTo( int aX ) return (aX - GencadOffsetX) / SCALE_FACTOR; return (aX - GencadOffsetX) / SCALE_FACTOR; } } static double MapYTo( int aY ) static double MapYTo( int aY ) { { return (GencadOffsetY - aY) / SCALE_FACTOR; return (GencadOffsetY - aY) / SCALE_FACTOR; } } /* Driver function: processing starts here */ /* Driver function: processing starts here */ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent ) void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent ) { { Loading Loading @@ -170,8 +172,8 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent ) } } /* Gencad has some mandatory and some optional sections: some importer /* Gencad has some mandatory and some optional sections: some importer need the padstack section (which is optional) anyway. Also the * need the padstack section (which is optional) anyway. Also the order of the section *is* important */ * order of the section *is* important */ CreateHeaderInfoData( file, this ); // Gencad header CreateHeaderInfoData( file, this ); // Gencad header CreateBoardSection( file, pcb ); // Board perimeter CreateBoardSection( file, pcb ); // Board perimeter Loading @@ -180,8 +182,8 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent ) CreateArtworksSection( file ); // Empty but mandatory CreateArtworksSection( file ); // Empty but mandatory /* Gencad splits a component info in shape, component and device. /* Gencad splits a component info in shape, component and device. We don't do any sharing (it would be difficult since each module is * We don't do any sharing (it would be difficult since each module is customizable after placement) */ * customizable after placement) */ CreateShapesSection( file, pcb ); CreateShapesSection( file, pcb ); CreateComponentsSection( file, pcb ); CreateComponentsSection( file, pcb ); CreateDevicesSection( file, pcb ); CreateDevicesSection( file, pcb ); Loading @@ -205,6 +207,7 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent ) } } } } // Comparator for sorting pads with qsort // Comparator for sorting pads with qsort static int PadListSortByShape( const void* aRefptr, const void* aObjptr ) static int PadListSortByShape( const void* aRefptr, const void* aObjptr ) { { Loading @@ -214,6 +217,7 @@ static int PadListSortByShape( const void* aRefptr, const void* aObjptr ) return D_PAD::Compare( padref, padcmp ); return D_PAD::Compare( padref, padcmp ); } } // Sort vias for uniqueness // Sort vias for uniqueness static int ViaSort( const void* aRefptr, const void* aObjptr ) static int ViaSort( const void* aRefptr, const void* aObjptr ) { { Loading @@ -232,6 +236,7 @@ static int ViaSort(const void* aRefptr, const void* aObjptr ) return 0; return 0; } } // The ARTWORKS section is empty but (officially) mandatory // The ARTWORKS section is empty but (officially) mandatory static void CreateArtworksSection( FILE* aFile ) static void CreateArtworksSection( FILE* aFile ) { { Loading @@ -240,6 +245,7 @@ static void CreateArtworksSection( FILE* aFile ) fputs( "$ENDARTWORKS\n\n", aFile ); fputs( "$ENDARTWORKS\n\n", aFile ); } } // Emit PADS and PADSTACKS. They are sorted and emitted uniquely. // Emit PADS and PADSTACKS. They are sorted and emitted uniquely. // Via name is synthesized from their attributes, pads are numbered // Via name is synthesized from their attributes, pads are numbered static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) Loading Loading @@ -273,6 +279,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) vias.push_back( track ); vias.push_back( track ); } } } } qsort( &vias[0], vias.size(), sizeof(TRACK*), ViaSort ); qsort( &vias[0], vias.size(), sizeof(TRACK*), ViaSort ); // Emit vias pads // Emit vias pads Loading Loading @@ -331,6 +338,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) case PAD_RECT: case PAD_RECT: fprintf( aFile, " RECTANGULAR %g\n", fprintf( aFile, " RECTANGULAR %g\n", pad->m_Drill.x / SCALE_FACTOR ); pad->m_Drill.x / SCALE_FACTOR ); // Rectangle is begin, size *not* begin, end! // Rectangle is begin, size *not* begin, end! fprintf( aFile, "RECTANGLE %g %g %g %g\n", fprintf( aFile, "RECTANGLE %g %g %g %g\n", (-dx + pad->m_Offset.x ) / SCALE_FACTOR, (-dx + pad->m_Offset.x ) / SCALE_FACTOR, Loading @@ -353,6 +361,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) (-pad->m_Offset.y - radius) / SCALE_FACTOR, (-pad->m_Offset.y - radius) / SCALE_FACTOR, (dr + pad->m_Offset.x ) / SCALE_FACTOR, (dr + pad->m_Offset.x ) / SCALE_FACTOR, (-pad->m_Offset.y - radius) / SCALE_FACTOR ); (-pad->m_Offset.y - radius) / SCALE_FACTOR ); // GenCAD arcs are (start, end, center) // GenCAD arcs are (start, end, center) fprintf( aFile, "ARC %g %g %g %g %g %g\n", fprintf( aFile, "ARC %g %g %g %g %g %g\n", (dr + pad->m_Offset.x) / SCALE_FACTOR, (dr + pad->m_Offset.x) / SCALE_FACTOR, Loading Loading @@ -411,10 +420,12 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) case PAD_TRAPEZOID: case PAD_TRAPEZOID: fprintf( aFile, " POLYGON %g\n", fprintf( aFile, " POLYGON %g\n", pad->m_Drill.x / SCALE_FACTOR ); pad->m_Drill.x / SCALE_FACTOR ); // XXX TO BE IMPLEMENTED! and I don't know if it could be actually imported by something // XXX TO BE IMPLEMENTED! and I don't know if it could be actually imported by something break; break; } } } } fputs( "\n$ENDPADS\n\n", aFile ); fputs( "\n$ENDPADS\n\n", aFile ); // Now emit the padstacks definitions, using the combined layer masks // Now emit the padstacks definitions, using the combined layer masks Loading @@ -440,11 +451,12 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) } } } } } } /* Component padstacks /* Component padstacks CAM350 don't apply correctly the FLIP semantics for padstacks, i.e. doesn't * CAM350 don't apply correctly the FLIP semantics for padstacks, i.e. doesn't swap the top and bottom layers... so I need to define the shape as MIRRORX * swap the top and bottom layers... so I need to define the shape as MIRRORX and define a separate 'flipped' padstack... until it appears yet another * and define a separate 'flipped' padstack... until it appears yet another noncompliant importer */ * noncompliant importer */ for( unsigned i = 1; i < padstacks.size(); i++ ) for( unsigned i = 1; i < padstacks.size(); i++ ) { { D_PAD* pad = padstacks[i]; D_PAD* pad = padstacks[i]; Loading Loading @@ -473,6 +485,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) } } } } } } fputs( "$ENDPADSTACKS\n\n", aFile ); fputs( "$ENDPADSTACKS\n\n", aFile ); } } Loading @@ -499,10 +512,10 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb ) for( pad = module->m_Pads; pad != NULL; pad = pad->Next() ) for( pad = module->m_Pads; pad != NULL; pad = pad->Next() ) { { /* Funny thing: GenCAD requires the pad side even if you use /* Funny thing: GenCAD requires the pad side even if you use padstacks (which are theorically optional but gerbtools * padstacks (which are theorically optional but gerbtools *requires* them). Now the trouble thing is that 'BOTTOM' *requires* them). Now the trouble thing is that 'BOTTOM' is interpreted by someone as a padstack flip even * is interpreted by someone as a padstack flip even if the spec explicitly says it's not... */ * if the spec explicitly says it's not... */ layer = "ALL"; layer = "ALL"; if( ( pad->m_layerMask & ALL_CU_LAYERS ) == LAYER_BACK ) if( ( pad->m_layerMask & ALL_CU_LAYERS ) == LAYER_BACK ) Loading Loading @@ -536,6 +549,7 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb ) fputs( "$ENDSHAPES\n\n", aFile ); fputs( "$ENDSHAPES\n\n", aFile ); } } /* Creates the section $COMPONENTS (Footprints placement) /* Creates the section $COMPONENTS (Footprints placement) * Bottom side components are difficult to handle: shapes must be mirrored or * Bottom side components are difficult to handle: shapes must be mirrored or * flipped, silk layers need to be handled correctly and so on. Also it seems * flipped, silk layers need to be handled correctly and so on. Also it seems Loading @@ -543,7 +557,6 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb ) */ */ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb ) static void CreateComponentsSection( FILE* aFile, BOARD* aPcb ) { { fputs( "$COMPONENTS\n", aFile ); fputs( "$COMPONENTS\n", aFile ); for( MODULE* module = aPcb->m_Modules; module != NULL; module = module->Next() ) for( MODULE* module = aPcb->m_Modules; module != NULL; module = module->Next() ) Loading Loading @@ -617,6 +630,7 @@ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb ) fputs( "$ENDCOMPONENTS\n\n", aFile ); fputs( "$ENDCOMPONENTS\n\n", aFile ); } } /* Emit the netlist (which is actually the thing for which GenCAD is used these /* Emit the netlist (which is actually the thing for which GenCAD is used these * days!); tracks are handled later */ * days!); tracks are handled later */ static void CreateSignalsSection( FILE* aFile, BOARD* aPcb ) static void CreateSignalsSection( FILE* aFile, BOARD* aPcb ) Loading Loading @@ -702,6 +716,7 @@ static bool CreateHeaderInfoData( FILE* aFile, PCB_EDIT_FRAME* aFrame ) return true; return true; } } /* /* * Sort function used to sort tracks segments: * Sort function used to sort tracks segments: * items are sorted by netcode, then by width then by layer * items are sorted by netcode, then by width then by layer Loading Loading @@ -845,6 +860,7 @@ static void CreateDevicesSection( FILE* aFile, BOARD* aPcb ) fprintf( aFile, "DEVICE \"%s\"\n", TO_UTF8( module->m_Reference->m_Text ) ); fprintf( aFile, "DEVICE \"%s\"\n", TO_UTF8( module->m_Reference->m_Text ) ); fprintf( aFile, "PART \"%s\"\n", TO_UTF8( module->m_Value->m_Text ) ); fprintf( aFile, "PART \"%s\"\n", TO_UTF8( module->m_Value->m_Text ) ); fprintf( aFile, "PACKAGE \"%s\"\n", TO_UTF8( module->m_LibRef ) ); fprintf( aFile, "PACKAGE \"%s\"\n", TO_UTF8( module->m_LibRef ) ); // The TYPE attribute is almost freeform // The TYPE attribute is almost freeform const char* ty = "TH"; const char* ty = "TH"; if( module->m_Attributs & MOD_CMS ) if( module->m_Attributs & MOD_CMS ) Loading @@ -864,6 +880,7 @@ static void CreateDevicesSection( FILE* aFile, BOARD* aPcb ) static void CreateBoardSection( FILE* aFile, BOARD* aPcb ) static void CreateBoardSection( FILE* aFile, BOARD* aPcb ) { { fputs( "$BOARD\n", aFile ); fputs( "$BOARD\n", aFile ); // Extract the board edges // Extract the board edges for( EDA_ITEM* drawing = aPcb->m_Drawings; for( EDA_ITEM* drawing = aPcb->m_Drawings; drawing != 0; drawing != 0; Loading @@ -881,6 +898,7 @@ static void CreateBoardSection( FILE* aFile, BOARD* aPcb ) } } } } } } fputs( "$ENDBOARD\n\n", aFile ); fputs( "$ENDBOARD\n\n", aFile ); } } Loading Loading @@ -963,6 +981,7 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module ) { { EDGE_MODULE* PtEdge; EDGE_MODULE* PtEdge; EDA_ITEM* PtStruct; EDA_ITEM* PtStruct; // Control Y axis change sign for flipped modules // Control Y axis change sign for flipped modules int Yaxis_sign = -1; int Yaxis_sign = -1; Loading Loading @@ -1015,6 +1034,7 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module ) switch( PtStruct->Type() ) switch( PtStruct->Type() ) { { case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T: // If we wanted to export text, this is not the correct section // If we wanted to export text, this is not the correct section break; break; Loading Loading @@ -1053,7 +1073,8 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module ) RotatePoint( &arcendx, &arcendy, -PtEdge->m_Angle ); RotatePoint( &arcendx, &arcendy, -PtEdge->m_Angle ); arcendx += PtEdge->m_Start0.x; arcendx += PtEdge->m_Start0.x; arcendy += PtEdge->m_Start0.y; arcendy += PtEdge->m_Start0.y; if (Yaxis_sign == -1) { if( Yaxis_sign == -1 ) { // Flipping Y flips the arc direction too // Flipping Y flips the arc direction too fprintf( aFile, "ARC %g %g %g %g %g %g\n", fprintf( aFile, "ARC %g %g %g %g %g %g\n", (arcendx) / SCALE_FACTOR, (arcendx) / SCALE_FACTOR, Loading @@ -1062,7 +1083,9 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module ) (Yaxis_sign * PtEdge->m_End0.y) / SCALE_FACTOR, (Yaxis_sign * PtEdge->m_End0.y) / SCALE_FACTOR, (PtEdge->m_Start0.x) / SCALE_FACTOR, (PtEdge->m_Start0.x) / SCALE_FACTOR, (Yaxis_sign * PtEdge->m_Start0.y) / SCALE_FACTOR ); (Yaxis_sign * PtEdge->m_Start0.y) / SCALE_FACTOR ); } else { } else { fprintf( aFile, "ARC %g %g %g %g %g %g\n", fprintf( aFile, "ARC %g %g %g %g %g %g\n", (PtEdge->m_End0.x) / SCALE_FACTOR, (PtEdge->m_End0.x) / SCALE_FACTOR, (Yaxis_sign * PtEdge->m_End0.y) / SCALE_FACTOR, (Yaxis_sign * PtEdge->m_End0.y) / SCALE_FACTOR, Loading Loading
include/wxBasePcbFrame.h +0 −1 Original line number Original line Diff line number Diff line Loading @@ -80,7 +80,6 @@ public: FOOTPRINT_EDIT_FRAME* m_ModuleEditFrame; FOOTPRINT_EDIT_FRAME* m_ModuleEditFrame; protected: protected: // EDA_RECT m_BoundaryBox; // Board size and position BOARD* m_Pcb; BOARD* m_Pcb; GENERAL_COLLECTOR* m_Collector; GENERAL_COLLECTOR* m_Collector; Loading
pcbnew/export_gencad.cpp +298 −275 Original line number Original line Diff line number Diff line Loading @@ -96,7 +96,7 @@ static const wxString GenCADLayerNameFlipped[32] = static int GencadOffsetX, GencadOffsetY; static int GencadOffsetX, GencadOffsetY; /* GerbTool chokes on units different than INCH so this is the conversion /* GerbTool chokes on units different than INCH so this is the conversion factor */ * factor */ const static double SCALE_FACTOR = 10000.0; const static double SCALE_FACTOR = 10000.0; Loading @@ -108,11 +108,13 @@ static double MapXTo( int aX ) return (aX - GencadOffsetX) / SCALE_FACTOR; return (aX - GencadOffsetX) / SCALE_FACTOR; } } static double MapYTo( int aY ) static double MapYTo( int aY ) { { return (GencadOffsetY - aY) / SCALE_FACTOR; return (GencadOffsetY - aY) / SCALE_FACTOR; } } /* Driver function: processing starts here */ /* Driver function: processing starts here */ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent ) void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent ) { { Loading Loading @@ -170,8 +172,8 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent ) } } /* Gencad has some mandatory and some optional sections: some importer /* Gencad has some mandatory and some optional sections: some importer need the padstack section (which is optional) anyway. Also the * need the padstack section (which is optional) anyway. Also the order of the section *is* important */ * order of the section *is* important */ CreateHeaderInfoData( file, this ); // Gencad header CreateHeaderInfoData( file, this ); // Gencad header CreateBoardSection( file, pcb ); // Board perimeter CreateBoardSection( file, pcb ); // Board perimeter Loading @@ -180,8 +182,8 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent ) CreateArtworksSection( file ); // Empty but mandatory CreateArtworksSection( file ); // Empty but mandatory /* Gencad splits a component info in shape, component and device. /* Gencad splits a component info in shape, component and device. We don't do any sharing (it would be difficult since each module is * We don't do any sharing (it would be difficult since each module is customizable after placement) */ * customizable after placement) */ CreateShapesSection( file, pcb ); CreateShapesSection( file, pcb ); CreateComponentsSection( file, pcb ); CreateComponentsSection( file, pcb ); CreateDevicesSection( file, pcb ); CreateDevicesSection( file, pcb ); Loading @@ -205,6 +207,7 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent ) } } } } // Comparator for sorting pads with qsort // Comparator for sorting pads with qsort static int PadListSortByShape( const void* aRefptr, const void* aObjptr ) static int PadListSortByShape( const void* aRefptr, const void* aObjptr ) { { Loading @@ -214,6 +217,7 @@ static int PadListSortByShape( const void* aRefptr, const void* aObjptr ) return D_PAD::Compare( padref, padcmp ); return D_PAD::Compare( padref, padcmp ); } } // Sort vias for uniqueness // Sort vias for uniqueness static int ViaSort( const void* aRefptr, const void* aObjptr ) static int ViaSort( const void* aRefptr, const void* aObjptr ) { { Loading @@ -232,6 +236,7 @@ static int ViaSort(const void* aRefptr, const void* aObjptr ) return 0; return 0; } } // The ARTWORKS section is empty but (officially) mandatory // The ARTWORKS section is empty but (officially) mandatory static void CreateArtworksSection( FILE* aFile ) static void CreateArtworksSection( FILE* aFile ) { { Loading @@ -240,6 +245,7 @@ static void CreateArtworksSection( FILE* aFile ) fputs( "$ENDARTWORKS\n\n", aFile ); fputs( "$ENDARTWORKS\n\n", aFile ); } } // Emit PADS and PADSTACKS. They are sorted and emitted uniquely. // Emit PADS and PADSTACKS. They are sorted and emitted uniquely. // Via name is synthesized from their attributes, pads are numbered // Via name is synthesized from their attributes, pads are numbered static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) Loading Loading @@ -273,6 +279,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) vias.push_back( track ); vias.push_back( track ); } } } } qsort( &vias[0], vias.size(), sizeof(TRACK*), ViaSort ); qsort( &vias[0], vias.size(), sizeof(TRACK*), ViaSort ); // Emit vias pads // Emit vias pads Loading Loading @@ -331,6 +338,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) case PAD_RECT: case PAD_RECT: fprintf( aFile, " RECTANGULAR %g\n", fprintf( aFile, " RECTANGULAR %g\n", pad->m_Drill.x / SCALE_FACTOR ); pad->m_Drill.x / SCALE_FACTOR ); // Rectangle is begin, size *not* begin, end! // Rectangle is begin, size *not* begin, end! fprintf( aFile, "RECTANGLE %g %g %g %g\n", fprintf( aFile, "RECTANGLE %g %g %g %g\n", (-dx + pad->m_Offset.x ) / SCALE_FACTOR, (-dx + pad->m_Offset.x ) / SCALE_FACTOR, Loading @@ -353,6 +361,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) (-pad->m_Offset.y - radius) / SCALE_FACTOR, (-pad->m_Offset.y - radius) / SCALE_FACTOR, (dr + pad->m_Offset.x ) / SCALE_FACTOR, (dr + pad->m_Offset.x ) / SCALE_FACTOR, (-pad->m_Offset.y - radius) / SCALE_FACTOR ); (-pad->m_Offset.y - radius) / SCALE_FACTOR ); // GenCAD arcs are (start, end, center) // GenCAD arcs are (start, end, center) fprintf( aFile, "ARC %g %g %g %g %g %g\n", fprintf( aFile, "ARC %g %g %g %g %g %g\n", (dr + pad->m_Offset.x) / SCALE_FACTOR, (dr + pad->m_Offset.x) / SCALE_FACTOR, Loading Loading @@ -411,10 +420,12 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) case PAD_TRAPEZOID: case PAD_TRAPEZOID: fprintf( aFile, " POLYGON %g\n", fprintf( aFile, " POLYGON %g\n", pad->m_Drill.x / SCALE_FACTOR ); pad->m_Drill.x / SCALE_FACTOR ); // XXX TO BE IMPLEMENTED! and I don't know if it could be actually imported by something // XXX TO BE IMPLEMENTED! and I don't know if it could be actually imported by something break; break; } } } } fputs( "\n$ENDPADS\n\n", aFile ); fputs( "\n$ENDPADS\n\n", aFile ); // Now emit the padstacks definitions, using the combined layer masks // Now emit the padstacks definitions, using the combined layer masks Loading @@ -440,11 +451,12 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) } } } } } } /* Component padstacks /* Component padstacks CAM350 don't apply correctly the FLIP semantics for padstacks, i.e. doesn't * CAM350 don't apply correctly the FLIP semantics for padstacks, i.e. doesn't swap the top and bottom layers... so I need to define the shape as MIRRORX * swap the top and bottom layers... so I need to define the shape as MIRRORX and define a separate 'flipped' padstack... until it appears yet another * and define a separate 'flipped' padstack... until it appears yet another noncompliant importer */ * noncompliant importer */ for( unsigned i = 1; i < padstacks.size(); i++ ) for( unsigned i = 1; i < padstacks.size(); i++ ) { { D_PAD* pad = padstacks[i]; D_PAD* pad = padstacks[i]; Loading Loading @@ -473,6 +485,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) } } } } } } fputs( "$ENDPADSTACKS\n\n", aFile ); fputs( "$ENDPADSTACKS\n\n", aFile ); } } Loading @@ -499,10 +512,10 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb ) for( pad = module->m_Pads; pad != NULL; pad = pad->Next() ) for( pad = module->m_Pads; pad != NULL; pad = pad->Next() ) { { /* Funny thing: GenCAD requires the pad side even if you use /* Funny thing: GenCAD requires the pad side even if you use padstacks (which are theorically optional but gerbtools * padstacks (which are theorically optional but gerbtools *requires* them). Now the trouble thing is that 'BOTTOM' *requires* them). Now the trouble thing is that 'BOTTOM' is interpreted by someone as a padstack flip even * is interpreted by someone as a padstack flip even if the spec explicitly says it's not... */ * if the spec explicitly says it's not... */ layer = "ALL"; layer = "ALL"; if( ( pad->m_layerMask & ALL_CU_LAYERS ) == LAYER_BACK ) if( ( pad->m_layerMask & ALL_CU_LAYERS ) == LAYER_BACK ) Loading Loading @@ -536,6 +549,7 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb ) fputs( "$ENDSHAPES\n\n", aFile ); fputs( "$ENDSHAPES\n\n", aFile ); } } /* Creates the section $COMPONENTS (Footprints placement) /* Creates the section $COMPONENTS (Footprints placement) * Bottom side components are difficult to handle: shapes must be mirrored or * Bottom side components are difficult to handle: shapes must be mirrored or * flipped, silk layers need to be handled correctly and so on. Also it seems * flipped, silk layers need to be handled correctly and so on. Also it seems Loading @@ -543,7 +557,6 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb ) */ */ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb ) static void CreateComponentsSection( FILE* aFile, BOARD* aPcb ) { { fputs( "$COMPONENTS\n", aFile ); fputs( "$COMPONENTS\n", aFile ); for( MODULE* module = aPcb->m_Modules; module != NULL; module = module->Next() ) for( MODULE* module = aPcb->m_Modules; module != NULL; module = module->Next() ) Loading Loading @@ -617,6 +630,7 @@ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb ) fputs( "$ENDCOMPONENTS\n\n", aFile ); fputs( "$ENDCOMPONENTS\n\n", aFile ); } } /* Emit the netlist (which is actually the thing for which GenCAD is used these /* Emit the netlist (which is actually the thing for which GenCAD is used these * days!); tracks are handled later */ * days!); tracks are handled later */ static void CreateSignalsSection( FILE* aFile, BOARD* aPcb ) static void CreateSignalsSection( FILE* aFile, BOARD* aPcb ) Loading Loading @@ -702,6 +716,7 @@ static bool CreateHeaderInfoData( FILE* aFile, PCB_EDIT_FRAME* aFrame ) return true; return true; } } /* /* * Sort function used to sort tracks segments: * Sort function used to sort tracks segments: * items are sorted by netcode, then by width then by layer * items are sorted by netcode, then by width then by layer Loading Loading @@ -845,6 +860,7 @@ static void CreateDevicesSection( FILE* aFile, BOARD* aPcb ) fprintf( aFile, "DEVICE \"%s\"\n", TO_UTF8( module->m_Reference->m_Text ) ); fprintf( aFile, "DEVICE \"%s\"\n", TO_UTF8( module->m_Reference->m_Text ) ); fprintf( aFile, "PART \"%s\"\n", TO_UTF8( module->m_Value->m_Text ) ); fprintf( aFile, "PART \"%s\"\n", TO_UTF8( module->m_Value->m_Text ) ); fprintf( aFile, "PACKAGE \"%s\"\n", TO_UTF8( module->m_LibRef ) ); fprintf( aFile, "PACKAGE \"%s\"\n", TO_UTF8( module->m_LibRef ) ); // The TYPE attribute is almost freeform // The TYPE attribute is almost freeform const char* ty = "TH"; const char* ty = "TH"; if( module->m_Attributs & MOD_CMS ) if( module->m_Attributs & MOD_CMS ) Loading @@ -864,6 +880,7 @@ static void CreateDevicesSection( FILE* aFile, BOARD* aPcb ) static void CreateBoardSection( FILE* aFile, BOARD* aPcb ) static void CreateBoardSection( FILE* aFile, BOARD* aPcb ) { { fputs( "$BOARD\n", aFile ); fputs( "$BOARD\n", aFile ); // Extract the board edges // Extract the board edges for( EDA_ITEM* drawing = aPcb->m_Drawings; for( EDA_ITEM* drawing = aPcb->m_Drawings; drawing != 0; drawing != 0; Loading @@ -881,6 +898,7 @@ static void CreateBoardSection( FILE* aFile, BOARD* aPcb ) } } } } } } fputs( "$ENDBOARD\n\n", aFile ); fputs( "$ENDBOARD\n\n", aFile ); } } Loading Loading @@ -963,6 +981,7 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module ) { { EDGE_MODULE* PtEdge; EDGE_MODULE* PtEdge; EDA_ITEM* PtStruct; EDA_ITEM* PtStruct; // Control Y axis change sign for flipped modules // Control Y axis change sign for flipped modules int Yaxis_sign = -1; int Yaxis_sign = -1; Loading Loading @@ -1015,6 +1034,7 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module ) switch( PtStruct->Type() ) switch( PtStruct->Type() ) { { case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T: // If we wanted to export text, this is not the correct section // If we wanted to export text, this is not the correct section break; break; Loading Loading @@ -1053,7 +1073,8 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module ) RotatePoint( &arcendx, &arcendy, -PtEdge->m_Angle ); RotatePoint( &arcendx, &arcendy, -PtEdge->m_Angle ); arcendx += PtEdge->m_Start0.x; arcendx += PtEdge->m_Start0.x; arcendy += PtEdge->m_Start0.y; arcendy += PtEdge->m_Start0.y; if (Yaxis_sign == -1) { if( Yaxis_sign == -1 ) { // Flipping Y flips the arc direction too // Flipping Y flips the arc direction too fprintf( aFile, "ARC %g %g %g %g %g %g\n", fprintf( aFile, "ARC %g %g %g %g %g %g\n", (arcendx) / SCALE_FACTOR, (arcendx) / SCALE_FACTOR, Loading @@ -1062,7 +1083,9 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module ) (Yaxis_sign * PtEdge->m_End0.y) / SCALE_FACTOR, (Yaxis_sign * PtEdge->m_End0.y) / SCALE_FACTOR, (PtEdge->m_Start0.x) / SCALE_FACTOR, (PtEdge->m_Start0.x) / SCALE_FACTOR, (Yaxis_sign * PtEdge->m_Start0.y) / SCALE_FACTOR ); (Yaxis_sign * PtEdge->m_Start0.y) / SCALE_FACTOR ); } else { } else { fprintf( aFile, "ARC %g %g %g %g %g %g\n", fprintf( aFile, "ARC %g %g %g %g %g %g\n", (PtEdge->m_End0.x) / SCALE_FACTOR, (PtEdge->m_End0.x) / SCALE_FACTOR, (Yaxis_sign * PtEdge->m_End0.y) / SCALE_FACTOR, (Yaxis_sign * PtEdge->m_End0.y) / SCALE_FACTOR, Loading