├── .gitignore
├── BundlingTools
└── one-jar-ant-task-0.97.jar
├── COPYING
├── README.md
├── build.xml
├── lib
├── RXTXcomm.jar
├── natives
│ ├── librxtxSerial.jnilib
│ ├── librxtxSerial32.so
│ ├── librxtxSerial64.so
│ ├── rxtxSerial32.dll
│ └── rxtxSerial64.dll
└── swing-layout-1.0.4.jar
├── manifest.mf
├── nbproject
├── build-impl.xml
├── genfiles.properties
├── project.properties
└── project.xml
├── one-jar-ant-task.xml
├── onejar.mf
├── pictures
├── command_table_tab.png
├── console_tab.png
├── finished_sending_file_1.0.5.png
├── manualcontrol.png
└── sending_file_1.0.5.png
├── src
├── com
│ └── willwinder
│ │ └── universalgcodesender
│ │ ├── CommUtils.java
│ │ ├── Coordinate.java
│ │ ├── GcodeCommand.java
│ │ ├── GcodeCommandBuffer.java
│ │ ├── GrblUtils.java
│ │ ├── MainWindow.form
│ │ ├── MainWindow.java
│ │ ├── SerialCommunicator.java
│ │ ├── SerialCommunicatorListener.java
│ │ ├── SerialWriter.java
│ │ ├── Utils.java
│ │ └── uielements
│ │ ├── GcodeFileTypeFilter.java
│ │ └── StepSizeSpinnerModel.java
└── refresh.gif
└── test_files
├── buffer_stress_test.gcode
├── electric_turtle.nc
├── line_skip_test.gcode
├── serial_stress_test.gcode
└── shapeoko.txt
/.gitignore:
--------------------------------------------------------------------------------
1 | /build/
2 | /dist/
3 | /nbproject/private
4 | /release/
5 |
--------------------------------------------------------------------------------
/BundlingTools/one-jar-ant-task-0.97.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grbl/Universal-G-Code-Sender/47f8a02cbdb4da084e71a4b5a2d139de6d1fe0be/BundlingTools/one-jar-ant-task-0.97.jar
--------------------------------------------------------------------------------
/COPYING:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 |
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Universal GcodeSender is a Java based GRBL compatibl cross platform G-Code sender. Use this program to run a GRBL controlled CNC machine.
2 |
3 | To run simply unzip the .zip file and double click the .jar file.
4 | On some platforms you will need to run 'UniversalGcodeSender.sh' instead.
5 |
6 | Note for MAC users:
7 | You may need to create a "/var/lock" directory on OSX to fix a bug in the serial
8 | library. To do this open the Terminal application and run the following two
9 | commands:
10 |
11 | sudo mkdir /var/lock
12 |
13 | sudo chmod 777 /var/lock
14 |
15 |
16 | Downloads
17 | ---------
18 | [1.0.5 32-bit](http://bit.ly/Xz4U1R)
19 |
20 | [1.0.5 64-bit](http://bit.ly/SGKfMN)
21 |
22 | [Older releases can be found on the downloads page](https://github.com/winder/Universal-G-Code-Sender/tree/master/releases)
23 |
24 |
25 | 
26 | 
27 |
28 | Technical details:
29 | * RXTX for serial communication.
30 | * Utilizes One-Jar to bundle all dependencies into a single runnable .jar file.
31 | * Developed with NetBeans 7.1.2 or later.
32 | * For development you will need to install RXTX.
33 | * To build a release open the 'Files' pane and right click build.xml, then
34 | select 'Run Target' > 'onejar-dist-all-zip'. A new directory called 'release'
35 | will contain the .zip files.
36 |
37 | Changelog
38 | ---------
39 | 1.0.4 -> 1.0.5
40 | * Job duration estimate now displayed when running a file.
41 | * Real-time machine position display for GRBL v8.0c.
42 | * Display for most recent GcodeComment.
43 | * Bug fixes - no more dropped commands!
44 | * Overhauled the GUI to display more information.
45 |
46 | 1.0.3 -> 1.0.4
47 | * The step size spinner now goes to less than 1.
48 | * New buttons on the manual control page for common functions.
49 | * Manual X/Y coordinates can now be modified with arrow keys.
50 | * New start scripts added to release zip files.
51 | * Changed speed override to a percentage rather than absolute.
52 | * Bug fixes.
53 |
54 | 1.0.2 -> 1.0.3
55 | * Manual jogging mode, control machine with buttons in the UI.
56 | * Automatically skip blank lines and comments when sending a file.
57 | * Bug fixes.
58 |
59 | 1.0.1 -> 1.0.2
60 | * Grbl version checking.
61 | * Real-time pause/resume commands used for Grbl v0.8.
62 | * Comment filtering - parses out comments before sending commands.
63 | * Bug fixes.
64 |
65 | 1.0 -> 1.0.1
66 | * New distribution jar - Application no longer requires RXTX to be installed!
67 | * Added table view for file streaming.
68 | * Added Pause/Resume button.
69 | * Usability improvements.
70 | * Many bug fixes.
71 | * Renamed package to com.willwinder.universalgcodesender.
72 |
--------------------------------------------------------------------------------
/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Builds, tests, and runs the project Universal G-Code Sender.
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
26 | Bundling: OneJAR is copying natives to ${dist.jar.dir}/natives
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 | Bundling: OneJAR is composing ${standalone.jar.name}-all32.jar
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 | Run the stand-alone distribution from the command line using:
76 | java -jar -Xmx256m ${standalone.jar.name}-all32.jar
77 |
78 | Bundling: OneJAR is composing ${standalone.jar.name}-all64.jar
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 | Run the stand-alone distribution from the command line using:
95 | java -jar -Xmx256m ${standalone.jar.name}-all64.jar
96 |
97 | Bundling: OneJAR is preparing ${standalone.jar.name}-win32.jar
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 | Bundling: OneJAR is preparing ${standalone.jar.name}-win64.jar
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 | Bundling: OneJAR is preparing ${standalone.jar.name}-linux32.jar
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 | Bundling: OneJAR is preparing ${standalone.jar.name}-linux64.jar
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 | Bundling: OneJAR is preparing ${standalone.jar.name}-mac.jar
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 | Bundling: OneJAR is done.
164 |
165 |
166 |
167 |
169 |
170 |
171 |
172 | Mac: Creating JAR Launcher
173 |
174 |
176 |
177 |
178 | Mac: Creating ZIP Archive
179 |
181 |
182 | Mac: Cleaning up temporary files
183 |
184 |
185 |
186 |
187 | Win32: Creating JAR Launcher
188 |
189 |
190 | java -jar -Xmx256m ${standalone.jar.name}-win32.jar
191 |
192 |
194 |
195 | Win32: Creating ZIP Archive
196 |
198 |
199 | Win32: Cleaning up temporary files
200 |
201 |
202 |
203 |
204 | Win64: Creating JAR Launcher
205 |
206 |
207 | java -jar -Xmx256m ${standalone.jar.name}-win64.jar
208 |
209 |
211 |
212 | Win64: Creating ZIP Archive
213 |
215 |
216 | Win64: Cleaning up temporary files
217 |
218 |
219 |
220 |
221 |
222 | Linux32: Creating JAR Launcher
223 |
224 |
225 | java -jar -Xmx256m ${standalone.jar.name}-linux32.jar
226 |
227 |
229 |
230 | Linux32: Creating ZIP Archive
231 |
233 |
234 | Linux32: Cleaning up temporary files
235 |
236 |
237 |
238 |
239 | Linux64: Creating JAR Launcher
240 |
241 |
242 | java -jar -Xmx256m ${standalone.jar.name}-linux64.jar
243 |
244 |
246 |
247 | Linux64: Creating ZIP Archive
248 |
250 |
251 | Linux64: Cleaning up temporary files
252 |
253 |
254 |
255 |
256 | All32: Creating JAR Launcher
257 |
258 |
259 | Run the stand-alone distribution from the command line using:
260 | java -jar -Xmx256m ${standalone.jar.name}-all32.jar
261 |
262 |
263 | java -jar -Xmx256m UniversalGcodeSender-all*.jar
264 |
265 |
266 | #!/bin/bash
267 |
268 | platform='unknown'
269 | unamestr=`uname`
270 | case "$unamestr" in
271 | Linux)
272 | platform='linux'
273 | rootdir="$(dirname $(readlink -f $0))"
274 | ;;
275 | Darwin)
276 | platform='mac'
277 | rootdir="$(cd $(dirname $0); pwd -P)"
278 | ;;
279 | esac
280 |
281 | case "$platform" in
282 | mac)
283 | java -Xdock:name=UniversalGCodeSender -jar -Xmx256m $rootdir/UniversalGcodeSender-all*.jar
284 | ;;
285 | linux)
286 | java -jar -Xmx256m $rootdir/UniversalGcodeSender-all*.jar
287 | ;;
288 | esac
289 |
290 |
292 |
293 | All32: Creating ZIP Archive
294 |
296 |
297 | All32: Cleaning up temporary files
298 |
299 |
300 |
301 |
302 |
303 | All64: Creating JAR Launcher
304 |
305 |
306 | Run the stand-alone distribution from the command line using:
307 | java -jar -Xmx256m ${standalone.jar.name}-all64.jar
308 |
309 |
310 | java -jar -Xmx256m UniversalGcodeSender-all*.jar
311 |
312 |
313 | #!/bin/bash
314 |
315 | platform='unknown'
316 | unamestr=`uname`
317 | case "$unamestr" in
318 | Linux)
319 | platform='linux'
320 | rootdir="$(dirname $(readlink -f $0))"
321 | ;;
322 | Darwin)
323 | platform='mac'
324 | rootdir="$(cd $(dirname $0); pwd -P)"
325 | ;;
326 | esac
327 |
328 | case "$platform" in
329 | mac)
330 | java -Xdock:name=UniversalGCodeSender -jar -Xmx256m $rootdir/UniversalGcodeSender-all*.jar
331 | ;;
332 | linux)
333 | java -jar -Xmx256m $rootdir/UniversalGcodeSender-all*.jar
334 | ;;
335 | esac
336 |
337 |
338 |
340 |
341 | All64: Creating ZIP Archive
342 |
344 |
345 | All64: Cleaning up temporary files
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
419 |
420 |
--------------------------------------------------------------------------------
/lib/RXTXcomm.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grbl/Universal-G-Code-Sender/47f8a02cbdb4da084e71a4b5a2d139de6d1fe0be/lib/RXTXcomm.jar
--------------------------------------------------------------------------------
/lib/natives/librxtxSerial.jnilib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grbl/Universal-G-Code-Sender/47f8a02cbdb4da084e71a4b5a2d139de6d1fe0be/lib/natives/librxtxSerial.jnilib
--------------------------------------------------------------------------------
/lib/natives/librxtxSerial32.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grbl/Universal-G-Code-Sender/47f8a02cbdb4da084e71a4b5a2d139de6d1fe0be/lib/natives/librxtxSerial32.so
--------------------------------------------------------------------------------
/lib/natives/librxtxSerial64.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grbl/Universal-G-Code-Sender/47f8a02cbdb4da084e71a4b5a2d139de6d1fe0be/lib/natives/librxtxSerial64.so
--------------------------------------------------------------------------------
/lib/natives/rxtxSerial32.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grbl/Universal-G-Code-Sender/47f8a02cbdb4da084e71a4b5a2d139de6d1fe0be/lib/natives/rxtxSerial32.dll
--------------------------------------------------------------------------------
/lib/natives/rxtxSerial64.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grbl/Universal-G-Code-Sender/47f8a02cbdb4da084e71a4b5a2d139de6d1fe0be/lib/natives/rxtxSerial64.dll
--------------------------------------------------------------------------------
/lib/swing-layout-1.0.4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grbl/Universal-G-Code-Sender/47f8a02cbdb4da084e71a4b5a2d139de6d1fe0be/lib/swing-layout-1.0.4.jar
--------------------------------------------------------------------------------
/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 | Ant-Version: Apache Ant 1.8.2
4 | Class-Path: lib/RXTXcomm.jar lib/swing-layout-1.0.4.jar
5 | One-Jar-Main-Class: com.willwinder.universalgcodesender.MainWindow
6 |
--------------------------------------------------------------------------------
/nbproject/build-impl.xml:
--------------------------------------------------------------------------------
1 |
2 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 | Must set src.dir
210 | Must set test.src.dir
211 | Must set build.dir
212 | Must set dist.dir
213 | Must set build.classes.dir
214 | Must set dist.javadoc.dir
215 | Must set build.test.classes.dir
216 | Must set build.test.results.dir
217 | Must set build.classes.excludes
218 | Must set dist.jar
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 | Must set javac.includes
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 | Must set JVM to use for profiling in profiler.info.jvm
407 | Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 |
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 |
463 |
464 |
465 |
466 |
467 |
468 |
469 |
470 |
471 |
472 |
473 |
474 |
475 |
476 |
477 |
478 |
479 |
480 |
481 |
482 |
483 |
484 |
485 |
486 |
487 |
488 |
489 |
490 |
491 |
492 |
493 |
494 |
495 |
496 |
497 |
498 |
499 |
500 |
501 |
502 |
503 |
504 |
505 |
506 |
507 |
508 |
509 |
510 |
511 |
512 |
513 |
514 |
515 |
516 |
517 |
518 |
519 |
520 |
521 |
522 |
523 |
524 |
525 |
526 |
527 |
528 |
529 |
530 |
531 |
532 |
533 |
534 |
535 |
536 |
537 |
538 |
539 |
540 |
541 |
542 |
543 |
544 |
545 |
546 |
547 |
548 |
549 |
550 |
551 |
552 |
553 |
554 |
555 |
556 |
557 |
558 |
559 |
560 |
561 |
566 |
567 |
568 |
569 |
570 |
571 |
572 |
573 |
574 |
575 |
576 |
577 |
578 |
579 |
580 |
581 |
582 |
583 |
584 |
585 |
586 |
587 |
588 |
589 |
590 |
591 |
592 |
593 |
594 |
595 |
596 |
597 |
598 |
599 |
600 |
601 |
602 |
603 |
604 |
605 |
606 |
607 |
608 |
609 |
610 |
611 |
612 |
613 |
614 |
615 |
616 |
617 |
618 |
619 |
620 |
621 |
622 |
623 |
624 |
625 |
626 | Must select some files in the IDE or set javac.includes
627 |
628 |
629 |
630 |
631 |
632 |
633 |
634 |
635 |
640 |
641 |
642 |
643 |
644 |
645 |
646 |
647 |
648 |
649 |
650 |
651 |
652 |
653 |
654 |
655 |
656 |
657 |
658 |
659 |
660 | To run this application from the command line without Ant, try:
661 |
662 |
663 |
664 |
665 |
666 |
667 | java -cp "${run.classpath.with.dist.jar}" ${main.class}
668 |
669 |
670 |
671 |
672 |
673 |
674 |
675 |
676 |
677 |
678 |
679 |
680 |
681 |
682 |
683 |
684 |
685 |
686 |
687 |
688 |
689 |
690 |
691 |
692 | To run this application from the command line without Ant, try:
693 |
694 | java -jar "${dist.jar.resolved}"
695 |
696 |
697 |
698 |
699 |
700 |
701 |
702 |
703 |
704 |
705 |
706 |
707 |
712 |
713 |
714 |
715 |
716 |
717 |
718 |
719 |
720 |
721 |
722 |
723 | Must select one file in the IDE or set run.class
724 |
725 |
726 |
727 | Must select one file in the IDE or set run.class
728 |
729 |
730 |
735 |
736 |
737 |
738 |
739 |
740 |
741 |
742 |
743 |
744 |
745 |
746 |
747 |
748 |
749 |
750 |
751 |
752 |
753 |
754 | Must select one file in the IDE or set debug.class
755 |
756 |
757 |
758 |
759 | Must select one file in the IDE or set debug.class
760 |
761 |
762 |
763 |
764 | Must set fix.includes
765 |
766 |
767 |
768 |
769 |
770 |
771 |
776 |
777 |
778 |
779 |
780 |
781 |
782 |
783 |
784 |
785 | Must select one file in the IDE or set profile.class
786 |
787 |
788 |
789 |
790 |
791 |
792 |
793 |
798 |
799 |
800 |
801 |
802 |
803 |
804 |
805 |
806 |
807 |
808 |
809 |
810 |
815 |
816 |
817 |
818 |
819 |
820 |
821 |
822 |
823 |
824 |
825 |
826 |
827 |
828 |
829 |
830 |
831 |
832 |
833 |
834 |
835 |
836 |
837 |
842 |
843 |
844 |
845 |
846 |
847 |
848 |
849 |
850 |
851 |
852 |
853 |
854 |
855 |
856 |
857 |
858 |
859 |
860 |
861 |
862 |
863 |
864 |
865 |
866 |
867 |
868 |
869 |
870 |
871 |
872 |
873 |
874 |
875 |
876 |
877 |
878 |
883 |
884 |
885 |
886 |
887 |
888 |
889 |
890 |
891 |
892 |
893 |
894 |
895 |
896 |
897 |
898 |
899 |
900 |
901 |
902 |
903 |
904 |
905 |
906 |
907 |
908 |
909 | Must select some files in the IDE or set javac.includes
910 |
911 |
912 |
913 |
914 |
915 |
916 |
917 |
918 |
919 |
920 |
921 |
926 |
927 |
928 |
929 |
930 |
931 |
932 |
933 | Some tests failed; see details above.
934 |
935 |
936 |
937 |
938 |
939 |
940 |
941 |
942 | Must select some files in the IDE or set test.includes
943 |
944 |
945 |
946 | Some tests failed; see details above.
947 |
948 |
949 |
954 |
955 | Must select one file in the IDE or set test.class
956 |
957 |
958 |
959 |
960 |
961 |
962 |
963 |
964 |
965 |
966 |
967 |
968 |
969 |
970 |
971 |
972 |
973 |
974 |
975 |
976 |
977 |
978 |
979 |
980 |
985 |
986 | Must select one file in the IDE or set applet.url
987 |
988 |
989 |
990 |
991 |
992 |
993 |
998 |
999 | Must select one file in the IDE or set applet.url
1000 |
1001 |
1002 |
1003 |
1004 |
1005 |
1006 |
1007 |
1012 |
1013 |
1014 |
1015 |
1016 |
1017 |
1018 |
1019 |
1020 |
1021 |
1022 |
1023 |
1024 |
1025 |
1026 |
1027 |
1028 |
1029 |
1030 |
1031 |
1032 |
1033 |
1034 |
1035 |
1036 |
1037 |
1038 |
1039 |
1040 |
1041 |
1042 |
1043 |
1044 |
1045 |
1046 |
1047 |
1048 |
1049 |
1050 |
1051 |
1052 |
1053 |
1054 |
--------------------------------------------------------------------------------
/nbproject/genfiles.properties:
--------------------------------------------------------------------------------
1 | build.xml.data.CRC32=af46b28f
2 | build.xml.script.CRC32=f2d066c4
3 | build.xml.stylesheet.CRC32=28e38971@1.44.1.45
4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6 | nbproject/build-impl.xml.data.CRC32=af46b28f
7 | nbproject/build-impl.xml.script.CRC32=28e51663
8 | nbproject/build-impl.xml.stylesheet.CRC32=fcddb364@1.50.3.46
9 |
--------------------------------------------------------------------------------
/nbproject/project.properties:
--------------------------------------------------------------------------------
1 | annotation.processing.enabled=true
2 | annotation.processing.enabled.in.editor=false
3 | annotation.processing.processor.options=
4 | annotation.processing.processors.list=
5 | annotation.processing.run.all.processors=true
6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
7 | build.classes.dir=${build.dir}/classes
8 | build.classes.excludes=**/*.java,**/*.form
9 | # This directory is removed when the project is cleaned:
10 | build.dir=build
11 | build.generated.dir=${build.dir}/generated
12 | build.generated.sources.dir=${build.dir}/generated-sources
13 | # Only compile against the classpath explicitly listed here:
14 | build.sysclasspath=ignore
15 | build.test.classes.dir=${build.dir}/test/classes
16 | build.test.results.dir=${build.dir}/test/results
17 | # Uncomment to specify the preferred debugger connection transport:
18 | #debug.transport=dt_socket
19 | debug.classpath=\
20 | ${run.classpath}
21 | debug.test.classpath=\
22 | ${run.test.classpath}
23 | # This directory is removed when the project is cleaned:
24 | dist.dir=dist
25 | dist.jar=${dist.dir}/Universal G-Code Sender.jar
26 | dist.javadoc.dir=${dist.dir}/javadoc
27 | excludes=
28 | file.reference.RXTXcomm.jar=lib/RXTXcomm.jar
29 | includes=**
30 | jar.compress=false
31 | javac.classpath=\
32 | ${libs.swing-layout.classpath}:\
33 | ${file.reference.RXTXcomm.jar}
34 | # Space-separated list of extra javac options
35 | javac.compilerargs=
36 | javac.deprecation=false
37 | javac.processorpath=\
38 | ${javac.classpath}
39 | javac.source=1.6
40 | javac.target=1.6
41 | javac.test.classpath=\
42 | ${javac.classpath}:\
43 | ${build.classes.dir}
44 | javac.test.processorpath=\
45 | ${javac.test.classpath}
46 | javadoc.additionalparam=
47 | javadoc.author=false
48 | javadoc.encoding=${source.encoding}
49 | javadoc.noindex=false
50 | javadoc.nonavbar=false
51 | javadoc.notree=false
52 | javadoc.private=false
53 | javadoc.splitindex=true
54 | javadoc.use=true
55 | javadoc.version=false
56 | javadoc.windowtitle=
57 | main.class=com.willwinder.universalgcodesender.MainWindow
58 | manifest.file=manifest.mf
59 | meta.inf.dir=${src.dir}/META-INF
60 | mkdist.disabled=false
61 | platform.active=default_platform
62 | run.classpath=\
63 | ${javac.classpath}:\
64 | ${build.classes.dir}
65 | # Space-separated list of JVM arguments used when running the project
66 | # (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
67 | # or test-sys-prop.name=value to set system properties for unit tests):
68 | run.jvmargs=
69 | run.test.classpath=\
70 | ${javac.test.classpath}:\
71 | ${build.test.classes.dir}
72 | source.encoding=UTF-8
73 | src.dir=src
74 | test.src.dir=test
75 |
--------------------------------------------------------------------------------
/nbproject/project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.netbeans.modules.java.j2seproject
4 |
5 |
6 | Universal G-Code Sender
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/one-jar-ant-task.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/onejar.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Ant-Version: Apache Ant 1.8.2
3 | Main-Class: com.simontuffs.onejar.Boot
4 | Class-Path: lib/RXTXcomm.jar lib/swing-layout-1.0.4.jar
5 | One-Jar-Main-Class: com.willwinder.universalgcodesender.MainWindow
6 |
7 |
--------------------------------------------------------------------------------
/pictures/command_table_tab.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grbl/Universal-G-Code-Sender/47f8a02cbdb4da084e71a4b5a2d139de6d1fe0be/pictures/command_table_tab.png
--------------------------------------------------------------------------------
/pictures/console_tab.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grbl/Universal-G-Code-Sender/47f8a02cbdb4da084e71a4b5a2d139de6d1fe0be/pictures/console_tab.png
--------------------------------------------------------------------------------
/pictures/finished_sending_file_1.0.5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grbl/Universal-G-Code-Sender/47f8a02cbdb4da084e71a4b5a2d139de6d1fe0be/pictures/finished_sending_file_1.0.5.png
--------------------------------------------------------------------------------
/pictures/manualcontrol.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grbl/Universal-G-Code-Sender/47f8a02cbdb4da084e71a4b5a2d139de6d1fe0be/pictures/manualcontrol.png
--------------------------------------------------------------------------------
/pictures/sending_file_1.0.5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grbl/Universal-G-Code-Sender/47f8a02cbdb4da084e71a4b5a2d139de6d1fe0be/pictures/sending_file_1.0.5.png
--------------------------------------------------------------------------------
/src/com/willwinder/universalgcodesender/CommUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Collection of useful Comm related utilities.
3 | */
4 |
5 | /*
6 | Copywrite 2012 Will Winder
7 |
8 | This file is part of Universal Gcode Sender (UGS).
9 |
10 | UGS is free software: you can redistribute it and/or modify
11 | it under the terms of the GNU General Public License as published by
12 | the Free Software Foundation, either version 3 of the License, or
13 | (at your option) any later version.
14 |
15 | UGS is distributed in the hope that it will be useful,
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | GNU General Public License for more details.
19 |
20 | You should have received a copy of the GNU General Public License
21 | along with UGS. If not, see .
22 | */
23 |
24 | package com.willwinder.universalgcodesender;
25 |
26 | import gnu.io.CommPortIdentifier;
27 | import java.io.IOException;
28 | import java.io.InputStream;
29 | import java.util.Iterator;
30 | import java.util.List;
31 | import java.util.regex.Matcher;
32 | import java.util.regex.Pattern;
33 |
34 | /**
35 | *
36 | * @author wwinder
37 | */
38 | public class CommUtils {
39 | // Note: One character of this buffer is reserved for real time commands.
40 | public static final int GRBL_RX_BUFFER_SIZE= 127;
41 |
42 | /**
43 | * Real-time commands
44 | */
45 | public static final byte GRBL_PAUSE_COMMAND = '!';
46 | public static final byte GRBL_RESUME_COMMAND = '~';
47 | public static final byte GRBL_STATUS_COMMAND = '?';
48 | public static final byte GRBL_RESET_COMMAND = 0x18;
49 |
50 | /**
51 | * Gcode Commands
52 | */
53 | public static final String GCODE_RESET_COORDINATES_TO_ZERO = "G92 X0 Y0 Z0";
54 | public static final String GCODE_RETURN_TO_ZERO_LOCATION = "G0 X0 Y0 Z0";
55 | public static final String GCODE_PERFORM_HOMING_CYCLE = "G28 X0 Y0 Z0";
56 |
57 | public enum Capabilities {
58 | REAL_TIME, POSITION_C
59 | }
60 |
61 | /**
62 | * Generates a list of available serial ports.
63 | */
64 | static java.util.List getSerialPortList() {
65 | int type = CommPortIdentifier.PORT_SERIAL;
66 |
67 | java.util.Enumeration portEnum =
68 | CommPortIdentifier.getPortIdentifiers();
69 | java.util.List returnList =
70 | new java.util.ArrayList();
71 |
72 | while ( portEnum.hasMoreElements() )
73 | {
74 | CommPortIdentifier portIdentifier = portEnum.nextElement();
75 | if (portIdentifier.getPortType() == type) {
76 | returnList.add(portIdentifier);
77 | }
78 | }
79 | return returnList;
80 | }
81 |
82 | /**
83 | * Reads characters from the input stream until a terminating pattern is
84 | * reached.
85 | */
86 | static String readLineFromCommUntil(InputStream in, String term) throws IOException {
87 |
88 | if (term == null || term.length() == 0) {
89 | return "";
90 | }
91 |
92 | int data;
93 | StringBuilder buffer = new StringBuilder();
94 | int terminatorPosition = 0;
95 |
96 | while ( ( data = in.read()) > -1 ) {
97 | // My funky way of checking for the terminating characters..
98 | if ( data == term.charAt(terminatorPosition) ) {
99 | terminatorPosition++;
100 | } else {
101 | terminatorPosition = 0;
102 | }
103 |
104 | if (terminatorPosition == term.length()) {
105 | break;
106 | }
107 |
108 | buffer.append((char)data);
109 | }
110 |
111 | return buffer.toString();
112 | }
113 |
114 | /**
115 | * Checks if there is enough room in the GRBL buffer for nextCommand.
116 | */
117 | static Boolean checkRoomInBuffer(List list, GcodeCommand nextCommand) {
118 | String command = nextCommand.getCommandString();
119 | int characters = getSizeOfBuffer(list);
120 | // TODO: Carefully trace the newlines in commands and make sure
121 | // the GRBL_RX_BUFFER_SIZE is honored.
122 | // For now add a safety character to each command.
123 | characters += command.length() + 1;
124 | return characters < CommUtils.GRBL_RX_BUFFER_SIZE;
125 | }
126 |
127 | static int getSizeOfBuffer(List list) {
128 | int characters = 0;
129 | // Number of characters in list.
130 | Iterator iter = list.iterator();
131 | while (iter.hasNext()) {
132 | String next = iter.next().toString();
133 | // TODO: Carefully trace the newlines in commands and make sure
134 | // the GRBL_RX_BUFFER_SIZE is honored.
135 | // For now add a safety character to each command.
136 | characters += next.length() + 1;
137 | }
138 | return characters;
139 | }
140 |
141 | /**
142 | * Searches the command string for an 'f' and replaces the speed value
143 | * between the 'f' and the next space with a percentage of that speed.
144 | * In that way all speed values become a ratio of the provided speed
145 | * and don't get overridden with just a fixed speed.
146 | */
147 | static String overrideSpeed(String command, Integer speed) {
148 | String returnString = command;
149 |
150 | // Check if command sets feed speed.
151 | Pattern pattern = Pattern.compile("F([0-9.]+)", Pattern.CASE_INSENSITIVE);
152 | Matcher matcher = pattern.matcher(command);
153 | if (matcher.find()){
154 | Double originalFeedRate = Double.parseDouble(matcher.group(1));
155 | //System.out.println( "Found feed " + originalFeedRate.toString() );
156 | Double newFeedRate = originalFeedRate * speed / 100.0;
157 | //System.out.println( "Change to feed " + newFeedRate.toString() );
158 | returnString = matcher.replaceAll( "F" + newFeedRate.toString() );
159 | }
160 |
161 | return returnString;
162 | }
163 |
164 | /**
165 | * Removes any comments within parentheses or beginning with a semi-colon.
166 | */
167 | static String removeComment(String command) {
168 | String newCommand = command;
169 |
170 | // Remove any comments within ( parentheses ) with regex "\([^\(]*\)"
171 | newCommand = newCommand.replaceAll("\\([^\\(]*\\)", "");
172 |
173 | // Remove any comment beginning with ';' with regex "\;[^\\(]*"
174 | newCommand = newCommand.replaceAll("\\;[^\\\\(]*", "");
175 |
176 | return newCommand;
177 | }
178 |
179 | /**
180 | * Searches for a comment in the input string and returns the first match.
181 | */
182 | static String parseComment(String command) {
183 | String comment = "";
184 |
185 | // REGEX: Find any comment, includes the comment characters:
186 | // "(?<=\()[^\(\)]*|(?<=\;)[^;]*"
187 | // "(?<=\\()[^\\(\\)]*|(?<=\\;)[^;]*"
188 |
189 | Pattern pattern = Pattern.compile("(?<=\\()[^\\(\\)]*|(?<=\\;)[^;]*");
190 | Matcher matcher = pattern.matcher(command);
191 | if (matcher.find()){
192 | comment = matcher.group(0);
193 | }
194 |
195 | return comment;
196 | }
197 | }
198 |
--------------------------------------------------------------------------------
/src/com/willwinder/universalgcodesender/Coordinate.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Simple coordinate class.
3 | */
4 |
5 | /*
6 | Copywrite 2012 Will Winder
7 |
8 | This file is part of Universal Gcode Sender (UGS).
9 |
10 | UGS is free software: you can redistribute it and/or modify
11 | it under the terms of the GNU General Public License as published by
12 | the Free Software Foundation, either version 3 of the License, or
13 | (at your option) any later version.
14 |
15 | UGS is distributed in the hope that it will be useful,
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | GNU General Public License for more details.
19 |
20 | You should have received a copy of the GNU General Public License
21 | along with UGS. If not, see .
22 | */
23 |
24 | package com.willwinder.universalgcodesender;
25 |
26 | /**
27 | *
28 | * @author wwinder
29 | */
30 | public class Coordinate {
31 | private Double x,y,z;
32 |
33 | Coordinate(double x, double y, double z) {
34 | this.x = x;
35 | this.y = y;
36 | this.z = z;
37 | }
38 |
39 | void setCoordinates(Coordinate coord) {
40 | this.x = coord.getX();
41 | this.y = coord.getY();
42 | this.z = coord.getZ();
43 | }
44 |
45 | void setX(double x) {
46 | this.x = x;
47 | }
48 |
49 | void setY(double y) {
50 | this.y = y;
51 | }
52 |
53 | void setZ(double z) {
54 | this.z = z;
55 | }
56 |
57 | Double getX() {
58 | return this.x;
59 | }
60 |
61 | Double getY() {
62 | return this.y;
63 | }
64 |
65 | Double getZ() {
66 | return this.z;
67 | }
68 |
69 | @Override
70 | public String toString() {
71 | return "("+x+", "+y+", "+z+")";
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/src/com/willwinder/universalgcodesender/GcodeCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * An object representing a single GcodeCommand. The only tricky part about this
3 | * class is the commandNum, which is used in the GUI for indexing a table of
4 | * these objects.
5 | *
6 | * TODO: Get rid of the commandNum member.
7 | */
8 |
9 | /*
10 | Copywrite 2012 Will Winder
11 |
12 | This file is part of Universal Gcode Sender (UGS).
13 |
14 | UGS is free software: you can redistribute it and/or modify
15 | it under the terms of the GNU General Public License as published by
16 | the Free Software Foundation, either version 3 of the License, or
17 | (at your option) any later version.
18 |
19 | UGS is distributed in the hope that it will be useful,
20 | but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 | GNU General Public License for more details.
23 |
24 | You should have received a copy of the GNU General Public License
25 | along with UGS. If not, see .
26 | */
27 |
28 | package com.willwinder.universalgcodesender;
29 |
30 | /**
31 | *
32 | * @author wwinder
33 | */
34 | public class GcodeCommand {
35 | private String command;
36 | private String response;
37 | private String responseType;
38 | private Boolean sent = false;
39 | private Boolean done = false;
40 | private Boolean isOk = false;
41 | private Boolean isError = false;
42 | private Integer commandNum = -1;
43 |
44 | public GcodeCommand(String command) {
45 | this.command = command;
46 | }
47 |
48 | public GcodeCommand(String command, int num) {
49 | this.command = command;
50 | this.commandNum = num;
51 | }
52 |
53 | /** Setters. */
54 | public void setCommand(String command) {
55 | this.command = command;
56 | }
57 |
58 | public void setCommandNumber(int i) {
59 | this.commandNum = i;
60 | }
61 |
62 | public void setResponse(String response) {
63 | this.response = response;
64 | this.parseResponse();
65 | this.done = this.isDone();
66 | }
67 |
68 | public void setSent(Boolean sent) {
69 | this.sent = sent;
70 | }
71 |
72 | /** Getters. */
73 | @Override
74 | public String toString() {
75 | return getCommandString() + "("+commandNum+")";
76 | }
77 |
78 | public String getCommandString() {
79 | return this.command;
80 | }
81 |
82 | public int getCommandNumber() {
83 | return this.commandNum;
84 | }
85 |
86 | public String getResponse() {
87 | return this.response;
88 | }
89 |
90 | public Boolean isSent() {
91 | return this.sent;
92 | }
93 |
94 | public Boolean isOk() {
95 | return this.isOk;
96 | }
97 |
98 | public Boolean isError() {
99 | return this.isError;
100 | }
101 |
102 | public Boolean parseResponse() {
103 | // No response? Set it to false.
104 | if (response.length() < 0) {
105 | this.isOk = false;
106 | this.isError = false;
107 | }
108 |
109 | // Command complete, can be 'ok' or 'error'.
110 | if (response.toLowerCase().equals("ok")) {
111 | this.isOk = true;
112 | this.isError = false;
113 | } else if (response.toLowerCase().startsWith("error")) {
114 | this.isOk = false;
115 | this.isError = true;
116 | }
117 |
118 | return this.isOk;
119 | }
120 |
121 | public String responseString() {
122 | String returnString = "";
123 | String number = "";
124 |
125 | if (this.commandNum != -1) {
126 | number = this.commandNum.toString();
127 | }
128 | if (this.isOk) {
129 | returnString = "ok" + number;
130 | }
131 | else if (this.isError) {
132 | returnString = "error"+number+"["+response.substring("error: ".length()) + "]";
133 | }
134 |
135 | return returnString;
136 | }
137 |
138 | public Boolean isDone() {
139 | return (this.response != null);
140 | }
141 |
142 | public static Boolean isOkErrorResponse(String response) {
143 | if (response.toLowerCase().equals("ok")) {
144 | return true;
145 | } else if (response.toLowerCase().startsWith("error")) {
146 | return true;
147 | }
148 | return false;
149 | }
150 | }
151 |
--------------------------------------------------------------------------------
/src/com/willwinder/universalgcodesender/GcodeCommandBuffer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A queue wrapper for GcodeCommand objects. The main purpose of this class is
3 | * to handle indexing of GcodeCommands and to pre-load the next command so that
4 | * whatever is "next" is available to the SerialCommunicator.
5 | */
6 |
7 | /*
8 | Copywrite 2012 Will Winder
9 |
10 | This file is part of Universal Gcode Sender (UGS).
11 |
12 | UGS is free software: you can redistribute it and/or modify
13 | it under the terms of the GNU General Public License as published by
14 | the Free Software Foundation, either version 3 of the License, or
15 | (at your option) any later version.
16 |
17 | UGS is distributed in the hope that it will be useful,
18 | but WITHOUT ANY WARRANTY; without even the implied warranty of
19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 | GNU General Public License for more details.
21 |
22 | You should have received a copy of the GNU General Public License
23 | along with UGS. If not, see .
24 | */
25 |
26 | package com.willwinder.universalgcodesender;
27 |
28 | import java.io.*;
29 | import java.util.*;
30 |
31 | /**
32 | *
33 | * @author wwinder
34 | */
35 | public class GcodeCommandBuffer {
36 | private Queue commandQueue;
37 | private GcodeCommand currentCommand = null;
38 | private int numCommands = 0;
39 |
40 | GcodeCommandBuffer() {
41 | this.commandQueue = new LinkedList();
42 | }
43 |
44 | int size() {
45 | return this.commandQueue.size();
46 | }
47 |
48 | Boolean hasNext() {
49 | return this.commandQueue.size() > 0;
50 | }
51 |
52 | GcodeCommand currentCommand() {
53 | return currentCommand;
54 | }
55 |
56 | GcodeCommand nextCommand() {
57 | // Leave the "currentCommand" alone if we've exausted the queue.
58 | if (this.hasNext()) {
59 | this.currentCommand = this.commandQueue.remove();
60 | }
61 |
62 | return this.currentCommand();
63 | }
64 |
65 | GcodeCommand appendCommandString(String commandString) {
66 | GcodeCommand command = new GcodeCommand(commandString);
67 | command.setCommandNumber(this.numCommands++);
68 | this.commandQueue.add(command);
69 |
70 | // Preload first command, or next command if the first batch finished.
71 | if (this.currentCommand == null || this.currentCommand.isSent()) {
72 | this.nextCommand();
73 | }
74 |
75 | return command;
76 | }
77 |
78 | void clearBuffer() {
79 | this.currentCommand = null;
80 | this.commandQueue.clear();
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/src/com/willwinder/universalgcodesender/GrblUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Collection of useful Grbl related utilities.
3 | */
4 |
5 | /*
6 | Copywrite 2012 Will Winder
7 |
8 | This file is part of Universal Gcode Sender (UGS).
9 |
10 | UGS is free software: you can redistribute it and/or modify
11 | it under the terms of the GNU General Public License as published by
12 | the Free Software Foundation, either version 3 of the License, or
13 | (at your option) any later version.
14 |
15 | UGS is distributed in the hope that it will be useful,
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | GNU General Public License for more details.
19 |
20 | You should have received a copy of the GNU General Public License
21 | along with UGS. If not, see .
22 | */
23 |
24 | package com.willwinder.universalgcodesender;
25 |
26 | import java.util.regex.Matcher;
27 | import java.util.regex.Pattern;
28 |
29 | /**
30 | *
31 | * @author wwinder
32 | */
33 | public class GrblUtils {
34 | /**
35 | * Checks if the string contains the GRBL version.
36 | */
37 | static Boolean isGrblVersionString(final String response) {
38 | return response.startsWith("Grbl ") && (getVersionDouble(response) != -1);
39 | }
40 |
41 | /**
42 | * Parses the version double out of the version response string.
43 | */
44 | static double getVersionDouble(final String response) {
45 | double retValue = -1;
46 | final String VERSION_REGEX = "[0-9]*\\.[0-9]*";
47 |
48 | // Search for a version.
49 | Pattern pattern = Pattern.compile(VERSION_REGEX);
50 | Matcher matcher = pattern.matcher(response);
51 | if (matcher.find()) {
52 | retValue = Double.parseDouble(matcher.group(0));
53 | }
54 |
55 | return retValue;
56 | }
57 |
58 | static String getVersionLetter(final String response) {
59 | String retValue = null;
60 | final String VERSION_REGEX = "(?<=[0-9]\\.[0-9])[a-zA-Z]";
61 |
62 | // Search for a version.
63 | Pattern pattern = Pattern.compile(VERSION_REGEX);
64 | Matcher matcher = pattern.matcher(response);
65 | if (matcher.find()) {
66 | retValue = matcher.group(0);
67 | //retValue = Double.parseDouble(matcher.group(0));
68 | }
69 |
70 | return retValue;
71 |
72 | }
73 |
74 | /**
75 | * Determines if the version of GRBL is capable of realtime commands.
76 | */
77 | static Boolean isRealTimeCapable(final double version) {
78 | return version > 0.7;
79 | }
80 |
81 | /**
82 | * Determines version of GRBL position capability.
83 | */
84 | static CommUtils.Capabilities getGrblPositionCapabilities(final double version, final String letter) {
85 | if (version == 0.8 && letter.equals("c")) {
86 | return CommUtils.Capabilities.POSITION_C;
87 | }
88 |
89 | return null;
90 | }
91 |
92 | /**
93 | * Check if a string contains a GRBL position string.
94 | */
95 | static Boolean isGrblPositionString(final String response) {
96 | double retValue = -1;
97 | final String REGEX = "\\<.*\\>";
98 |
99 | // Search for a version.
100 | Pattern pattern = Pattern.compile(REGEX);
101 | Matcher matcher = pattern.matcher(response);
102 | if (matcher.find()) {
103 | return true;
104 | }
105 | return false;
106 | }
107 |
108 | /**
109 | * Parse status out of position string.
110 | */
111 | static String getStatusFromPositionString(final String position, final CommUtils.Capabilities version) {
112 | String retValue = null;
113 | String REGEX;
114 |
115 | if (version == CommUtils.Capabilities.POSITION_C) {
116 | REGEX = "(?<=\\<)[a-zA-z]*(?=[,])";
117 | } else {
118 | return null;
119 | }
120 |
121 |
122 | // Search for a version.
123 | Pattern pattern = Pattern.compile(REGEX);
124 | Matcher matcher = pattern.matcher(position);
125 | if (matcher.find()) {
126 | retValue = matcher.group(0);;
127 | }
128 |
129 | return retValue;
130 | }
131 |
132 |
133 | static Coordinate getMachinePositionFromPositionString(final String position, final CommUtils.Capabilities version) {
134 | Coordinate ret = null;
135 | String REGEX;
136 |
137 | if (version == CommUtils.Capabilities.POSITION_C) {
138 | REGEX = "(?<=MPos:)(-?\\d*\\..\\d*),(-?\\d*\\..\\d*),(-?\\d*\\..\\d*)(?=,WPos:)";
139 | } else {
140 | return null;
141 | }
142 |
143 | // Search for a version.
144 | Pattern pattern = Pattern.compile(REGEX);
145 | Matcher matcher = pattern.matcher(position);
146 | if (matcher.find()) {
147 | ret = new Coordinate( Double.parseDouble(matcher.group(1)),
148 | Double.parseDouble(matcher.group(2)),
149 | Double.parseDouble(matcher.group(3)));
150 | }
151 |
152 | return ret;
153 | }
154 |
155 | static Coordinate getWorkPositionFromPositionString(final String position, final CommUtils.Capabilities version) {
156 | Coordinate ret = null;
157 | String REGEX;
158 |
159 | if (version == CommUtils.Capabilities.POSITION_C) {
160 | REGEX = "(?<=WPos:)(\\-?\\d*\\..\\d*),(\\-?\\d*\\..\\d*),(\\-?\\d*\\..\\d*)";
161 | } else {
162 | return null;
163 | }
164 |
165 | // Search for a version.
166 | Pattern pattern = Pattern.compile(REGEX);
167 | Matcher matcher = pattern.matcher(position);
168 | if (matcher.find()) {
169 | ret = new Coordinate( Double.parseDouble(matcher.group(1)),
170 | Double.parseDouble(matcher.group(2)),
171 | Double.parseDouble(matcher.group(3)));
172 | }
173 |
174 | return ret;
175 | }
176 | }
177 |
--------------------------------------------------------------------------------
/src/com/willwinder/universalgcodesender/SerialCommunicator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Serial port interface class. Also coordinates a buffer of Gcode commands.
3 | */
4 |
5 | /*
6 | Copywrite 2012 Will Winder
7 |
8 | This file is part of Universal Gcode Sender (UGS).
9 |
10 | UGS is free software: you can redistribute it and/or modify
11 | it under the terms of the GNU General Public License as published by
12 | the Free Software Foundation, either version 3 of the License, or
13 | (at your option) any later version.
14 |
15 | UGS is distributed in the hope that it will be useful,
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | GNU General Public License for more details.
19 |
20 | You should have received a copy of the GNU General Public License
21 | along with UGS. If not, see .
22 | */
23 |
24 | package com.willwinder.universalgcodesender;
25 |
26 | import gnu.io.*;
27 | import java.awt.event.ActionEvent;
28 | import java.awt.event.ActionListener;
29 | import java.io.*;
30 | import java.util.LinkedList;
31 | import java.util.TooManyListenersException;
32 | import java.util.logging.Level;
33 | import java.util.logging.Logger;
34 | import javax.swing.Timer;
35 |
36 | /**
37 | *
38 | * @author wwinder
39 | */
40 | public class SerialCommunicator implements SerialPortEventListener{
41 | private double grblVersion; // The 0.8 in 'Grbl 0.8c'
42 | private String grblVersionLetter; // The c in 'Grbl 0.8c'
43 |
44 | private Boolean realTimeMode = false;
45 | private Boolean realTimePosition = false;
46 | private CommUtils.Capabilities positionMode = null;
47 |
48 | // General variables
49 | private CommPort commPort;
50 | private InputStream in;
51 | private OutputStream out;
52 | private String lineTerminator = "\r\n";
53 | private boolean isPositionPending = false;
54 | private Timer positionPollTimer = null;
55 | // File transfer variables.
56 | private Boolean sendPaused = false;
57 | private boolean fileMode = false;
58 | private File file = null;
59 | private GcodeCommandBuffer commandBuffer; // All commands in a file
60 | private LinkedList activeCommandList; // Currently running commands
61 |
62 | // Callback interfaces
63 | SerialCommunicatorListener fileStreamCompleteListener;
64 | SerialCommunicatorListener commandQueuedListener;
65 | SerialCommunicatorListener commandSentListener;
66 | SerialCommunicatorListener commandCommentListener;
67 | SerialCommunicatorListener commandCompleteListener;
68 | SerialCommunicatorListener commandPreprocessorListener;
69 | SerialCommunicatorListener commConsoleListener;
70 | SerialCommunicatorListener commVerboseConsoleListener;
71 | SerialCommunicatorListener capabilitiesListener;
72 | SerialCommunicatorListener positionListener;
73 |
74 | /** Getters & Setters. */
75 | void setLineTerminator(String terminator) {
76 | if (terminator.length() < 1) {
77 | this.lineTerminator = "\r\n";
78 | } else {
79 | this.lineTerminator = terminator;
80 | }
81 | }
82 |
83 | // Register for callbacks
84 | void setListenAll(SerialCommunicatorListener fscl) {
85 | this.setFileStreamCompleteListener(fscl);
86 | this.setCommandQueuedListener(fscl);
87 | this.setCommandSentListener(fscl);
88 | this.setCommandCompleteListener(fscl);
89 | this.setCommandCommentListener(fscl);
90 | this.setCommandPreprocessorListener(fscl);
91 | this.setCommConsoleListener(fscl);
92 | this.setCommVerboseConsoleListener(fscl);
93 | this.setCapabilitiesListener(fscl);
94 | this.setPositionStringListener(fscl);
95 | }
96 |
97 | void setFileStreamCompleteListener(SerialCommunicatorListener fscl) {
98 | this.fileStreamCompleteListener = fscl;
99 | }
100 |
101 | void setCommandQueuedListener(SerialCommunicatorListener fscl) {
102 | this.commandQueuedListener = fscl;
103 | }
104 |
105 | void setCommandSentListener(SerialCommunicatorListener fscl) {
106 | this.commandSentListener = fscl;
107 | }
108 |
109 | void setCommandCommentListener(SerialCommunicatorListener fscl) {
110 | this.commandCommentListener = fscl;
111 | }
112 |
113 | void setCommandCompleteListener(SerialCommunicatorListener fscl) {
114 | this.commandCompleteListener = fscl;
115 | }
116 |
117 | void setCommandPreprocessorListener(SerialCommunicatorListener fscl) {
118 | this.commandPreprocessorListener = fscl;
119 | }
120 |
121 | void setCommConsoleListener(SerialCommunicatorListener fscl) {
122 | this.commConsoleListener = fscl;
123 | }
124 |
125 | void setCommVerboseConsoleListener(SerialCommunicatorListener fscl) {
126 | this.commVerboseConsoleListener = fscl;
127 | }
128 |
129 | void setCapabilitiesListener(SerialCommunicatorListener fscl) {
130 | this.capabilitiesListener = fscl;
131 | }
132 |
133 | void setPositionStringListener(SerialCommunicatorListener fscl) {
134 | this.positionListener = fscl;
135 | }
136 |
137 |
138 | // Must create /var/lock on OSX, fixed in more current RXTX (supposidly):
139 | // $ sudo mkdir /var/lock
140 | // $ sudo chmod 777 /var/lock
141 | synchronized boolean openCommPort(String name, int baud)
142 | throws NoSuchPortException, PortInUseException,
143 | UnsupportedCommOperationException, IOException,
144 | TooManyListenersException {
145 |
146 | this.commandBuffer = new GcodeCommandBuffer();
147 | this.activeCommandList = new LinkedList();
148 |
149 | boolean returnCode;
150 |
151 | CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(name);
152 |
153 | if (portIdentifier.isCurrentlyOwned()) {
154 | returnCode = false;
155 | } else {
156 | this.commPort = portIdentifier.open(this.getClass().getName(), 2000);
157 |
158 | SerialPort serialPort = (SerialPort) this.commPort;
159 | serialPort.setSerialPortParams(baud,SerialPort.DATABITS_8,SerialPort.STOPBITS_1,SerialPort.PARITY_NONE);
160 |
161 | this.in = serialPort.getInputStream();
162 | this.out = serialPort.getOutputStream();
163 |
164 | serialPort.addEventListener(this);
165 | serialPort.notifyOnDataAvailable(true);
166 | serialPort.notifyOnBreakInterrupt(true);
167 |
168 | this.sendMessageToConsoleListener("**** Connected to "
169 | + name
170 | + " @ "
171 | + baud
172 | + " baud ****\n");
173 |
174 | returnCode = true;
175 | }
176 |
177 | return returnCode;
178 | }
179 |
180 | void closeCommPort() {
181 |
182 | this.cancelSend();
183 |
184 | this.stopPollingPosition();
185 |
186 | try {
187 | in.close();
188 | out.close();
189 | } catch (IOException ex) {
190 | Logger.getLogger(SerialCommunicator.class.getName()).log(Level.SEVERE, null, ex);
191 | }
192 |
193 | SerialPort serialPort = (SerialPort) this.commPort;
194 | serialPort.removeEventListener();
195 | this.commPort.close();
196 |
197 | this.sendMessageToConsoleListener("**** Connection closed ****\n");
198 | }
199 |
200 | void queueStringForComm(String commandString) throws Exception {
201 | if (this.fileMode) {
202 | throw new Exception("Cannot add commands while in file mode.");
203 | }
204 |
205 | // Add command to queue
206 | GcodeCommand command = this.commandBuffer.appendCommandString(commandString);
207 |
208 | if (this.commandQueuedListener != null) {
209 | this.commandQueuedListener.commandQueued(command);
210 | }
211 |
212 | // Send command to the serial port.
213 | this.streamCommands();
214 | }
215 |
216 | /**
217 | * Sends a command to the serial device.
218 | * @param command Command to be sent to serial device.
219 | */
220 | void sendStringToComm(String command) {
221 | // Command already has a newline attached.
222 | this.sendMessageToConsoleListener(">>> " + command);
223 |
224 | // Send command to the serial port.
225 | PrintStream printStream = new PrintStream(this.out);
226 | printStream.print(command);
227 | printStream.close();
228 | }
229 |
230 | /**
231 | * Immediately sends a byte, used for real-time commands.
232 | */
233 | void sendByteImmediately(byte b) throws IOException {
234 | out.write(b);
235 | }
236 |
237 | /*
238 | // TODO: Figure out why this isn't working ...
239 | boolean isCommPortOpen() throws NoSuchPortException {
240 | CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(this.commPort.getName());
241 | String owner = portIdentifier.getCurrentOwner();
242 | String thisClass = this.getClass().getName();
243 |
244 | return portIdentifier.isCurrentlyOwned() && owner.equals(thisClass);
245 | }
246 | */
247 |
248 | /** File Stream Methods. **/
249 |
250 | void isReadyToStreamFile() throws Exception {
251 | if (this.fileMode == true) {
252 | throw new Exception("Already sending a file.");
253 | }
254 | if ((this.commandBuffer.size() > 0) &&
255 | (this.commandBuffer.currentCommand().isDone() != true)) {
256 | throw new Exception("Cannot send file until there are no commands running. (Commands remaining in command buffer)");
257 | }
258 | if (this.activeCommandList.size() > 0) {
259 | throw new Exception("Cannot send file until there are no commands running. (Active Command List > 0).");
260 | }
261 |
262 | }
263 |
264 | // Setup for streaming to serial port then launch the first command.
265 | void streamFileToComm(File commandfile) throws Exception {
266 | isReadyToStreamFile();
267 |
268 | // Get command list.
269 | try {
270 | this.file = commandfile;
271 |
272 | FileInputStream fstream = new FileInputStream(this.file);
273 | DataInputStream dis = new DataInputStream(fstream);
274 | BufferedReader fileStream = new BufferedReader(new InputStreamReader(dis));
275 |
276 | String line;
277 | GcodeCommand command;
278 | while ((line = fileStream.readLine()) != null) {
279 | // Add command to queue
280 | command = this.commandBuffer.appendCommandString(line + '\n');
281 |
282 | // Notify listener of new command
283 | if (this.commandQueuedListener != null) {
284 | this.commandQueuedListener.commandQueued(command);
285 | }
286 | }
287 | } catch (Exception e) {
288 | // On error, wrap up then re-throw exception for GUI to display.
289 | finishStreamFileToComm();
290 | throw e;
291 | }
292 |
293 | // Now that we are setup for file mode, enable and begin streaming.
294 | this.fileMode = true;
295 |
296 | // Start sending commands.
297 | this.streamCommands();
298 | }
299 |
300 | void streamCommands() {
301 | boolean skip;
302 |
303 | // The GcodeCommandBuffer class always preloads the next command, so as
304 | // long as the currentCommand exists and hasn't been sent it is the next
305 | // which should be sent.
306 |
307 | while ((this.commandBuffer.currentCommand().isSent() == false) &&
308 | CommUtils.checkRoomInBuffer(this.activeCommandList, this.commandBuffer.currentCommand())) {
309 |
310 | skip = false;
311 | GcodeCommand command = this.commandBuffer.currentCommand();
312 |
313 | // Allow a command preprocessor listener to preprocess the command.
314 | if (this.commandPreprocessorListener != null) {
315 | String processed = this.commandPreprocessorListener.preprocessCommand(command.getCommandString());
316 |
317 | // If the lengths differ, update the latest comment.
318 | if (this.commandCommentListener != null) {
319 | if (processed.length() != command.getCommandString().length()) {
320 | this.commandCommentListener.commandComment(CommUtils.parseComment(command.getCommandString()));
321 | }
322 | }
323 |
324 | command.setCommand(processed);
325 |
326 | if (processed.trim().equals("")) {
327 | skip = true;
328 | }
329 | }
330 |
331 | // Don't send skipped commands.
332 | if (!skip) {
333 | command.setSent(true);
334 |
335 | this.activeCommandList.add(command);
336 |
337 | // Commands parsed by the buffer list have embedded newlines.
338 | this.sendStringToComm(command.getCommandString());
339 | }
340 |
341 | if (this.commandSentListener != null) {
342 | this.commandCompleteListener.commandSent(command);
343 | }
344 |
345 | // If the command was skipped let the listeners know.
346 | if (skip) {
347 | this.sendMessageToConsoleListener("Skipping command #"
348 | + command.getCommandNumber() + "\n");
349 | command.setResponse("");
350 |
351 | if (this.commandCompleteListener != null) {
352 | this.commandCompleteListener.commandComplete(command);
353 | }
354 | }
355 |
356 | // Load the next command.
357 | this.commandBuffer.nextCommand();
358 | }
359 |
360 | // If the final response is done and we're in file mode then wrap up.
361 | if (this.fileMode && (this.commandBuffer.size() == 0) &&
362 | this.commandBuffer.currentCommand().isDone() ) {
363 | this.finishStreamFileToComm();
364 | }
365 | }
366 |
367 | void finishStreamFileToComm() {
368 | this.fileMode = false;
369 |
370 | this.sendMessageToConsoleListener("\n**** Finished sending file. ****\n\n");
371 | // Trigger callback
372 | if (this.fileStreamCompleteListener != null) {
373 | boolean success = this.commandBuffer.currentCommand().isDone();
374 | this.fileStreamCompleteListener.fileStreamComplete(file.getName(), success);
375 | }
376 | }
377 |
378 | void pauseSend() throws IOException {
379 | this.sendMessageToConsoleListener("\n**** Pausing file transfer. ****\n");
380 | this.sendPaused = true;
381 |
382 | if (this.realTimeMode) {
383 | this.sendByteImmediately(CommUtils.GRBL_PAUSE_COMMAND);
384 | }
385 | }
386 |
387 | void resumeSend() throws IOException {
388 | this.sendMessageToConsoleListener("\n**** Resuming file transfer. ****\n");
389 |
390 | this.sendPaused = false;
391 | this.streamCommands();
392 |
393 | if (this.realTimeMode) {
394 | this.sendByteImmediately(CommUtils.GRBL_RESUME_COMMAND);
395 | }
396 | }
397 |
398 | void cancelSend() {
399 | if (this.fileMode) {
400 | this.fileMode = false;
401 |
402 | this.sendMessageToConsoleListener("\n**** Canceling file transfer. ****\n");
403 |
404 | this.commandBuffer.clearBuffer();
405 |
406 | // Clear the active command list?
407 | this.activeCommandList.clear();
408 |
409 | // Canceling the remaining commands rather than just clearing the
410 | // buffer would be nice, but it is too slow.
411 | /*
412 | this.sendPaused = true;
413 |
414 | GcodeCommand command;
415 |
416 | // Cancel the current command if it isn't too late.
417 | command = this.commandBuffer.currentCommand();
418 | if (command.isSent() == false) {
419 | command.setResponse("");
420 | if (this.commandCompleteListener != null) {
421 | this.commandCompleteListener.commandComplete(command);
422 | }
423 | }
424 |
425 | // Cancel the rest.
426 | while (this.commandBuffer.hasNext()) {
427 | command = this.commandBuffer.nextCommand();
428 | command.setResponse("");
429 |
430 | if (this.commandCompleteListener != null) {
431 | this.commandCompleteListener.commandComplete(command);
432 | }
433 | }
434 |
435 | this.sendPaused = false;
436 |
437 | */
438 |
439 | //this.finishStreamFileToComm();
440 | }
441 | }
442 |
443 | // Processes a serial response
444 | void responseMessage( String response ) {
445 |
446 | // Check if was 'ok' or 'error'.
447 | if (GcodeCommand.isOkErrorResponse(response)) {
448 | // All Ok/Error messages go to console
449 | this.sendMessageToConsoleListener(response + "\n");
450 |
451 | // Pop the front of the active list.
452 | GcodeCommand command = this.activeCommandList.pop();
453 |
454 | command.setResponse(response);
455 |
456 | if (this.commandCompleteListener != null) {
457 | this.commandCompleteListener.commandComplete(command);
458 | }
459 |
460 | if (this.sendPaused == false) {
461 | this.streamCommands();
462 | }
463 | }
464 |
465 | else if (GrblUtils.isGrblVersionString(response)) {
466 | // Version string goes to console
467 | this.sendMessageToConsoleListener(response + "\n");
468 |
469 | this.grblVersion = GrblUtils.getVersionDouble(response);
470 | this.grblVersionLetter = GrblUtils.getVersionLetter(response);
471 |
472 | this.realTimeMode = GrblUtils.isRealTimeCapable(this.grblVersion);
473 | if (this.realTimeMode) {
474 | if (this.capabilitiesListener != null) {
475 | this.capabilitiesListener.capabilitiesListener(CommUtils.Capabilities.REAL_TIME);
476 | }
477 | }
478 |
479 | this.positionMode = GrblUtils.getGrblPositionCapabilities(this.grblVersion, this.grblVersionLetter);
480 | if (this.positionMode != null) {
481 | this.realTimePosition = true;
482 |
483 | // Start sending '?' commands.
484 | this.beginPollingPosition();
485 | }
486 |
487 | if (this.realTimePosition) {
488 | if (this.capabilitiesListener != null) {
489 | this.capabilitiesListener.capabilitiesListener(CommUtils.Capabilities.POSITION_C);
490 | }
491 | }
492 |
493 | System.out.println("Grbl version = " + this.grblVersion + this.grblVersionLetter);
494 | System.out.println("Real time mode = " + this.realTimeMode);
495 | }
496 |
497 | else if (GrblUtils.isGrblPositionString(response)) {
498 | // Position string goes to verbose console
499 | this.sendMessageToConsoleListener(response + "\n", true);
500 |
501 | if (this.positionListener != null) {
502 | this.positionListener.positionStringListener(response);
503 | }
504 | }
505 |
506 | else {
507 | // Display any unhandled messages
508 | this.sendMessageToConsoleListener(response + "\n");
509 | }
510 | }
511 |
512 | private void beginPollingPosition() {
513 | System.out.println("BEGIN POLLING POSITION");
514 |
515 | ActionListener actionListener = new ActionListener() {
516 | @Override
517 | public void actionPerformed(ActionEvent actionEvent) {
518 | java.awt.EventQueue.invokeLater(new Runnable() {
519 | @Override
520 | public void run() {
521 | try {
522 | sendByteImmediately(CommUtils.GRBL_STATUS_COMMAND);
523 | } catch (IOException ex) {
524 | sendMessageToConsoleListener("IOException while sending status command: " + ex.getMessage() + "\n");
525 | }
526 | }
527 | });
528 |
529 | }
530 | };
531 |
532 | this.positionPollTimer = new Timer(1000, actionListener);
533 | this.positionPollTimer.start();
534 | }
535 |
536 | private void stopPollingPosition() {
537 | if (this.positionPollTimer != null)
538 | this.positionPollTimer.stop();
539 | }
540 |
541 | @Override
542 | // Reads data as it is returned by the serial port.
543 | public void serialEvent(SerialPortEvent arg0) {
544 |
545 | if (arg0.getEventType() == SerialPortEvent.DATA_AVAILABLE) {
546 | try
547 | {
548 | String next = CommUtils.readLineFromCommUntil(in, lineTerminator);
549 | next = next.replace("\n", "").replace("\r","");
550 |
551 | // Handle response.
552 | this.responseMessage(next);
553 |
554 | /*
555 | * For some reason calling readLineFromCommUntil more than once
556 | * prevents the close command from working later on.
557 | // Read one or more lines from the comm.
558 | while ((next = CommUtils.readLineFromCommUntil(in, lineTerminator)).isEmpty() == false) {
559 | next = next.replace("\n", "").replace("\r","");
560 |
561 | // Handle response.
562 | this.responseMessage(next);
563 | }
564 | */
565 | }
566 | catch ( IOException e )
567 | {
568 | e.printStackTrace();
569 | System.exit(-1);
570 | }
571 | }
572 | }
573 |
574 | // Helper for the console listener.
575 | void sendMessageToConsoleListener(String msg) {
576 | this.sendMessageToConsoleListener(msg, false);
577 | }
578 |
579 | void sendMessageToConsoleListener(String msg, boolean verbose) {
580 | if (!verbose && this.commConsoleListener != null) {
581 | this.commConsoleListener.messageForConsole(msg);
582 | }
583 | else if (verbose && this.commVerboseConsoleListener != null) {
584 | this.commVerboseConsoleListener.verboseMessageForConsole(msg);
585 | }
586 | }
587 | }
588 |
--------------------------------------------------------------------------------
/src/com/willwinder/universalgcodesender/SerialCommunicatorListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This is the interface which the SerialCommunicator class uses to notify
3 | * external programs of important events during communication.
4 | */
5 |
6 | /*
7 | Copywrite 2012 Will Winder
8 |
9 | This file is part of Universal Gcode Sender (UGS).
10 |
11 | UGS is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | UGS is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with UGS. If not, see .
23 | */
24 |
25 | package com.willwinder.universalgcodesender;
26 |
27 | /**
28 | *
29 | * @author wwinder
30 | */
31 | public interface SerialCommunicatorListener {
32 | void fileStreamComplete(String filename, boolean success);
33 | void commandQueued(GcodeCommand command);
34 | void commandSent(GcodeCommand command);
35 | void commandComplete(GcodeCommand command);
36 | void commandComment(String comment);
37 | void messageForConsole(String msg);
38 | void verboseMessageForConsole(String msg);
39 | void capabilitiesListener(CommUtils.Capabilities capability);
40 | void positionStringListener(String position);
41 | String preprocessCommand(String command);
42 | }
43 |
--------------------------------------------------------------------------------
/src/com/willwinder/universalgcodesender/SerialWriter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DEPRECATED
3 | *
4 | * A thread which continuously polls a shared StringBuffer object and writes it
5 | * to an OutputStream. The OutputStream in this case was supposed to go to a
6 | * SerialPort.
7 | */
8 |
9 | /*
10 | Copywrite 2012 Will Winder
11 |
12 | This file is part of Universal Gcode Sender (UGS).
13 |
14 | UGS is free software: you can redistribute it and/or modify
15 | it under the terms of the GNU General Public License as published by
16 | the Free Software Foundation, either version 3 of the License, or
17 | (at your option) any later version.
18 |
19 | UGS is distributed in the hope that it will be useful,
20 | but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 | GNU General Public License for more details.
23 |
24 | You should have received a copy of the GNU General Public License
25 | along with UGS. If not, see .
26 | */
27 |
28 | package com.willwinder.universalgcodesender;
29 |
30 | import java.io.OutputStream;
31 | import java.io.PrintStream;
32 |
33 | /**
34 | * This thread continuously polls a string buffer for data then writes it to an
35 | * output stream.
36 | *
37 | * @author wwinder
38 | */
39 |
40 | public class SerialWriter implements Runnable {
41 | private StringBuffer lineBuffer;
42 | private OutputStream out;
43 | public boolean exit = false;
44 |
45 | // For synchronized operations
46 | private final Object syncObject = new Object();
47 |
48 | /**
49 | * Creates the thread object with required parameters
50 | * @param os The output stream that lineBuffer will be written to
51 | * @param lineBuffer A StringBuffer which other threads can write to,
52 | * this thread will notice new content and write it to
53 | * the output stream.
54 | */
55 | public SerialWriter(OutputStream os, StringBuffer lineBuffer) {
56 | this.out = os;
57 | this.lineBuffer = lineBuffer;
58 | }
59 |
60 | @Override
61 | public void run() {
62 | try {
63 | String s = "";
64 | while (!exit) {
65 | // Fetch data and clear buffer.
66 | if (lineBuffer.length() > 0) {
67 | synchronized(syncObject) {
68 | s = lineBuffer.toString();
69 | lineBuffer.setLength(0);
70 | }
71 | }
72 |
73 | // Send it out
74 | if (s.length() > 0) {
75 | PrintStream printStream = new PrintStream(this.out);
76 | printStream.print(s);
77 | printStream.close();
78 | }
79 |
80 | // Sleep
81 | synchronized (this) {
82 | this.wait(1000);
83 | }
84 | }
85 | } catch (InterruptedException ex) {
86 | System.out.println("SerialWriter thread died.");
87 | ex.printStackTrace();
88 | System.exit(-1);
89 | }
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/src/com/willwinder/universalgcodesender/Utils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A collection of utilities that don't relate to anything in particular.
3 | */
4 |
5 | /*
6 | Copywrite 2012 Will Winder
7 |
8 | This file is part of Universal Gcode Sender (UGS).
9 |
10 | UGS is free software: you can redistribute it and/or modify
11 | it under the terms of the GNU General Public License as published by
12 | the Free Software Foundation, either version 3 of the License, or
13 | (at your option) any later version.
14 |
15 | UGS is distributed in the hope that it will be useful,
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | GNU General Public License for more details.
19 |
20 | You should have received a copy of the GNU General Public License
21 | along with UGS. If not, see .
22 | */
23 |
24 | package com.willwinder.universalgcodesender;
25 |
26 | import java.io.*;
27 |
28 | /**
29 | *
30 | * @author wwinder
31 | */
32 | public class Utils {
33 | public static String timeSince(long from){
34 | long elapsedTime = millisSince(from);
35 | return Utils.formattedMillis(elapsedTime);
36 | }
37 |
38 | public static long millisSince(long from) {
39 | long until = System.currentTimeMillis();
40 | return until - from;
41 | }
42 |
43 | public static String formattedMillis(long millis) {
44 | String format = String.format("%%0%dd", 2);
45 | long elapsedTime = millis / 1000;
46 | String seconds = String.format(format, elapsedTime % 60);
47 | String minutes = String.format(format, (elapsedTime % 3600) / 60);
48 | String hours = String.format(format, elapsedTime / 3600);
49 | String time = hours + ":" + minutes + ":" + seconds;
50 | return time;
51 | }
52 |
53 | // Processes input file.
54 | // This could theoretically scan it for errors, but GcodeSender just counts
55 | // how many lines are in it.
56 | public static int processFile(File file) throws FileNotFoundException, IOException {
57 | Integer numRows = 0;
58 | InputStream is = new BufferedInputStream(new FileInputStream(file));
59 |
60 | byte[] c = new byte[1024];
61 |
62 | int readChars;
63 | while ((readChars = is.read(c)) != -1) {
64 | for (int i = 0; i < readChars; ++i) {
65 | if (c[i] == '\n')
66 | ++numRows;
67 | }
68 | }
69 |
70 | is.close();
71 |
72 | return numRows;
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/src/com/willwinder/universalgcodesender/uielements/GcodeFileTypeFilter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * FileFilter which is limited to gcode files.
3 | */
4 |
5 | /*
6 | Copywrite 2012 Will Winder
7 |
8 | This file is part of Universal Gcode Sender (UGS).
9 |
10 | UGS is free software: you can redistribute it and/or modify
11 | it under the terms of the GNU General Public License as published by
12 | the Free Software Foundation, either version 3 of the License, or
13 | (at your option) any later version.
14 |
15 | UGS is distributed in the hope that it will be useful,
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | GNU General Public License for more details.
19 |
20 | You should have received a copy of the GNU General Public License
21 | along with UGS. If not, see .
22 | */
23 |
24 | package com.willwinder.universalgcodesender.uielements;
25 |
26 | import java.io.File;
27 | import javax.swing.filechooser.FileFilter;
28 | /**
29 | *
30 | * @author wwinder
31 | */
32 | public class GcodeFileTypeFilter extends FileFilter {
33 |
34 | @Override
35 | public boolean accept(File f) {
36 | if (f.isDirectory()) {
37 | return true;
38 | }
39 |
40 | String extension = getExtension(f);
41 | if (extension != null) {
42 | if (extension.equals("cnc") ||
43 | extension.equals("nc") ||
44 | extension.equals("ngc") ||
45 | extension.equals("tap") ||
46 | extension.equals("txt") ||
47 | extension.equals("gcode")) {
48 | return true;
49 | } else {
50 | return false;
51 | }
52 | }
53 |
54 | return false;
55 | }
56 |
57 | //The description of this filter
58 | @Override
59 | public String getDescription() {
60 | return "G-Code Files";
61 | }
62 |
63 | private static String getExtension(File f) {
64 | String ext = null;
65 | String s = f.getName();
66 | int i = s.lastIndexOf('.');
67 |
68 | if (i > 0 && i < s.length() - 1) {
69 | ext = s.substring(i+1).toLowerCase();
70 | }
71 | return ext;
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/src/com/willwinder/universalgcodesender/uielements/StepSizeSpinnerModel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A custom spinner that will step full integers unless less than or equal to 1
3 | * at which point it will step tenths unless less than or equal to .1 at which
4 | * point it will step hundredths, etc.
5 | */
6 |
7 | /*
8 | Copywrite 2012 Will Winder
9 |
10 | This file is part of Universal Gcode Sender (UGS).
11 |
12 | UGS is free software: you can redistribute it and/or modify
13 | it under the terms of the GNU General Public License as published by
14 | the Free Software Foundation, either version 3 of the License, or
15 | (at your option) any later version.
16 |
17 | UGS is distributed in the hope that it will be useful,
18 | but WITHOUT ANY WARRANTY; without even the implied warranty of
19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 | GNU General Public License for more details.
21 |
22 | You should have received a copy of the GNU General Public License
23 | along with UGS. If not, see .
24 | */
25 |
26 | package com.willwinder.universalgcodesender.uielements;
27 |
28 | import javax.swing.SpinnerNumberModel;
29 |
30 | /**
31 | *
32 | * @author wwinder
33 | */
34 | public class StepSizeSpinnerModel extends SpinnerNumberModel {
35 |
36 | Double maxStepSize = null;
37 |
38 | public StepSizeSpinnerModel(Number value, Comparable min, Comparable max, Number size) {
39 | super (value, min, max, size);
40 | maxStepSize = size.doubleValue();
41 | }
42 |
43 | private Double getPreviousStepSize() {
44 | Number stepSize = this.getStepSize();
45 |
46 | Double size = stepSize.doubleValue();
47 |
48 | // Determine if step size needs adjusting
49 | if (getNumber().doubleValue() == this.getStepSize().doubleValue()) {
50 | size /= 10.0;
51 | }
52 |
53 | return size;
54 | }
55 |
56 | private Double getNextStepSize() {
57 | Double size = this.getStepSize().doubleValue();
58 |
59 | if (getNumber().doubleValue() >= (10 * size)) {
60 | if (this.getStepSize().doubleValue() < maxStepSize) {
61 |
62 | size *= 10;
63 | if (size > maxStepSize) {
64 | size = maxStepSize;
65 | }
66 | }
67 | }
68 |
69 | if (this.getNumber().doubleValue() == 0) {
70 | size = .0001;
71 | }
72 |
73 | return size;
74 | }
75 |
76 | /**
77 | * Returns the next value, or
78 | * null
if adding the step size to the current value results in
79 | * a value greater than the maximum value. The current value is not changed.
80 | *
81 | * @return The next value, or
82 | * null
if the current value is the maximum value represented
83 | * by this model.
84 | */
85 | @Override
86 | public Object getNextValue() {
87 | Double num;
88 | this.setStepSize(getNextStepSize());
89 |
90 | num = new Double(this.getNumber().doubleValue() + this.getStepSize().doubleValue());
91 |
92 | // check upper bound if set
93 | if ((this.getMaximum() != null) && this.getMaximum().compareTo(num) < 0) {
94 | num = null;
95 | }
96 |
97 | return num;
98 | }
99 |
100 | /**
101 | * Returns the previous value, or
102 | * null
if subtracting the step size from the current value
103 | * results in a value less than the minimum value. The current value is not
104 | * changed.
105 | *
106 | * @return The previous value, or
107 | * null
if the current value is the minimum value represented
108 | * by this model.
109 | */
110 | @Override
111 | public Object getPreviousValue() {
112 | Double num;
113 | this.setStepSize(getPreviousStepSize());
114 |
115 | num = new Double(this.getNumber().doubleValue() - this.getStepSize().doubleValue());
116 |
117 | // check lower bound if set
118 | if ((this.getMinimum() != null) && this.getMinimum().compareTo(num) > 0) {
119 | num = null;
120 | }
121 |
122 | return num;
123 | }
124 | }
--------------------------------------------------------------------------------
/src/refresh.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grbl/Universal-G-Code-Sender/47f8a02cbdb4da084e71a4b5a2d139de6d1fe0be/src/refresh.gif
--------------------------------------------------------------------------------
/test_files/buffer_stress_test.gcode:
--------------------------------------------------------------------------------
1 | (Commands are very small, many as short as 7 characters.)
2 | (This causes the buffer to fill very close to capacity.)
3 |
4 | (Simple manual G-Code for an XY ruler)
5 | (plate 50x50)
6 | (origin is in left south)
7 |
8 | (~~~setup~~~)
9 | G21 (mm)
10 | G90 (absolute coordinates)
11 | G0 Z5
12 |
13 | (~~~ x ruler ~~~)
14 |
15 | G0 X0. Y0.
16 | G1 Z0.
17 | G1 X0. Y5.
18 | G0 Z5.
19 |
20 | G0 X10. Y0.
21 | G1 Z0.
22 | G1 X10. Y5.
23 | G0 Z5.
24 |
25 | G0 X20. Y0.
26 | G1 Z0.
27 | G1 X20. Y5.
28 | G0 Z5.
29 |
30 | G0 X30. Y0.
31 | G1 Z0.
32 | G1 X30. Y5.
33 | G0 Z5.
34 |
35 | G0 X40. Y0.
36 | G1 Z0.
37 | G1 X40. Y5.
38 | G0 Z5.
39 |
40 | G0 X50. Y0.
41 | G1 Z0.
42 | G1 X50. Y5.
43 | G0 Z5.
44 |
45 | (~~~ y ruler ~~~)
46 |
47 | G0 X0. Y0.
48 | G1 Z0.
49 | G1 X5. Y0.
50 | G0 Z5.
51 |
52 | G0 X0. Y10.
53 | G1 Z0.
54 | G1 X5. Y10.
55 | G0 Z5.
56 |
57 | G0 X0. Y20.
58 | G1 Z0.
59 | G1 X5. Y20.
60 | G0 Z5.
61 |
62 | G0 X0. Y30.
63 | G1 Z0.
64 | G1 X5. Y30.
65 | G0 Z5.
66 |
67 | G0 X0. Y40.
68 | G1 Z0.
69 | G1 X5. Y40.
70 | G0 Z5.
71 |
72 | G0 X0. Y50.
73 | G1 Z0.
74 | G1 X5. Y50.
75 | G0 Z5.
76 |
77 | (~~~finish~~~)
78 | G0 X0. Y0.
79 |
--------------------------------------------------------------------------------
/test_files/line_skip_test.gcode:
--------------------------------------------------------------------------------
1 | G55
2 | G0 X0 Y0 Z-13
3 | G4 P1
4 | G1 Z-15
5 | X10 Z-15.05
6 | Y10 Z-15.1
7 | X-10 Y-10 Z-15.3
8 | G0 Z-13
9 | X10
10 | G4 P1
11 | G1 Z-15.4
12 | Y10 X-10 Z-15.6
13 | Y0 Z-15.65
14 | X0 Z-15.7
15 | G0 X-80 Y80 Z20
16 |
--------------------------------------------------------------------------------
/test_files/serial_stress_test.gcode:
--------------------------------------------------------------------------------
1 | (A spiral which has very short segments, which makes commands finish very fast.)
2 | (So a lot of data needs to be sent.)
3 | G21
4 | F10000.00000
5 | S1000.00000
6 | G0 Z2.0000
7 | X71.8456 Y75.0405
8 | G1 Z0.0000
9 | X71.9427 Y74.9978
10 | X72.0147 Y74.9451
11 | X72.0637 Y74.8841
12 | X72.0918 Y74.8163
13 | X72.1009 Y74.7435
14 | X72.0929 Y74.6670
15 | X72.0698 Y74.5886
16 | X72.0337 Y74.5100
17 | X71.9868 Y74.4326
18 | X71.9308 Y74.3582
19 | X71.8676 Y74.2884
20 | X71.7996 Y74.2246
21 | X71.7284 Y74.1686
22 | X71.6563 Y74.1220
23 | X71.5851 Y74.0863
24 | X71.5170 Y74.0632
25 | X71.3413 Y74.0336
26 | X71.1723 Y74.0316
27 | X71.0112 Y74.0548
28 | X70.8582 Y74.1016
29 | X70.7142 Y74.1693
30 | X70.5796 Y74.2562
31 | X70.4551 Y74.3598
32 | X70.3414 Y74.4784
33 | X70.2390 Y74.6092
34 | X70.1486 Y74.7507
35 | X70.0707 Y74.9004
36 | X70.0061 Y75.0561
37 | X69.9554 Y75.2160
38 | X69.9190 Y75.3775
39 | X69.8978 Y75.5388
40 | X69.8924 Y75.6977
41 | X69.9142 Y75.9721
42 | X69.9690 Y76.2325
43 | X70.0544 Y76.4781
44 | X70.1678 Y76.7081
45 | X70.3067 Y76.9217
46 | X70.4690 Y77.1182
47 | X70.6520 Y77.2968
48 | X70.8534 Y77.4567
49 | X71.0706 Y77.5972
50 | X71.3014 Y77.7175
51 | X71.5431 Y77.8167
52 | X71.7936 Y77.8942
53 | X72.0502 Y77.9492
54 | X72.3106 Y77.9808
55 | X72.5724 Y77.9884
56 | X72.8331 Y77.9711
57 | X73.2040 Y77.9056
58 | X73.5546 Y77.7997
59 | X73.8841 Y77.6564
60 | X74.1914 Y77.4783
61 | X74.4751 Y77.2687
62 | X74.7346 Y77.0305
63 | X74.9686 Y76.7664
64 | X75.1760 Y76.4799
65 | X75.3559 Y76.1735
66 | X75.5070 Y75.8502
67 | X75.6286 Y75.5132
68 | X75.7192 Y75.1653
69 | X75.7783 Y74.8096
70 | X75.8044 Y74.4488
71 | X75.7965 Y74.0862
72 | X75.7537 Y73.7244
73 | X75.6471 Y73.2571
74 | X75.4919 Y72.8160
75 | X75.2914 Y72.4023
76 | X75.0493 Y72.0178
77 | X74.7691 Y71.6633
78 | X74.4545 Y71.3405
79 | X74.1091 Y71.0507
80 | X73.7364 Y70.7952
81 | X73.3399 Y70.5757
82 | X72.9232 Y70.3933
83 | X72.4901 Y70.2493
84 | X72.0439 Y70.1451
85 | X71.5883 Y70.0823
86 | X71.1270 Y70.0621
87 | X70.6632 Y70.0860
88 | X70.2010 Y70.1551
89 | X69.9150 Y70.2210
90 | X69.6370 Y70.3017
91 | X69.3670 Y70.3967
92 | X69.1051 Y70.5056
93 | X68.8517 Y70.6277
94 | X68.6071 Y70.7626
95 | X68.3714 Y70.9097
96 | X68.1447 Y71.0684
97 | X67.9272 Y71.2384
98 | X67.7194 Y71.4190
99 | X67.5212 Y71.6096
100 | X67.3331 Y71.8099
101 | X67.1550 Y72.0192
102 | X66.9873 Y72.2370
103 | X66.8302 Y72.4628
104 | X66.6840 Y72.6961
105 | X66.5486 Y72.9363
106 | X66.4246 Y73.1830
107 | X66.3120 Y73.4356
108 | X66.2110 Y73.6935
109 | X66.1217 Y73.9561
110 | X66.0448 Y74.2232
111 | X65.9799 Y74.4939
112 | X65.9276 Y74.7680
113 | X65.8880 Y75.0447
114 | X65.8613 Y75.3237
115 | X65.8478 Y75.6044
116 | X65.8475 Y75.8860
117 | X65.8607 Y76.1684
118 | X65.8879 Y76.4508
119 | X65.9290 Y76.7329
120 | X65.9842 Y77.0138
121 | X66.0686 Y77.3487
122 | X66.1700 Y77.6744
123 | X66.2880 Y77.9906
124 | X66.4220 Y78.2970
125 | X66.5713 Y78.5933
126 | X66.7351 Y78.8795
127 | X66.9130 Y79.1551
128 | X67.1045 Y79.4198
129 | X67.3087 Y79.6736
130 | X67.5254 Y79.9161
131 | X67.7535 Y80.1470
132 | X67.9926 Y80.3661
133 | X68.2422 Y80.5731
134 | X68.5018 Y80.7678
135 | X68.7702 Y80.9501
136 | X69.0474 Y81.1194
137 | X69.3325 Y81.2757
138 | X69.6250 Y81.4186
139 | X69.9241 Y81.5480
140 | X70.2295 Y81.6636
141 | X70.5404 Y81.7651
142 | X70.8561 Y81.8522
143 | X71.1761 Y81.9249
144 | X71.4999 Y81.9825
145 | X71.8266 Y82.0251
146 | X72.1559 Y82.0523
147 | X72.4870 Y82.0639
148 | X72.8193 Y82.0597
149 | X73.1523 Y82.0394
150 | X73.4853 Y82.0027
151 | X73.8176 Y81.9494
152 | X74.1487 Y81.8791
153 | X74.5328 Y81.7764
154 | X74.9061 Y81.6541
155 | X75.2683 Y81.5131
156 | X75.6195 Y81.3541
157 | X75.9589 Y81.1779
158 | X76.2863 Y80.9848
159 | X76.6019 Y80.7759
160 | X76.9047 Y80.5518
161 | X77.1949 Y80.3132
162 | X77.4719 Y80.0606
163 | X77.7356 Y79.7949
164 | X77.9856 Y79.5168
165 | X78.2216 Y79.2269
166 | X78.4435 Y78.9260
167 | X78.6507 Y78.6146
168 | X78.8432 Y78.2936
169 | X79.0205 Y77.9636
170 | X79.1823 Y77.6253
171 | X79.3285 Y77.2794
172 | X79.4585 Y76.9267
173 | X79.5722 Y76.5677
174 | X79.6693 Y76.2032
175 | X79.7496 Y75.8339
176 | X79.8126 Y75.4606
177 | X79.8582 Y75.0837
178 | X79.8859 Y74.7043
179 | X79.8953 Y74.3226
180 | X79.8866 Y73.9397
181 | X79.8591 Y73.5562
182 | X79.8126 Y73.1727
183 | X79.7468 Y72.7901
184 | X79.6615 Y72.4087
185 | X79.5404 Y71.9756
186 | X79.3976 Y71.5544
187 | X79.2337 Y71.1459
188 | X79.0499 Y70.7502
189 | X78.8466 Y70.3676
190 | X78.6247 Y69.9984
191 | X78.3849 Y69.6434
192 | X78.1283 Y69.3022
193 | X77.8552 Y68.9757
194 | X77.5668 Y68.6640
195 | X77.2636 Y68.3675
196 | X76.9465 Y68.0865
197 | X76.6164 Y67.8213
198 | X76.2737 Y67.5725
199 | X75.9196 Y67.3401
200 | X75.5547 Y67.1246
201 | X75.1798 Y66.9264
202 | X74.7957 Y66.7456
203 | X74.4030 Y66.5828
204 | X74.0028 Y66.4382
205 | X73.5955 Y66.3122
206 | X73.1822 Y66.2049
207 | X72.7636 Y66.1172
208 | X72.3405 Y66.0490
209 | X71.9136 Y66.0005
210 | X71.4837 Y65.9725
211 | X71.0517 Y65.9650
212 | X70.6180 Y65.9783
213 | X70.1839 Y66.0131
214 | X69.7499 Y66.0695
215 | X69.3166 Y66.1477
216 | X68.8853 Y66.2483
217 | X68.4030 Y66.3876
218 | X67.9342 Y66.5510
219 | X67.4795 Y66.7374
220 | X67.0391 Y66.9463
221 | X66.6135 Y67.1765
222 | X66.2029 Y67.4272
223 | X65.8079 Y67.6978
224 | X65.4286 Y67.9871
225 | X65.0656 Y68.2944
226 | X64.7193 Y68.6187
227 | X64.3899 Y68.9595
228 | X64.0778 Y69.3155
229 | X63.7837 Y69.6860
230 | X63.5078 Y70.0703
231 | X63.2503 Y70.4671
232 | X63.0116 Y70.8759
233 | X62.7923 Y71.2959
234 | X62.5926 Y71.7260
235 | X62.4130 Y72.1652
236 | X62.2539 Y72.6131
237 | X62.1155 Y73.0685
238 | X61.9984 Y73.5305
239 | X61.9029 Y73.9985
240 | X61.8293 Y74.4713
241 | X61.7779 Y74.9483
242 | X61.7493 Y75.4286
243 | X61.7439 Y75.9113
244 | X61.7619 Y76.3954
245 | X61.8039 Y76.8801
246 | X61.8699 Y77.3646
247 | X61.9608 Y77.8481
248 | X62.0765 Y78.3295
249 | X62.2340 Y78.8610
250 | X62.4179 Y79.3773
251 | X62.6271 Y79.8784
252 | X62.8608 Y80.3635
253 | X63.1182 Y80.8324
254 | X63.3979 Y81.2844
255 | X63.6993 Y81.7195
256 | X64.0212 Y82.1368
257 | X64.3629 Y82.5363
258 | X64.7232 Y82.9175
259 | X65.1015 Y83.2796
260 | X65.4965 Y83.6226
261 | X65.9073 Y83.9458
262 | X66.3332 Y84.2491
263 | X66.7730 Y84.5317
264 | X67.2258 Y84.7934
265 | X67.6907 Y85.0338
266 | X68.1667 Y85.2524
267 | X68.6530 Y85.4486
268 | X69.1483 Y85.6223
269 | X69.6520 Y85.7730
270 | X70.1630 Y85.9000
271 | X70.6802 Y86.0030
272 | X71.2029 Y86.0822
273 | X71.7301 Y86.1362
274 | X72.2607 Y86.1650
275 | X72.7940 Y86.1686
276 | X73.3287 Y86.1461
277 | X73.8642 Y86.0966
278 | X74.3992 Y86.0201
279 | X74.9331 Y85.9171
280 | X75.4647 Y85.7860
281 | X76.0454 Y85.6104
282 | X76.6095 Y85.4061
283 | X77.1567 Y85.1741
284 | X77.6866 Y84.9156
285 | X78.1985 Y84.6314
286 | X78.6921 Y84.3228
287 | X79.1670 Y83.9907
288 | X79.6226 Y83.6362
289 | X80.0585 Y83.2602
290 | X80.4741 Y82.8638
291 | X80.8692 Y82.4483
292 | X81.2431 Y82.0143
293 | X81.5955 Y81.5631
294 | X81.9257 Y81.0957
295 | X82.2335 Y80.6131
296 | X82.5183 Y80.1163
297 | X82.7795 Y79.6065
298 | X83.0170 Y79.0846
299 | X83.2300 Y78.5516
300 | X83.4181 Y78.0087
301 | X83.5810 Y77.4568
302 | X83.7181 Y76.8971
303 | X83.8289 Y76.3305
304 | X83.9130 Y75.7580
305 | X83.9700 Y75.1807
306 | X83.9992 Y74.5997
307 | X84.0005 Y74.0159
308 | X83.9730 Y73.4305
309 | X83.9166 Y72.8445
310 | X83.8306 Y72.2587
311 | X83.7147 Y71.6745
312 | X83.5684 Y71.0927
313 | X83.3746 Y70.4629
314 | X83.1497 Y69.8511
315 | X82.8951 Y69.2576
316 | X82.6116 Y68.6831
317 | X82.3006 Y68.1280
318 | X81.9631 Y67.5927
319 | X81.6001 Y67.0779
320 | X81.2130 Y66.5841
321 | X80.8027 Y66.1119
322 | X80.3703 Y65.6615
323 | X79.9173 Y65.2336
324 | X79.4442 Y64.8286
325 | X78.9528 Y64.4472
326 | X78.4436 Y64.0898
327 | X77.9181 Y63.7568
328 | X77.3775 Y63.4490
329 | X76.8226 Y63.1666
330 | X76.2547 Y62.9103
331 | X75.6750 Y62.6804
332 | X75.0845 Y62.4778
333 | X74.4843 Y62.3026
334 | X73.8758 Y62.1556
335 | X73.2597 Y62.0371
336 | X72.6375 Y61.9476
337 | X72.0102 Y61.8877
338 | X71.3787 Y61.8581
339 | X70.7445 Y61.8590
340 | X70.1084 Y61.8910
341 | X69.4717 Y61.9547
342 | X68.8355 Y62.0504
343 | X68.2010 Y62.1790
344 | X67.5693 Y62.3405
345 | X66.8903 Y62.5525
346 | X66.2307 Y62.7977
347 | X65.5911 Y63.0751
348 | X64.9719 Y63.3834
349 | X64.3737 Y63.7215
350 | X63.7968 Y64.0879
351 | X63.2423 Y64.4816
352 | X62.7103 Y64.9014
353 | X62.2015 Y65.3461
354 | X61.7164 Y65.8143
355 | X61.2556 Y66.3051
356 | X60.8197 Y66.8171
357 | X60.4092 Y67.3490
358 | X60.0246 Y67.8997
359 | X59.6665 Y68.4680
360 | X59.3355 Y69.0527
361 | X59.0320 Y69.6525
362 | X58.7568 Y70.2664
363 | X58.5102 Y70.8929
364 | X58.2929 Y71.5309
365 | X58.1053 Y72.1792
366 | X57.9483 Y72.8368
367 | X57.8220 Y73.5021
368 | X57.7272 Y74.1741
369 | X57.6645 Y74.8516
370 | X57.6344 Y75.5333
371 | X57.6373 Y76.2182
372 | X57.6740 Y76.9049
373 |
--------------------------------------------------------------------------------
/test_files/shapeoko.txt:
--------------------------------------------------------------------------------
1 | ( Made using CamBam - http://www.cambam.co.uk )
2 | ( Untitled 2/13/2012 2:54:50 PM )
3 | ( T0 : 0.0394 )
4 | G20 G90 G64 G40
5 | G0 Z0.125
6 | ( T0 : 0.0394 )
7 | T0 M6
8 | ( Engrave1 )
9 | G17
10 | M3 S1000
11 | G0 X-3.0 Y-0.0451
12 | G1 F10.0 Z-0.001
13 | G1 F60.0 X-2.8845 Y-0.035
14 | G3 X-2.8723 Y-0.0943 I0.3244 J0.0363
15 | G3 X-2.8467 Y-0.1492 I0.2072 J0.0631
16 | G3 X-2.805 Y-0.1917 I0.1471 J0.1027
17 | G3 X-2.7533 Y-0.2212 I0.1578 J0.2169
18 | G3 X-2.6114 Y-0.2483 I0.1366 J0.3297
19 | G3 X-2.4877 Y-0.2275 I0.006 J0.3418
20 | G3 X-2.4438 Y-0.2048 I-0.0766 J0.2022
21 | G3 X-2.4082 Y-0.1707 I-0.0792 J0.1182
22 | G3 X-2.3817 Y-0.0912 I-0.1063 J0.0796
23 | G3 X-2.4069 Y-0.0155 I-0.1191 J0.0024
24 | G3 X-2.4449 Y0.0175 I-0.1101 J-0.0883
25 | G3 X-2.4902 Y0.0394 I-0.1379 J-0.2279
26 | G3 X-2.572 Y0.0637 I-0.3019 J-0.8663
27 | G3 X-2.6549 Y0.0842 I-1.0468 J-4.0562
28 | G2 X-2.7457 Y0.1086 I0.3878 J1.6213
29 | G2 X-2.8334 Y0.1422 I0.1472 J0.5158
30 | G2 X-2.8886 Y0.1787 I0.1401 J0.2718
31 | G2 X-2.9325 Y0.2281 I0.1404 J0.1692
32 | G2 X-2.9647 Y0.3435 I0.1821 J0.1129
33 | G2 X-2.9249 Y0.4741 I0.2336 J0.0003
34 | G2 X-2.8088 Y0.5669 I0.2044 J-0.1368
35 | G2 X-2.6391 Y0.5984 I0.1639 J-0.4097
36 | G2 X-2.5469 Y0.5908 I0.0024 J-0.5372
37 | G2 X-2.458 Y0.565 I-0.0669 J-0.395
38 | G2 X-2.3369 Y0.4678 I-0.0947 J-0.2421
39 | G2 X-2.2915 Y0.3221 I-0.2346 J-0.1531
40 | G1 X-2.4088 Y0.3132
41 | G3 X-2.4277 Y0.386 I-0.236 J-0.0223
42 | G3 X-2.4732 Y0.4457 I-0.1488 J-0.0662
43 | G3 X-2.5498 Y0.4817 I-0.1158 J-0.1469
44 | G3 X-2.6341 Y0.4905 I-0.08 J-0.3586
45 | G3 X-2.7184 Y0.4829 I-0.0045 J-0.4232
46 | G3 X-2.7962 Y0.4495 I0.0315 J-0.1804
47 | G3 X-2.8331 Y0.4066 I0.0864 J-0.1118
48 | G3 X-2.8467 Y0.3517 I0.1005 J-0.0539
49 | G3 X-2.8107 Y0.2697 I0.1052 J-0.0028
50 | G3 X-2.7679 Y0.2452 I0.1001 J0.125
51 | G3 X-2.698 Y0.2215 I0.2359 J0.583
52 | G3 X-2.6265 Y0.2034 I0.3957 J1.414
53 | G2 X-2.5228 Y0.1782 I-0.5539 J-2.5053
54 | G2 X-2.4215 Y0.1448 I-0.1803 J-0.7161
55 | G2 X-2.3553 Y0.1057 I-0.1442 J-0.3193
56 | G2 X-2.3022 Y0.0501 I-0.1407 J-0.1878
57 | G2 X-2.2637 Y-0.0811 I-0.19 J-0.127
58 | G2 X-2.306 Y-0.2205 I-0.2532 J0.0006
59 | G2 X-2.4278 Y-0.3221 I-0.2339 J0.1566
60 | G2 X-2.6057 Y-0.3581 I-0.1712 J0.3891
61 | G2 X-2.7129 Y-0.3503 I-0.0037 J0.6909
62 | G2 X-2.8164 Y-0.3215 I0.0637 J0.4292
63 | G2 X-2.9495 Y-0.2117 I0.1147 J0.2747
64 | G2 X-3.0 Y-0.0451 I0.265 J0.1712
65 | G0 Z0.125
66 | G0 X-2.111
67 | G1 F10.0 Z-0.001
68 | G1 F60.0 Y0.5826
69 | G1 X-1.9975
70 | G1 Y0.2508
71 | G2 X-1.9077 Y0.3198 I0.2024 J-0.1703
72 | G2 X-1.7969 Y0.3429 I0.1077 J-0.2394
73 | G2 X-1.6675 Y0.3132 I0.0063 J-0.2692
74 | G2 X-1.5893 Y0.2325 I-0.0755 J-0.1515
75 | G2 X-1.5698 Y0.1586 I-0.2396 J-0.1028
76 | G2 X-1.5653 Y0.0823 I-0.5851 J-0.0725
77 | G1 Y-0.3423
78 | G1 X-1.6789
79 | G1 Y0.0823
80 | G3 X-1.6859 Y0.1476 I-0.2729 J0.0036
81 | G3 X-1.7161 Y0.206 I-0.1238 J-0.027
82 | G3 X-1.764 Y0.2366 I-0.0845 J-0.0794
83 | G3 X-1.8202 Y0.2451 I-0.0537 J-0.1649
84 | G3 X-1.9155 Y0.2186 I-0.0001 J-0.1841
85 | G3 X-1.9786 Y0.1479 I0.072 J-0.1278
86 | G3 X-1.9938 Y0.087 I0.221 J-0.0878
87 | G3 X-1.9975 Y0.0243 I0.4875 J-0.0599
88 | G1 Y-0.3423
89 | G1 X-2.111
90 | G1 Y-0.0451
91 | G0 Z0.125
92 | G0 X-1.4292 Y-0.1385
93 | G1 F10.0 Z-0.001
94 | G2 F60.0 X-1.4088 Y-0.076 I0.182 J-0.0249
95 | G2 X-1.3502 Y-0.0104 I0.1662 J-0.0896
96 | G2 X-1.2681 Y0.0268 I0.1554 J-0.2334
97 | G2 X-1.1672 Y0.0438 I0.1926 J-0.8334
98 | G3 X-1.065 Y0.0586 I-0.2128 J1.8303
99 | G3 X-0.9647 Y0.0829 I-0.1109 J0.6767
100 | G3 X-0.9641 Y0.1126 I-1.9501 J0.0563
101 | G3 X-0.97 Y0.1648 I-0.2046 J0.003
102 | G3 X-0.9962 Y0.2104 I-0.0883 J-0.0204
103 | G3 X-1.0574 Y0.2412 I-0.0943 J-0.111
104 | G3 X-1.1256 Y0.2489 I-0.0647 J-0.2692
105 | G3 X-1.187 Y0.2436 I-0.0032 J-0.3217
106 | G3 X-1.2442 Y0.2205 I0.0237 J-0.141
107 | G3 X-1.2805 Y0.1756 I0.0774 J-0.0998
108 | G3 X-1.3003 Y0.1214 I0.2336 J-0.1162
109 | G1 X-1.4114 Y0.1366
110 | G2 X-1.3931 Y0.1969 I0.337 J-0.0694
111 | G2 X-1.3615 Y0.2514 I0.2096 J-0.0848
112 | G2 X-1.3162 Y0.2923 I0.1453 J-0.1155
113 | G2 X-1.2612 Y0.3189 I0.1409 J-0.221
114 | G2 X-1.1092 Y0.3429 I0.1442 J-0.4206
115 | G2 X-1.0386 Y0.3388 I0.0029 J-0.5642
116 | G2 X-0.9697 Y0.3227 I-0.0351 J-0.3052
117 | G2 X-0.927 Y0.3022 I-0.0865 J-0.2354
118 | G2 X-0.8909 Y0.2716 I-0.0727 J-0.1224
119 | G2 X-0.8555 Y0.1946 I-0.1386 J-0.1102
120 | G2 X-0.8507 Y0.1424 I-0.3836 J-0.0615
121 | G2 X-0.8499 Y0.0899 I-1.3758 J-0.0494
122 | G1 Y-0.0615
123 | G3 X-0.8489 Y-0.1619 I4.6791 J-0.0068
124 | G3 X-0.8429 Y-0.2622 I0.9512 J0.0067
125 | G3 X-0.8139 Y-0.3423 I0.2546 J0.0469
126 | G1 X-0.9325
127 | G2 X-0.9552 Y-0.2596 I0.2182 J0.1044
128 | G2 X-1.077 Y-0.3354 I-0.2823 J0.3183
129 | G2 X-1.2019 Y-0.3574 I-0.1221 J0.3266
130 | G2 X-1.2917 Y-0.3463 I-0.0042 J0.3355
131 | G2 X-1.3716 Y-0.3038 I0.0496 J0.1895
132 | G2 X-1.4309 Y-0.1656 I0.1197 J0.1332
133 | G2 X-1.4292 Y-0.1385 I0.1837 J0.0022
134 | G0 Z0.125
135 | G0 X-1.3093 Y-0.1513
136 | G1 F10.0 Z-0.001
137 | G3 F60.0 X-1.3098 Y-0.1625 I0.0949 J-0.0101
138 | G3 X-1.2757 Y-0.2382 I0.0971 J-0.0018
139 | G3 X-1.228 Y-0.2624 I0.075 J0.0889
140 | G3 X-1.1748 Y-0.2685 I0.0506 J0.2058
141 | G3 X-1.0581 Y-0.2401 I0.0042 J0.2367
142 | G3 X-0.983 Y-0.1612 I-0.0857 J0.1567
143 | G3 X-0.9681 Y-0.1054 I-0.1756 J0.0768
144 | G3 X-0.9647 Y-0.0477 I-0.4434 J0.0549
145 | G1 Y-0.006
146 | G2 X-1.0563 Y-0.0325 I-0.2032 J0.5301
147 | G2 X-1.1502 Y-0.0489 I-0.2867 J1.3668
148 | G3 X-1.2003 Y-0.0575 I0.1165 J-0.8276
149 | G3 X-1.2492 Y-0.0716 I0.0505 J-0.2671
150 | G3 X-1.294 Y-0.1089 I0.0375 J-0.0907
151 | G3 X-1.3093 Y-0.1513 I0.0797 J-0.0526
152 | G0 Z0.125
153 | G0 X-0.6738
154 | G1 F10.0 Z-0.001
155 | G1 F60.0 Y0.3277
156 | G1 X-0.5704
157 | G1 Y0.2407
158 | G2 X-0.4877 Y0.317 I0.2085 J-0.1428
159 | G2 X-0.376 Y0.3429 I0.1052 J-0.2003
160 | G2 X-0.2246 Y0.2987 I0.0049 J-0.265
161 | G2 X-0.1256 Y0.1738 I-0.1536 J-0.2235
162 | G2 X-0.0921 Y-0.0022 I-0.4197 J-0.1709
163 | G2 X-0.1294 Y-0.1877 I-0.4477 J-0.0066
164 | G2 X-0.2366 Y-0.3139 I-0.2559 J0.1088
165 | G2 X-0.3842 Y-0.3574 I-0.1486 J0.2319
166 | G2 X-0.4865 Y-0.3335 I-0.0033 J0.2159
167 | G2 X-0.5603 Y-0.2729 I0.1079 J0.2068
168 | G1 Y-0.5991
169 | G1 X-0.6738
170 | G1 Y-0.1513
171 | G0 Z0.125
172 | G0 X-0.5586 Y-0.1219
173 | G1 F10.0 Z-0.001
174 | G3 F60.0 X-0.5186 Y-0.2022 I0.2066 J0.0526
175 | G3 X-0.4624 Y-0.2478 I0.1393 J0.1145
176 | G3 X-0.3918 Y-0.2641 I0.0691 J0.1387
177 | G3 X-0.3198 Y-0.2472 I0.0014 J0.1565
178 | G3 X-0.2625 Y-0.2003 I-0.0865 J0.1642
179 | G3 X-0.2186 Y-0.1056 I-0.1741 J0.1382
180 | G3 X-0.2082 Y-0.0016 I-0.463 J0.0985
181 | G3 X-0.2185 Y0.0988 I-0.445 J0.0051
182 | G3 X-0.2612 Y0.1902 I-0.2152 J-0.0448
183 | G3 X-0.3165 Y0.2368 I-0.1435 J-0.1141
184 | G3 X-0.3868 Y0.2539 I-0.0691 J-0.1308
185 | G3 X-0.459 Y0.2348 I-0.0004 J-0.1446
186 | G3 X-0.5155 Y0.1858 I0.1042 J-0.1769
187 | G3 X-0.5599 Y0.0921 I0.1824 J-0.1439
188 | G3 X-0.571 Y-0.0111 I0.4286 J-0.0981
189 | G3 X-0.561 Y-0.1111 I0.4541 J-0.0052
190 | G3 X-0.5586 Y-0.1219 I0.209 J0.0418
191 | G0 Z0.125
192 | G0 X0.0092 Y-0.0653
193 | G1 F10.0 Z-0.001
194 | G2 F60.0 X0.0069 Y-0.013 I0.4635 J0.0463
195 | G2 X0.0253 Y0.1266 I0.49 J0.0063
196 | G2 X0.094 Y0.2495 I0.2937 J-0.0834
197 | G2 X0.1968 Y0.3207 I0.209 J-0.1921
198 | G2 X0.3199 Y0.3429 I0.1188 J-0.3064
199 | G2 X0.4396 Y0.321 I0.004 J-0.3162
200 | G2 X0.5394 Y0.2514 I-0.1055 J-0.2578
201 | G2 X0.6066 Y0.1308 I-0.2207 J-0.202
202 | G2 X0.6246 Y-0.006 I-0.4641 J-0.1307
203 | G2 X0.624 Y-0.0363 I-1.1335 J0.0085
204 | G1 X0.1243
205 | G3 X0.1404 Y-0.1264 I0.3467 J0.0157
206 | G3 X0.1867 Y-0.2054 I0.1984 J0.0632
207 | G3 X0.3268 Y-0.2641 I0.1356 J0.1272
208 | G3 X0.4334 Y-0.2312 I0.0048 J0.1741
209 | G3 X0.4761 Y-0.184 I-0.1056 J0.1381
210 | G3 X0.5034 Y-0.1265 I-0.2498 J0.1544
211 | G1 X0.6208 Y-0.141
212 | G2 X0.583 Y-0.2296 I-0.3145 J0.082
213 | G2 X0.518 Y-0.3007 I-0.2247 J0.1403
214 | G2 X0.4267 Y-0.3449 I-0.1599 J0.2137
215 | G2 X0.3262 Y-0.3574 I-0.0969 J0.3673
216 | G2 X0.1999 Y-0.337 I-0.005 J0.3687
217 | G2 X0.0927 Y-0.2672 I0.094 J0.2616
218 | G2 X0.0252 Y-0.1484 I0.2166 J0.2017
219 | G2 X0.0092 Y-0.0653 I0.4475 J0.1294
220 | G0 Z0.125
221 | G0 X0.1306 Y0.0571
222 | G1 F10.0 Z-0.001
223 | G1 F60.0 X0.5047
224 | G3 X0.4926 Y0.1236 I-0.3356 J-0.0268
225 | G3 X0.4618 Y0.1839 I-0.1636 J-0.0456
226 | G3 X0.3211 Y0.2495 I-0.1362 J-0.1084
227 | G3 X0.1893 Y0.1971 I-0.0043 J-0.1815
228 | G3 X0.1467 Y0.1326 I0.1313 J-0.1328
229 | G3 X0.1306 Y0.0571 I0.2303 J-0.0887
230 | G0 Z0.125
231 | G0 X0.7412 Y0.0837
232 | G1 F10.0 Z-0.001
233 | G2 F60.0 X0.7407 Y0.1082 I0.5215 J0.0227
234 | G2 X0.7673 Y0.3004 I0.6459 J0.0084
235 | G2 X0.8643 Y0.4684 I0.405 J-0.1218
236 | G2 X1.0099 Y0.568 I0.2954 J-0.2758
237 | G2 X1.1836 Y0.599 I0.1677 J-0.4369
238 | G2 X1.4145 Y0.5378 I0.0061 J-0.4431
239 | G2 X1.5709 Y0.3669 I-0.2021 J-0.3421
240 | G2 X1.6126 Y0.246 I-0.4508 J-0.2228
241 | G2 X1.6252 Y0.1189 I-0.6041 J-0.1243
242 | G2 X1.6119 Y-0.0104 I-0.6073 J-0.0028
243 | G2 X1.5684 Y-0.1328 I-0.4911 J0.1054
244 | G2 X1.4075 Y-0.3013 I-0.3494 J0.1726
245 | G2 X1.1829 Y-0.3581 I-0.2218 J0.4049
246 | G2 X1.0618 Y-0.343 I-0.0025 J0.4735
247 | G2 X0.9495 Y-0.295 I0.1059 J0.4032
248 | G2 X0.7937 Y-0.1227 I0.2106 J0.3471
249 | G2 X0.7412 Y0.0837 I0.469 J0.2292
250 | G0 Z0.125
251 | G0 X0.867 Y0.0872
252 | G1 F10.0 Z-0.001
253 | G3 F60.0 X0.8863 Y-0.0342 I0.4738 J0.0131
254 | G3 X0.9564 Y-0.1574 I0.3033 J0.091
255 | G3 X1.1823 Y-0.2533 I0.2187 J0.2012
256 | G3 X1.3066 Y-0.2297 I0.004 J0.318
257 | G3 X1.4094 Y-0.1562 I-0.1146 J0.269
258 | G3 X1.4803 Y-0.0268 I-0.2365 J0.2136
259 | G3 X1.499 Y0.1195 I-0.5092 J0.1396
260 | G3 X1.4904 Y0.22 I-0.5565 J0.0028
261 | G3 X1.4605 Y0.3164 I-0.4006 J-0.0713
262 | G3 X1.3489 Y0.447 I-0.2653 J-0.1138
263 | G3 X1.1842 Y0.4937 I-0.1607 J-0.2531
264 | G3 X0.9602 Y0.4041 I-0.0045 J-0.3134
265 | G3 X0.9124 Y0.3396 I0.1696 J-0.1757
266 | G3 X0.8761 Y0.2256 I0.3481 J-0.1739
267 | G3 X0.8669 Y0.1063 I0.7033 J-0.1142
268 | G3 X0.867 Y0.0872 I0.474 J-0.0059
269 | G0 Z0.125
270 | G0 X1.7691
271 | G1 F10.0 Z-0.001
272 | G1 F60.0 Y0.5826
273 | G1 X1.8826
274 | G1 Y0.0552
275 | G1 X2.1514 Y0.3277
276 | G1 X2.2984
277 | G1 X2.0422 Y0.0792
278 | G1 X2.3243 Y-0.3423
279 | G1 X2.1842
280 | G1 X1.9627 Y0.0003
281 | G1 X1.8826 Y-0.0767
282 | G1 Y-0.3423
283 | G1 X1.7691
284 | G1 Y0.0872
285 | G0 Z0.125
286 | G0 X2.3737 Y0.0387
287 | G1 F10.0 Z-0.001
288 | G2 F60.0 X2.3936 Y0.142 I0.4767 J-0.0383
289 | G2 X2.4757 Y0.2684 I0.2668 J-0.0833
290 | G2 X2.5741 Y0.3252 I0.1952 J-0.225
291 | G2 X2.6864 Y0.3429 I0.109 J-0.3265
292 | G2 X2.8089 Y0.3214 I0.0042 J-0.3359
293 | G2 X2.9123 Y0.252 I-0.1045 J-0.2674
294 | G2 X2.9809 Y0.1358 I-0.2103 J-0.2027
295 | G2 X3.0 Y0.0022 I-0.4192 J-0.1278
296 | G2 X2.9922 Y-0.102 I-0.6432 J-0.0046
297 | G2 X2.9608 Y-0.2016 I-0.3284 J0.0487
298 | G2 X2.8479 Y-0.3164 I-0.2422 J0.1253
299 | G2 X2.6864 Y-0.3574 I-0.1586 J0.2861
300 | G2 X2.563 Y-0.3364 I-0.0045 J0.3461
301 | G2 X2.4586 Y-0.2672 I0.1004 J0.2648
302 | G2 X2.3902 Y-0.1456 I0.2134 J0.2001
303 | G2 X2.3722 Y-0.0073 I0.4726 J0.1318
304 | G2 X2.3737 Y0.0387 I0.4782 J0.0077
305 | G0 Z0.125
306 | G0 X2.4901 Y0.0298
307 | G1 F10.0 Z-0.001
308 | G3 F60.0 X2.4889 Y-0.0073 I0.4225 J-0.032
309 | G3 X2.5 Y-0.1088 I0.4249 J-0.0051
310 | G3 X2.5451 Y-0.2003 I0.2117 J0.0474
311 | G3 X2.6864 Y-0.2641 I0.1376 J0.1166
312 | G3 X2.8271 Y-0.1997 I0.0032 J0.1789
313 | G3 X2.8724 Y-0.1065 I-0.1677 J0.1391
314 | G3 X2.8832 Y-0.0035 I-0.432 J0.0977
315 | G3 X2.8719 Y0.0957 I-0.3951 J0.0049
316 | G3 X2.8265 Y0.1845 I-0.2065 J-0.0494
317 | G3 X2.6864 Y0.2489 I-0.1372 J-0.1139
318 | G3 X2.5451 Y0.1852 I-0.0037 J-0.1803
319 | G3 X2.4999 Y0.0939 I0.164 J-0.1379
320 | G3 X2.4901 Y0.0298 I0.4127 J-0.0961
321 | G0 Z0.125
322 | M5
323 | M30
324 |
--------------------------------------------------------------------------------