DanChianucci / Eagle2Kicad

Converts an Eagle 6.0+ .brd into a kicad .brd
MIT License
92 stars 30 forks source link

Extraneous 'hjustify' field in TEXTPCB De? #23

Closed abetusk closed 10 years ago

abetusk commented 10 years ago

The TEXTPCB De documentation for KiCAD and in the PDF documentation (page 23), there is no 'hjustify' field.

The documentation is sometimes incomplete or just wrong. I haven't tried it but I assume KiCAD reads these boards just fine with this extra field? Does KiCAD expect this other field or optionally read it if it's available? If not, should this field be taken out?

The relevant line is in Common/Shapes.py:

def boardRep(self):
    X, Y = self.getBoardOffset()
    hjustify = self.hJust[0].capitalize()
    try:
        myString = '$TEXTPCB\n'
        myString += 'Te "' + self.val + '"\n'
        myString += 'Po ' + X + ' ' + Y + ' ' + self.size + ' ' + self.size + ' ' + self.width + ' ' + self.rot + \
                    '\n'
        myString += 'De ' + self.layer + ' ' + self.mirror + ' 0000 ' + self.style + ' ' + hjustify + '\n'
        myString += '$EndTEXTPCB\n'
    except TypeError:
        return '\n'
    return myString
DanChianucci commented 10 years ago

I can attest to the incompleteness of some of the old KiCad file format definitions. When I first wrote this it was almost harder to figure out the documented kicad format than it was the undocumented Eagle format.

A few of the formatting fields I figured out by designing demo boards in KiCad and then saving them to see what the differences were. I would imagine that the "hJustify" is one such field.

I believe the field is respected because otherwise I have no idea why I would have written code to do it. A simple way to test whether the field is actually respected by KiCad would be to just create a test board and with two text fields.

abetusk commented 10 years ago

Just tested on a board by replacing "R" with "L" and sure enough it becomes left justified instead of right justified. I'm running Pcbnew (2013-07-07 BZR 4022)-stable but I assume it was valid for older versions of KiCAD since you have it in here.