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.

288 lines
9.8 KiB

* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
  1. /********************/
  2. /* class_excellon.h */
  3. /********************/
  4. #ifndef CLASS_EXCELLON_H
  5. #define CLASS_EXCELLON_H
  6. enum drill_M_code_t {
  7. DRILL_M_UNKNOWN,
  8. DRILL_M_END,
  9. DRILL_M_ENDREWIND,
  10. DRILL_M_MESSAGE,
  11. DRILL_M_LONGMESSAGE,
  12. DRILL_M_HEADER,
  13. DRILL_M_ENDHEADER,
  14. DRILL_M_BEGINPATTERN,
  15. DRILL_M_ENDPATTERN,
  16. DRILL_M_CANNEDTEXT,
  17. DRILL_M_TIPCHECK,
  18. DRILL_M_METRIC,
  19. DRILL_M_IMPERIAL,
  20. DRILL_METRICHEADER,
  21. DRILL_IMPERIALHEADER,
  22. DRILL_DETECT_BROKEN,
  23. DRILL_INCREMENTALHEADER,
  24. DRILL_REWIND_STOP,
  25. DRILL_TOOL_CHANGE_STOP,
  26. DRILL_AUTOMATIC_SPEED,
  27. DRILL_AXIS_VERSION,
  28. DRILL_RESET_CMD,
  29. DRILL_AUTOMATIC_TOOL_CHANGE,
  30. DRILL_FMT,
  31. DRILL_SKIP,
  32. DRILL_TOOL_INFORMATION
  33. };
  34. enum drill_G_code_t {
  35. DRILL_G_UNKNOWN,
  36. DRILL_G_ABSOLUTE,
  37. DRILL_G_INCREMENTAL,
  38. DRILL_G_ZEROSET,
  39. DRILL_G_ROUT,
  40. DRILL_G_DRILL,
  41. DRILL_G_SLOT,
  42. DRILL_G_ZERO_SET,
  43. DRILL_G_LINEARMOVE,
  44. DRILL_G_CWMOVE,
  45. DRILL_G_CCWMOVE
  46. };
  47. // Helper struct to analyse Excellon commands
  48. struct EXCELLON_CMD
  49. {
  50. std::string m_Name; // key string
  51. int m_Code; // internal code, used as id in functions
  52. int m_asParams; // 0 = no param, -1 = skip params, 1 = read params
  53. };
  54. /* EXCELLON_IMAGE handle a drill image
  55. * It is derived from GERBER_IMAGE because there is a lot of likeness
  56. * between EXCELLON files and GERBER files
  57. * DCode aperture are also similat to T Codes.
  58. * So we can reuse GERBER_IMAGE to handle EXCELLON_IMAGE with very few new functions
  59. */
  60. class EXCELLON_IMAGE : public GERBER_IMAGE
  61. {
  62. private:
  63. enum excellon_state {
  64. READ_HEADER_STATE, // When we are in this state, we are reading header
  65. READ_PROGRAM_STATE // When we are in this state, we are reading drill data
  66. };
  67. excellon_state m_State; // state of excellon file analysis
  68. bool m_SlotOn; // true during an oval driil definition
  69. public: EXCELLON_IMAGE( GERBVIEW_FRAME* aParent, LAYER_NUM layer ) :
  70. GERBER_IMAGE( aParent, layer )
  71. {
  72. m_State = READ_HEADER_STATE;
  73. m_SlotOn = false;
  74. }
  75. ~EXCELLON_IMAGE() {};
  76. virtual void ResetDefaultValues()
  77. {
  78. GERBER_IMAGE::ResetDefaultValues();
  79. SelectUnits( false );
  80. }
  81. bool Read_EXCELLON_File( FILE* aFile, const wxString& aFullFileName );
  82. private:
  83. bool Execute_HEADER_Command( char*& text );
  84. bool Select_Tool( char*& text );
  85. bool Execute_EXCELLON_G_Command( char*& text );
  86. bool Execute_Drill_Command( char*& text );
  87. int TCodeNumber( char*& Text )
  88. {
  89. return DCodeNumber( Text );
  90. }
  91. void SelectUnits( bool aMetric );
  92. };
  93. /*
  94. * EXCELLON commands are given here.
  95. * Pcbnew uses only few excellon commands
  96. */
  97. /*
  98. * see http://www.excellon.com/manuals/program.htm
  99. */
  100. /* coordintes units:
  101. * Coordinates are measured either in inch or metric (millimeters).
  102. * Inch coordinates are in six digits (00.0000) with increments as small as 0.0001 (1/10,000).
  103. * Metric coordinates can be measured in microns (thousandths of a millimeter)
  104. * in one of the following three ways:
  105. * Five digit 10 micron resolution (000.00)
  106. * Six digit 10 micron resolution (0000.00)
  107. * Six digit micron resolution (000.000)
  108. *
  109. * Leading and trailing zeros:
  110. * Excellon (CNC-7) uses inches in six digits and metric in five or six digits.
  111. * The zeros to the left of the coordinate are called leading zeros (LZ).
  112. * The zeros to right of the coordinate are called trailing zeros (TZ).
  113. * The CNC-7 uses leading zeros unless you specify otherwise through a part program.
  114. * You can do so with the INCH/METRIC command.
  115. * With leading zeros, the leading zeros must always be included.
  116. * Trailing zeros are unneeded and may be left off.
  117. * For trailing zeros, the reverse of the above is true.
  118. */
  119. /*
  120. * EXCELLON Commands Used in a Header
  121. * The following table provides you with a list of commands which
  122. * are the most used in a part program header.
  123. * COMMAND DESCRIPTION
  124. * AFS Automatic Feeds and Speeds
  125. * ATC Automatic Tool Change
  126. * BLKD Delete all Blocks starting with a slash (/)
  127. * CCW Clockwise or Counter-clockwise Routing
  128. * CP Cutter Compensation
  129. * DETECT Broken Tool Detection
  130. * DN Down Limit Set
  131. * DTMDIST Maximum Rout Distance Before Toolchange
  132. * EXDA Extended Drill Area
  133. * FMAT Format 1 or 2
  134. * FSB Turns the Feed/Speed Buttons off
  135. * HPCK Home Pulse Check
  136. * ICI Incremental Input of Part Program Coordinates
  137. * INCH Measure Everything in Inches
  138. * METRIC Measure Everything in Metric
  139. * M48 Beginning of Part Program Header
  140. * M95 End of Header
  141. * NCSL NC Slope Enable/Disable
  142. * OM48 Override Part Program Header
  143. * OSTOP Optional Stop Switch
  144. * OTCLMP Override Table Clamp
  145. * PCKPARAM Set up pecking tool,depth,infeed and retract parameters
  146. * PF Floating Pressure Foot Switch
  147. * PPR Programmable Plunge Rate Enable
  148. * PVS Pre-vacuum Shut-off Switch
  149. * R,C Reset Clocks
  150. * R,CP Reset Program Clocks
  151. * R,CR Reset Run Clocks
  152. * R,D Reset All Cutter Distances
  153. * R,H Reset All Hit Counters
  154. * R,T Reset Tool Data
  155. * SBK Single Block Mode Switch
  156. * SG Spindle Group Mode
  157. * SIXM Input From External Source
  158. * T Tool Information
  159. * TCST Tool Change Stop
  160. * UP Upper Limit Set
  161. * VER Selection of X and Y Axis Version
  162. * Z Zero Set
  163. * ZA Auxiliary Zero
  164. * ZC Zero Correction
  165. * ZS Zero Preset
  166. * Z+# or Z-# Set Depth Offset
  167. * % Rewind Stop
  168. * #/#/# Link Tool for Automatic Tool Change
  169. * / Clear Tool Linking
  170. */
  171. /*
  172. * Beyond The Header: The Part Program Body
  173. * COMMAND DESCRIPTION
  174. * A# Arc Radius
  175. * B# Retract Rate
  176. * C# Tool Diameter
  177. * F# Table Feed Rate;Z Axis Infeed Rate
  178. * G00X#Y# Route Mode
  179. * G01 Linear (Straight Line) Mode
  180. * G02 Circular CW Mode
  181. * G03 Circular CCW Mode
  182. * G04 X# Variable Dwell
  183. * G05 Drill Mode
  184. * G07 Override current tool feed or speed
  185. * G32X#Y#A# Routed Circle Canned Cycle
  186. * CW G33X#Y#A# Routed Circle Canned Cycle
  187. * CCW G34,#(,#) Select Vision Tool
  188. * G35(X#Y#) Single Point Vision Offset (Relative to Work Zero)
  189. * G36(X#Y#) Multipoint Vision Translation (Relative to Work Zero)
  190. * G37 Cancel Vision Translation or Offset (From G35 or G36)
  191. * G38(X#Y#) Vision Corrected Single Hole Drilling (Relative to Work Zero)
  192. * G39(X#Y#) Vision System Autocalibration
  193. * G40 Cutter Compensation Off
  194. * G41 Cutter Compensation Left
  195. * G42 Cutter Compensation Right
  196. * G45(X#Y#) Single Point Vision Offset (Relative to G35 or G36)
  197. * G46(X#Y#) Multipoint Vision Translation (Relative to G35 or G36)
  198. * G47 Cancel Vision Translation or Offset (From G45 or G46)
  199. * G48(X#Y#) Vision Corrected Single Hole Drilling (Relative to G35 or G36)
  200. * G82(G81) Dual In Line Package
  201. * G83 Eight Pin L Pack
  202. * G84 Circle
  203. * G85 Slot
  204. * G87 Routed Step Slot Canned Cycle
  205. * G90 Absolute Mode
  206. * G91 Incremental Input Mode
  207. * G93X#Y# Zero Set
  208. * H# Maximum hit count
  209. * I#J# Arc Center Offset
  210. * M00(X#Y#) End of Program - No Rewind
  211. * M01 End of Pattern
  212. * M02X#Y# Repeat Pattern Offset
  213. * M06(X#Y#) Optional Stop
  214. * M08 End of Step and Repeat
  215. * M09(X#Y#) Stop for Inspection
  216. * M14 Z Axis Route Position With Depth Controlled Contouring
  217. * M15 Z Axis Route Position
  218. * M16 Retract With Clamping
  219. * M17 Retract Without Clamping
  220. * M18 Command tool tip check
  221. * M25 Beginning of Pattern
  222. * M30(X#Y#) End of Program Rewind
  223. * M45,long message\ Long Operator message on multiple\ part program lines
  224. * M47,text Operator Message
  225. * M50,# Vision Step and Repeat Pattern Start
  226. * M51,# Vision Step and Repeat Rewind
  227. * M52(#) Vision Step and Repeat Offset Counter Control
  228. * M02XYM70 Swap Axes
  229. * M60 Reference Scaling enable
  230. * M61 Reference Scaling disable
  231. * M62 Turn on peck drilling
  232. * M63 Turn off peck drilling
  233. * M71 Metric Measuring Mode
  234. * M72 Inch Measuring Mode
  235. * M02XYM80 Mirror Image X Axis
  236. * M02XYM90 Mirror Image Y Axis
  237. * M97,text Canned Text
  238. * M98,text Canned Text
  239. * M99,subprogram User Defined Stored Pattern
  240. * P#X#(Y#) Repeat Stored Pattern
  241. * R#M02X#Y# Repeat Pattern (S&R)
  242. * R#(X#Y#) Repeat Hole
  243. * S# Spindle RPM
  244. * T# Tool Selection; Cutter Index
  245. * Z+# or Z-# Depth Offset
  246. * % Beginning of Pattern (see M25 command)
  247. * / Block Delete
  248. */
  249. /*
  250. * Example of a Header
  251. * COMMAND PURPOSE
  252. * M48 The beginning of a header
  253. * INCH,LZ Use the inch measuring system with leading zeros
  254. * VER,1 Use Version 1 X and Y axis layout
  255. * FMAT,2 Use Format 2 commands
  256. * 1/2/3 Link tools 1, 2, and 3
  257. * T1C.04F200S65 Set Tool 1 for 0.040" with infeed rate of 200 inch/min Speed of 65,000 RPM
  258. * DETECT,ON Detect broken tools
  259. * M95 End of the header
  260. */
  261. #endif // CLASS_EXCELLON_H