MakerCam and Inkscape Post-Processor

an open source, web based CAM package that works!
conoral11
Posts: 17
Joined: Sat Apr 27, 2013 9:57 am

MakerCam and Inkscape Post-Processor

Post by conoral11 » Tue May 07, 2013 5:05 pm

Hi there,

I've been having trouble with MakerCam, and Inkscape, generating very long strings.

With Inkscape, the 4 decimal places post processor sorted most things out, but the white spaces still caused me some troubles.

And MakerCam doesn't seem to have the ability to limit the number of decimal places.

So I've hacked togeter a post processor that:
  • Removes all comments inside (And including) brackets, my Marlin/Sprinter firmware didn't like this at all.
  • Removes all spaces (but leaves line returns)
  • Reduces all numbers down to 4 decimal places.
Having processed all my parts with this (Simulated, and drawn) Marlin doesn't complain anymore and doesn't stop mid print.

Currently it is compiled on Ubuntu 13.04 x64, I'll get round to compiling it for other platforms when I have time.

I'll also release the source code when i've tidied it up (It is hacked together after all!).

I hope this helps anyone else out there!

Kind Regard

Conoral11
Attachments
GCodePostProcessor.zip
V0.1 - Alpha GCode PostProcessot for MakerCam and Inkscape files. Command Line ONLY
(4.09 KiB) Downloaded 1261 times

WillAdams
Posts: 8489
Joined: Mon Apr 09, 2012 6:11 pm
Location: Pennsylvania --- south of the Turnpike, East of US-15
Contact:

Re: MakerCam and Inkscape Post-Processor

Post by WillAdams » Tue May 07, 2013 6:23 pm

Very cool! and very timely!

Have you considered integrating it as part of grecode?

http://code.google.com/p/grecode/

William
Shapeoko 3XL #0006 w/Makita RT0701 Router w/0.125″ and ¼″ Elaire precision collets
Nomad 883 Pro #596 (bamboo)

TonyB
Posts: 105
Joined: Mon Apr 29, 2013 3:34 am
Location: Norwalk, Ia

Re: MakerCam and Inkscape Post-Processor

Post by TonyB » Wed May 08, 2013 5:21 pm

I did something similiar, but I only had issues with rounding; so that's all I coded to fix. If someone wants to host this web based version or integrate what I wrote into grecode, I'd be more than happy to give the code up. I've been too busy upgrading my Shapeoko to really care about anything else... lol. What I wrote is kind of more work than needs to be done; but it's extremely effective. I can only imagine you could write a regex that would handle it, in one line of code...

Drop your gCode in:
Image

Type how many decimals you'd like to round to, then click 'Run It'.
Image
MegaSquirted 62mm 7m @ 20psi on 91 octane
410whp/411ftlbs

Build Thread
Image

WillAdams
Posts: 8489
Joined: Mon Apr 09, 2012 6:11 pm
Location: Pennsylvania --- south of the Turnpike, East of US-15
Contact:

Re: MakerCam and Inkscape Post-Processor

Post by WillAdams » Wed May 08, 2013 6:53 pm

Tony, I looked, but couldn't find that you posted your code anywhere --- is there any way that you could share it (or point me to where I missed it)?

William
Shapeoko 3XL #0006 w/Makita RT0701 Router w/0.125″ and ¼″ Elaire precision collets
Nomad 883 Pro #596 (bamboo)

TonyB
Posts: 105
Joined: Mon Apr 29, 2013 3:34 am
Location: Norwalk, Ia

Re: MakerCam and Inkscape Post-Processor

Post by TonyB » Thu May 09, 2013 3:45 pm

WillAdams wrote:Tony, I looked, but couldn't find that you posted your code anywhere --- is there any way that you could share it (or point me to where I missed it)?
I didn't attach it yet.

This is sloppy JavaScript at best, but I threw it together quick. It runs in a fraction of a second, so in reality... who really cares how much code there is if it works effectively?

I also didn't add much for validation, so if you enter less than 1 or more than 5 into the decimal box, it will most definitely give you crappy results.

1. Unzip the folder.
2. Open index.html, which should open in your default browser.
3. Enter your amount of decimals.
4. Paste in your gCode.
5. Click 'Run It'.
6. Copy your gCode out and save it down using a text editor.

This process could be cleaned up a lot or even just rewritten in another language to be added to grecode. Though, I think you could incorporate this idea into a Regular Expression (regex), instead of splitting, looping, rewriting, concating.
Attachments
roundDecimals.zip
(38.57 KiB) Downloaded 650 times
MegaSquirted 62mm 7m @ 20psi on 91 octane
410whp/411ftlbs

Build Thread
Image

WillAdams
Posts: 8489
Joined: Mon Apr 09, 2012 6:11 pm
Location: Pennsylvania --- south of the Turnpike, East of US-15
Contact:

Re: MakerCam and Inkscape Post-Processor

Post by WillAdams » Thu May 09, 2013 4:03 pm

Very cool. Thanks!

We'll have to see about getting that added to the MakerCAM site or something.

In the meanwhile, added to the wiki.

William
Shapeoko 3XL #0006 w/Makita RT0701 Router w/0.125″ and ¼″ Elaire precision collets
Nomad 883 Pro #596 (bamboo)

TonyB
Posts: 105
Joined: Mon Apr 29, 2013 3:34 am
Location: Norwalk, Ia

Re: MakerCam and Inkscape Post-Processor

Post by TonyB » Thu May 09, 2013 6:15 pm

WillAdams wrote:Very cool. Thanks!
No problem, I'm just glad I can help. If everyone that gets help from the forum/wiki pays it forward, we can accomplish some amazing stuff. I'm sure what I wrote was small in comparison to what others have done, but it's a start!
WillAdams wrote:We'll have to see about getting that added to the MakerCAM site or something.
If anyone has a nack for writing Regular Expressions, I really think it would take one line of code to round all this numbers. MakerCAM would be a good place for the change, since it produces the gCode. Though, it could be added into the gCode Sender, which wouldn't be a bad place for it. Though I'm assuming those that use MakerCAM, may not all use the same gCode sender; and vice-versa. So, it may be good to have the same code in both. It's not like it'd round it further if it ran twice, it just wouldn't do anything the second time.
WillAdams wrote:In the meanwhile, added to the wiki.
If it gets some attention, I could rewrite it, add functionality, etc. Or, if someone else wants help with developing their solution, I could offer some time, ideas, etc.


Though I've been busy working on my upgrades:
Image

But I'm working on something 90% of my free time, so it'll be back up and running in no time.

Will, I just wanted to say thanks. I've only posted one thread, but I've read through quite a few and have noticed you're doing a lot of work that is very beneficial to the community. What good is documentation if it isn't kept up to date? How good are programs if they aren't working properly... and how can a developer fix these overlooked issues without someone pointing them out. It reminds me of our QA department here at work, developers would be next to useless without them.

Thanks again,
Tony
MegaSquirted 62mm 7m @ 20psi on 91 octane
410whp/411ftlbs

Build Thread
Image

WillAdams
Posts: 8489
Joined: Mon Apr 09, 2012 6:11 pm
Location: Pennsylvania --- south of the Turnpike, East of US-15
Contact:

Re: MakerCam and Inkscape Post-Processor

Post by WillAdams » Thu May 09, 2013 6:43 pm

TonyB wrote:If anyone has a nack for writing Regular Expressions, I really think it would take one line of code to round all this numbers.
AIUI, one could truncate, not round. Here's a quick brute-force method to chop it off to 4 digits:

Search for:

Code: Select all

\.(\d\d\d\d)\d*
replace w/:

Code: Select all

.$1
For those who're using Scite:

Search for:

Code: Select all

\.\(\d\d\d\d\)\d*
replace w/:

Code: Select all

.\1
I don't think that'd have any un-toward consequences. (one should preserve at least 3 digits for files in imperial, 4 digits for metric files)

I don't like building it in to MakerCAM, 'cause I really think tools should be as accurate as is possible, and one should defer discarding information until the last possible moment, just in case one needs to do something like re-size your file to 102%. I'd rather see it in the G-Code sending (Communication / Control) programs, or better still, built-into Grbl (surely it's not so time-bound that it can't receive a couple of extra characters and discard them).

Very cool upgrades! I envy your having room for that --- I have to keep my machine man-portable (and low-cost) to preserve the domestic harmony quotient.

Thanks for the kind words --- I'm glad to help out, and very much enjoy the community here. Above all, recent events (TinkerCAD, Adobe going subscription-only) have underscored to me the importance of the freedom open source affords, so I'm pleased to be able to contribute in a meaningful way to make the project better, and looking forward to the future.

William
Shapeoko 3XL #0006 w/Makita RT0701 Router w/0.125″ and ¼″ Elaire precision collets
Nomad 883 Pro #596 (bamboo)

TonyB
Posts: 105
Joined: Mon Apr 29, 2013 3:34 am
Location: Norwalk, Ia

Re: MakerCam and Inkscape Post-Processor

Post by TonyB » Thu May 09, 2013 8:01 pm

WillAdams wrote:
TonyB wrote:If anyone has a nack for writing Regular Expressions, I really think it would take one line of code to round all this numbers.
AIUI, one could truncate, not round. Here's a quick brute-force method to chop it off to 3 digits:

Search for:

Code: Select all

\.(\d\d\d)\d*
replace w/:

Code: Select all

.$1
I don't think that'd have any un-toward consequences.
I agree. Once you go past two decimals, I can only imagine the machine isn't that precise. How could it be?

WillAdams wrote:I don't like building it in to MakerCAM, 'cause I really think tools should be as accurate as is possible, and one should defer discarding information until the last possible moment, just in case one needs to do something like re-size your file to 102%. I'd rather see it in the G-Code sending (Communication / Control) programs, or better still, built-into Grbl (surely it's not so time-bound that it can't receive a couple of extra characters and discard them).
Well, it could be an option? But I see what you're saying and again, I agree. Couldn't we see about zapmaker adding it to the Grbl Controller? Then it does the rounding or truncating when it imports the file to the program or as the program sends the code out to the Arduino?

WillAdams wrote:Very cool upgrades! I envy your having room for that --- I have to keep my machine man-portable (and low-cost) to preserve the domestic harmony quotient.
Thanks! I barely have enough room... as I described in my first thread, I have a Jeep (which I park outside), a Celica Supra, an R6 (which are both in my half of the garage), and this Shapeoko; then all the tools and other things to maintain them... I set my Shapeoko up with some eyelet bolts, two pulleys, and rope so I can hoist it up against the wall on top of my toolbox. It's funny what we'll do to have what we want ;).
MegaSquirted 62mm 7m @ 20psi on 91 octane
410whp/411ftlbs

Build Thread
Image

WillAdams
Posts: 8489
Joined: Mon Apr 09, 2012 6:11 pm
Location: Pennsylvania --- south of the Turnpike, East of US-15
Contact:

Re: MakerCam and Inkscape Post-Processor

Post by WillAdams » Thu May 09, 2013 8:43 pm

TonyB wrote:Couldn't we see about zapmaker adding it to the Grbl Controller? Then it does the rounding or truncating when it imports the file to the program or as the program sends the code out to the Arduino?
Already done:

https://github.com/zapmaker/GrblHoming/issues/6

and he thought it was reasonable for the next version.
Shapeoko 3XL #0006 w/Makita RT0701 Router w/0.125″ and ¼″ Elaire precision collets
Nomad 883 Pro #596 (bamboo)

Post Reply