You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.7 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
  5. *
  6. * This program is free software: you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation, either version 3 of the License, or (at your
  9. * option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. class BOARD;
  20. class wxString;
  21. struct aFile;
  22. class GENCAD_EXPORTER
  23. {
  24. public:
  25. GENCAD_EXPORTER( BOARD* aBoard ):
  26. m_board( aBoard ),
  27. m_file( nullptr ),
  28. m_flipBottomPads( false ),
  29. m_useUniquePins( false ),
  30. m_useIndividualShapes( false ),
  31. m_storeOriginCoords( false )
  32. {
  33. }
  34. /** Export a genCAD file
  35. * @param aFullFileName is the full filenam to create
  36. * @return true on success
  37. */
  38. bool WriteFile( const wxString& aFullFileName );
  39. /// Set the coordinates offet when exporting items
  40. void SetPlotOffet( VECTOR2I aOffset ) { GencadOffset = aOffset; }
  41. /// Flip pad shapes on the bottom side
  42. void FlipBottomPads( bool aFlip ) { m_flipBottomPads = aFlip; }
  43. /// Make pin names unique
  44. void UsePinNamesUnique( bool aUnique ) { m_useUniquePins = aUnique; }
  45. /// Make pad shapes unique
  46. void UseIndividualShapes( bool aUnique ) { m_useIndividualShapes = aUnique; }
  47. ///Store coord origin in genCAD file
  48. void StoreOriginCoordsInFile( bool aStore ) { m_storeOriginCoords = aStore; }
  49. private:
  50. /// Creates the header section
  51. bool CreateHeaderInfoData();
  52. void CreateArtworksSection();
  53. void CreateTracksInfoData();
  54. void CreateBoardSection();
  55. void CreateComponentsSection();
  56. void CreateDevicesSection();
  57. void CreateRoutesSection();
  58. void CreateSignalsSection();
  59. void CreateShapesSection();
  60. void CreatePadsShapesSection();
  61. void FootprintWriteShape( FOOTPRINT* aFootprint, const wxString& aShapeName );
  62. const wxString getShapeName( FOOTPRINT* aFootprint );
  63. double MapXTo( int aX );
  64. double MapYTo( int aY );
  65. private:
  66. BOARD* m_board;
  67. wxString m_fullFileName;
  68. FILE* m_file;
  69. // Export options
  70. bool m_flipBottomPads;
  71. bool m_useUniquePins;
  72. bool m_useIndividualShapes;
  73. bool m_storeOriginCoords;
  74. // These are the export origin (the auxiliary axis)
  75. VECTOR2I GencadOffset;
  76. };