fundimike
Registered:1617203648 Posts: 6
Posted 1617204393
Reply with quote
#1
I am trying to convert an old project from rs-274D, and I have run into an issue with circle-arcs. Gerbview reads and understands the old project without problems but when it converts it to rs-274X it seems to "forget" that some of the arcs are counterclokwise - and the result is that it generates the "opposite" circle arc than what is intended. It seems that the rs-274X generator only generates G02 codes - which ofcourse is fine but it seems to have "fogotten" to swap the start and end points of circles it read from a G03 code in an original file. Alternatively it needs to retain the G03 codes rather than incorrectly convert them to G02. At least that is my understanding of the issue after having looked a bit into the g-codes themself. When first I load the original rs-274D including G03 codes it is displayed as such: if I then convert it to rs-274X and then load that file into gerbview it shows as: Notice that some are correct - I assume these are the ones that are G02 in the original file.
softcomp
Administrator
Registered:1370695867 Posts: 430
Posted 1617461367
Reply with quote
#2
Hi, Would it be possible to send us a sample file? Best regards, Support
fundimike
Registered:1617203648 Posts: 6
Posted 1617469971
Reply with quote
#3
Sure please find the sample attached to this post. The zip file includes the sample in 274D format which is interpreted and displayed correctly. Also include is the 274X file which, once I export it and load it back in shows many of the circle arcs incorrectly. Note I have removed a large portion of the g-code from the sample however the sample behaves identially to the full version in regards to the circle-arcs. From the outside the issue seems to me like it is either the loader not "swapping" the start and end point around in the internal data-structure to make it compatible with always being clockwise. OR the 274x exporter not retaining the fact that some of the circle-arcs are counter-clockwise.
Attached Files
Sample.zip
(30.88 KB, 2 views)
fundimike
Registered:1617203648 Posts: 6
Posted 1618193384
Reply with quote
#4
were you able to reproduce the issue, or is it a user error on my part ?
softcomp
Administrator
Registered:1370695867 Posts: 430
Posted 1618257743
Reply with quote
#5
Hi, I'm really sorry for the delayed response. We've verified that there is an error in GerbView. Best regards, support
fundimike
Registered:1617203648 Posts: 6
Posted 1618543688
Reply with quote
#6
I obviously have no insights into gerbview's datastructures or algorithms, and I am sure you know which way is the best to fix this issue. However it seems to me that a simple solution could be to amend the 274D loader/parser to simply transform the inputs prior to any interpretation. Something along the lines of: foreach g-code in inputfile { if (g-code == g03) { (endx, endy) = calculateEndPoint(startx, starty, radius) g-code = g02(endx, endy, radius) } }
fundimike
Registered:1617203648 Posts: 6
Posted 1619995947
· Edited
Reply with quote
#7
people have been on my case to get this convertion done, so I have had to find a solution. I have managed to solve the problem by writing a simple converter script which converted the RS-274D into a simplified RS-274D. Essentially it more or less does what I outlined in the previous post however I was mistaken in beliving it was the G03 commands that were the problem, infact it was the G02 commands. In short by converting all the G02's into G03's before feeding the original RS-274D files into gerbview I have been able to successfully convert the design files into valid RS-274X format, so that's good. In case anyone has the same issue here is a more accurate pseudo code of the convertion algorithm: Foreach g-code in inputfile { if (g-code == G02) { (oldStartX, oldStartY) = findCurrentStart // Run through the input-file backwards until you find x and y end cordinates of previous commands.
// Determine x/y movements in relation to circle arc center.
deltaI = G02_I_value - (g02_end_x - oldStartX)
deltaJ = G02_J_value - (g02_end_y - oldStartY)
g-code = G00(g02_x_value, g02_y_value) + G03(oldStartX, oldStartY, deltaI, deltaJ) + G00(g02_x_value, g02_y_value) }
fundimike
Registered:1617203648 Posts: 6
Posted 1619997285
Reply with quote
#8
Having "successfully" converted the rs-274d files into valid rs-274x files, I have come to the next challenge: Power planes. The original rs-274D files contains two dedicated power planes, which are negatives, however I need to get them into being positives. Luckily this is easily done with gerbview, simply click the invert property and "job done" (see example further down). However the original negative contained a number symbols/polygon-types, roughly speaking there are round ones and square ones. The round ones are the do not connect so that is perfect as it is.
The square ones are however "do connect" symboles, I am assuming that the PCB manufacturer used originally required this in order to produce the correct power-plane, or maybe it is just the way the original design tool (unkown which) outputs powerlanes (again see image further down).
I am wondering if anyone have any advice on what a good default / correct approach to fixing this is ?
I am thinking that I should just remove all the square markings, so that it is clear that the copper goes all the way to the via. If so what is the best/easiest way to do this using gerbview ? Example showing possitive version of a powerplane with both do and do-not connect symbols: