Micron units in G-Code

More
11 Nov 2011 08:01 #14755 by jpka
Micron units in G-Code was created by jpka
Hi! :)
I now try to use Gerber files as G-code for Emc2 controlled mill, modified to use as solder paste disperser.
The Gerber code, at middle, looks like this
*snip*
G54D57*

X232410Y196850D3*

G54D65*

X248920Y120650D3*

Y123190D3*

X119380Y125730D3*

X121920D3*

Y146685D3*

X119380D3*

X114300D3*

X116840D3*

X113030Y194310D3*

*snip*
Unfortunately, i can't tune my old pirated pcb software to output gerber files in millimeter units. I can't change anything at all, so only i can is use this code as is. It looks as uses micron units. But i can't find in Emc2 G-code reference, any microns compatibility. Only i see is G20/G21 mm/inch modes.
I also don't have skill to write parser which inserts decimal points into values. But i probably have enough skill to replace in text editor all D3*'s to subroutine call which makes solder paste piece.
So the question is, can I tell Emc2 to use micron units, OR, is there any scaling function present which i can set to 1:1000 once (probably in G-code)?
I also not found on the web any translators Gerber to G-code usable for this simple task.
Thanks=)

Please Log in or Create an account to join the conversation.

More
11 Nov 2011 08:24 #14757 by cncbasher

Please Log in or Create an account to join the conversation.

More
11 Nov 2011 13:32 #14767 by jpka
Replied by jpka on topic Re:Micron units in G-Code
Thank you for web links!
I try now to use it.
But gcam is constantly segfaults :-(
2nd program is work. But 2nd and 3rd prorgams are intended to 'isolation routing', it is not what i search, i need something much more simple :-)
So i try to use standard software like OpenOffice, to process my Gerber code.
I add decimal point in Calc, and auto-replace some codes according to G-code rules in Writer (a bit tricky: '\n' acts as line delimiter in RegExp autoreplace mode). Only i add to g-code are header, footer and small routine to place paste pieces. It was quick and conforms to KISS rule B) Drop me a line if you need details.
But the result i still can't use due to too many long X-Y jogs present (i.e., components not grouped). I will try to solve it... But i hope it is already very useable for people who has air compressor and electrical valve for control of paste flow - you just place valve relay control in subroutine.
Please see example picture :-)
(example output)
X178.054Y135.382
O100 call
Y137.922
O100 call
X186.690Y121.920
O100 call
Y119.380
O100 call
Y137.160
O100 call
Y139.700
O100 call
Attachments:

Please Log in or Create an account to join the conversation.

More
13 Nov 2011 19:47 #14793 by andypugh
Replied by andypugh on topic Re:Micron units in G-Code
jpka wrote:

Unfortunately, i can't tune my old pirated pcb software to output gerber files in millimeter units.


No problem, just use mm, but alter the EMC2 INI file so that the axis scale factors are 1000x bigger.

Please Log in or Create an account to join the conversation.

More
14 Nov 2011 01:06 #14799 by jmelson
Replied by jmelson on topic Re:Micron units in G-Code
jpka wrote:

Hi! :)
I now try to use Gerber files as G-code for Emc2 controlled mill, modified to use as solder paste disperser.
The Gerber code, at middle, looks like this

*snip*
G54D57*

X232410Y196850D3*

OK, a Gerber file contains coordinates with suppressed decimal point, and leading zeroes suppressed.
(That's easier to handle than the Excellon files where the tradition is TRAILING zeroes suppressed!)
Still, a Gerber doesn't draw a component pad, it goes to the center and flashes the selected aperture.
Maybe all you are looking for is center of the pad, which is what is in the Gerber command.

Anyway, I think what you want to do is write a program in your favorite computer language that
reads in the whole Gerber file and picks out the Dxx aperture commands (to know pad size) and
the D3 lines (which I think are the flash commands for the pads). Ignore the D1 and D2, those
are the write line on and off commands, if I recall correctly. But, keep the coordinates of all lines,
as a flash command may allow a previous X or Y coordinate to remain without rewriting it.

Then, produce your G-code for the paste dispenser, maybe even doing a sort to reduce
paste printing time.

Jon

Please Log in or Create an account to join the conversation.

More
14 Nov 2011 17:47 #14814 by jpka
Replied by jpka on topic Re:Micron units in G-Code

just use mm, but alter the EMC2 INI file so that the axis scale factors are 1000x bigger.

It looks exactly what i need! But i have some problems with it:
I found in my-mill.ini these values: (only one axis shown for example)
[AXIS_0]
MAX_VELOCITY = 16.0
MAX_ACCELERATION = 1000.0
STEPGEN_MAXACCEL = 1250.0
SCALE = 266.666666667
MIN_LIMIT = -1000.0
MAX_LIMIT = 2000.0
1. When i change (multiply) it all by factor of 1000, i probably get Emc2 working in microns domain, but, now i can't anymore use [+] and [-] manual jog buttons in Axis GUI, they are now 1000x times slower... :unsure:
2. This method is now requires to use two different ini files for different tasks. It is not excellent, while it still much more simple than processing Gerber file in OpenOffice Calc to get decimal points in it. So thank you for this solution!
Ideally i may need some G-code command for set scaling, but i still can't found it: it looks non-industry-standard for professional fab use of G-code. Maybe in far future, it can be realized in Emc2's G-code for DIYers :-)

Maybe all you are looking for is center of the pad, which is what is in the Gerber command.

Yes, it is only i need take from Gerber file.

Anyway, I think what you want to do is write a program in your favorite computer language

I take all possible skills i have to avoid any custom programming and thus make my research/solutions not only simple, but also useable for most other usres. But, unfortunately, i found that i can't avoid programming now, because of

maybe even doing a sort to reduce paste printing time.

This sort (grouping of components to limit max jog length) is looks to be required for me, because i have free-running solder paste flow from needle. It is may not required for people who use switched paste flow.
So i now start C programming. While writing in C is a headache for me, hope results can be useful in community. Maybe real programmers can help me with two tasks:
1. Take Gerber string like X248920Y120650D3*, Y123190D3* and pull one or two values from it into float variables;
2. Has anyone an idea about minimizing jog paths algorithm? It is like a task about tourist's shortest way?
Thanks for your support! B)

Please Log in or Create an account to join the conversation.

More
14 Nov 2011 18:54 #14817 by andypugh
Replied by andypugh on topic Re:Micron units in G-Code
jpka wrote:

1. When i change (multiply) it all by factor of 1000, i probably get Emc2 working in microns domain, but, now i can't anymore use [+] and [-] manual jog buttons in Axis GUI, they are now 1000x times slower.


Have a look at INCREMENT in the INI file.
www.linuxcnc.org/docview/html/config_ini...5BDISPLAY%5D-section
(You probably also want to change the default jog velocity too)

Please Log in or Create an account to join the conversation.

More
23 Nov 2011 14:19 #15055 by jpka
Replied by jpka on topic Re:Micron units in G-Code
Hi!
I almost done a small C program to optimize jogs a bit. While C programming is a big headache (>90% of time is hair tearing solving tasks like why strcpy not work or why variable named 'mm' works like null device), i still get some useful results. It contain Gerber parser also, so i not need anymore to turn Emc2 to work with microns. (How to mark topic as [Solved]?) I keep the code as simple and small as possible, so i hope it will be useable by others for paste or even drilling the PCB. The optimizer must minimize total path length (it's what others want), but, as side effect, result shows almost all individual jogs good enough (it's what i want).

File Attachment:

File Name: gerbcream.txt
File Size:6 KB
Attachments:

Please Log in or Create an account to join the conversation.

More
23 Nov 2011 14:34 #15056 by andypugh
Replied by andypugh on topic Re:Micron units in G-Code
I think if you can make that work using command-line arguments, then you could use it as a filter program for EMC2, so that opening the .gbr file in Axis would call it automatically, and pass the resulting G-code to EMC2. That sounds like a useful function, and one that might be worth considering adding to the EMC2 main project.

Please Log in or Create an account to join the conversation.

More
06 Dec 2011 10:48 #15421 by jpka
Replied by jpka on topic Re:Micron units in G-Code
I consider to do this in near future and add tiny GUI to it for user selection of work area, shift coordinates, etc. So i currently gathering all needed information, especially about how to (easy) integrate my program as a filter in Axis's 'open' menu and then how to auto-transfer generated .ngc file to it...
I also test it on other pcb's and get very nice results, these are production-quality and quantity, i already put these pcb's in my radio stations and turn it on. (pick'n'place was done too and it of course EMC-controlled; there is not too much of programming because of optimizing almost not need; if anyone need then i publish my C code.) I was impressed how quality and precise is EMC-controlled hardware work! Thank you developers for such a quality software suite! :silly:
Attachments:

Please Log in or Create an account to join the conversation.

Time to create page: 0.136 seconds
Powered by Kunena Forum