Mailing list archives : pcb-rnd

ID:64
From:ge...@igor2.repo.hu
Date:Sun, 4 Sep 2016 17:58:52 +0200 (CEST)
Subject:Re: [pcb-rnd] pcb issues: grid
in-reply-to:62 from Chris Smith <sp...@icloud.com>
Hi Chris,
 
On Sun, 4 Sep 2016, Chris Smith wrote:
 
> Hi Igor2,
>
>> On 4 Sep 2016, at 05:28, gedau@igor2.repo.hu wrote:
>>
>> Finished the first implemention. Tested them with save-load round trip, looking at preferences/sizes and bottom text (didn't inspect rotue styles).
>>
>> Chris, please test it on your system to see if round trips are the same as mines. If you have mainline from git in a Linux virtual box, could you please try whether it loads all 3 formats properly?
>>
>> (Note the new format combo box in the Save As dialog box. Default is the old centimil for now, until we can confirm the human readable format doesn't break)
>
> Mainline git reads all three formats properly.
 
Thanks for the tests!
 
>>> A. a natural unit .pcb; this would be the default .pcb long term. It would save using %06$mS; as far as I can tell, this would work with any mainline starting at least from 2011. This uses unit suffixes and "random" units.
>>
>> This should be very similar to mainline git files, except the excess zeros removed. Human readable, no rounding error in round trip.
>
> I honestly don?t know where you?re going with this one.  I have several lines in a .pcb which have mixed units, i.e. offsets in nm and thickness in mils.  IMHO, that?s not readable, it?s just confusing.
>
> I?m of the opinion that the ?natural? units should be whatever the drawing units are for the .pcb, with enough precision to represent nanometers.  If I use footprints in other units (mils) then I understand that these are ?foreign? units and will be converted to the natural units on import.  What matters to me is consistency ? I don?t mind so much about rounding errors when converting foreign units, rather that the result is exactly the same over save/reload cycles.
 
If you don't do mixed unit boards, this feature is totally useless or 
even confusing.
 
Unfortunately most of my boards are mixed-unit: almost every part I use 
are imperial, while all drill bits, board dimensions/outline and much of 
the DRC are metric. I also want to read my .pcb files with a text editor 
sometimes.
 
In a perfect world each Coord would have an attached unit info, so the 
software would remember how it happened - if you configured your drill 
holes in mm but placed your pins on a 100 mil grid, pcb-rnd would track 
those holes in mm and the coords in mil. But it's unfortunately not like 
that, and it'd be a huge edit (and potentially some more runtime 
overhead).
 
Instead we can let the code guess on save. I think the original intention 
behind %mS was this. The actual implementation, inherited from mainline, 
has some heuristics to find the best fit unit, but I have to admit it 
doesn't work as I'd like it to work. Instead of finding the "roundest", it 
mainly considers magnituede. I have plans to change this, and assign 
weigths (preferences) to units. Then if I have a 0.8 mm hole, it will 
print that as 0.8 mm because "that looks better than 800 um or 31.5 mil, 
but when I have a 10 mil wide trace it would be printed as 10 mil because 
it looks better than 0.254 mm.
 
Of course all this is optional. I totally understand your need for 
consistent units. It wouldn't help me much with my mixed unit boards, tho: 
if the above heuristics get it right only 70% of the time, I am already 
much closer than having it wrong 50% of the time. Nevertheless I will 
probably do a few things to make this as painless as possible:
 
- I will probably introduce a 4th format that prints all values in mm
 
- there will be a configuration setting about what the preferred/default 
"save as" format should be; anyone can have his own user config that sets 
his preferred format as default
 
- since .pcb files can have embedded config items, it's then also 
possible that a given design insists on using a specific (sub)format - so 
if multiple users work ont he same design with different preferred 
settings their clients won't VCS-fight, because a plain 'save' will always 
use the same format
 
 
<snip>
>> - value 0 is intentionally unsuffixed
>
>
> Why is this, out of interest?
 
I am not sure, it's how I inherited the code. I think it's somewhat 
reasonable in the "most natural unit" case: any unit is as natural as any 
other unit for value 0.
 
I am not sure I want to keep it like this, as it may be confusing not to 
have units there but have units everywhere else.
 
Regards,
 
Igor2
 

Reply subtree:
64 Re: [pcb-rnd] pcb issues: grid from ge...@igor2.repo.hu