We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, I have a sketch of a G-code simulator that seems to be working with certain xyz value ranges stated in the sketch. If I eventually was to submit it as a tool on processing.org, can I post the sketch on the forum for faster debugging? It is quite long and I do not see an attachment button. Ryan
Answers
either post it here - split it over a few comments if too long
(you can only upload images here)
or upload it on dropbox or so
Hi Chrisir, I posted the sketch; however, there was some auto formatting the replaced many of the line endings perhaps from /r to /n or similarly. It also placed parts of the code in separate sections though it is all one sketch. Curpher
Here's how to format your code:
http://forum.processing.org/two/discussion/8045/how-to-format-code-and-text
Thanks bilmor. I was able to select all and then press the code icon. This action formatted my code correctly. I actually wrote this because it was less time consuming than installing debian 7.9 Linux OS to run LinuxCNC. It was mostly examples taken from Schiffman et. al and meshed together into a single script. There are very few G-code simulators I can list. I have never seen one implemented in the processing PDE. Can anyone on the forum debug the software for proper optimization?
(ctrl-t in the processing editor will indent the code correctly.)
this is preferable to
Ok. I will try to fix that. I consolidated the code into ~220 lines instead of ~500 lines. Have you run a g-code document? It works well. There are still too many bugs, but I can still orient the camera quite easily to see the pattern. I uploaded a short video to youtube. May not work when embedded in processing blog, but works from the address bar. Why this thing not let me paste actual hyperlink address rather than an embedded youtube video?
[video deleted, see below]
Embedded video does not work in my browser. Here is the hyperlink,
.
(you had a trailing . - fixed)
Thanks. My tool path line will not show up until after my tool has completed its movement. In objective-C I would use GCD async... to update the tool path animation asynchronously. Can you implement grand central dispatch in processing? I tried using the thread() command, but I was unsuccessful.
the screen does not update until draw() has finished. is that the case here?
tried that using an example circle from here:
https://github.com/grbl/grbl/wiki/G-Code-Examples
i got a NaN error.
btw, have you seen PeasyCam library? it could replace all your []`-= handling code...
Yea. Currently only accepts Gxx Xxx Yxx Zzz; i.e. it only accepts commands for straight lines. I will try adding more commands, soon. Attached is the pseudo g-code I used for 2.54mm pitch DIP headers shown in the Youtube video.
How can I convert my G-code X values determined by ddx1 into processing commands that would be equivalent to typing the following keys followed by return..... pressing "r", pressing "u", then inputting an integer representing the ddx1 value, followed by a return keystroke?
Nevermind. I figured it out.
I fixed some the camera angles for better viewing. I have also been able to have it simulating straight lines on XYZ coordinates with random numbers between -12500 to 12500. There is a bug when determining the spherical coordinate angle away from the z-axis. It is at the very very bottom of the sketch within sections beginning with "if (key == 39)" and "if (key == 59)". Can anyone help me fix this?
Attached is a bash script for generating 1000 random Gcode coordinates in a specified range. Here, I used the range from -12500 to 12500, arbitrarily.
Here is an updated video posted on youtube....
https://youtu.be/AuFpbSiYigU .