← Back to team overview

kicad-developers team mailing list archive

Re: where footprints come from (was Re: Re: Internal

 

Werner Almesberger wrote:
Lorenzo wrote:

Actually zsh because I was lazy and zsh has floating point


Aah, zsh ! How could I forget ... I guess Dick's choice would be
Java. Awk, anyone ? :)

On footprints:

(footprint footprint_def
(units mil)
(resolution 10)
(const variable_def 30.4)
(padstack pad_def ......)
(pad pin1 pad_def 0 0 (expr 0 + variable_def * 0))
(pad pin2 pad_def 0 0 (expr 0 + variable_def * 1))
(pad pin3 pad_def 0 0 (expr 0 + variable_def * 2))
(pad pin4 pad_def 180 250 (expr 0 + variable_def * 0))
(pad pin5 pad_def 180 250 (expr 0 + variable_def * 1))
(pad pin6 pad_def 180 250 (expr 0 + variable_def * 2))
(pad pin7 pad_def 180 250 (expr 0 + variable_def * 3))
(outline....)

# we should probably support comments, and teach the
# lexer to pass them up to the parser so they can be preserved.
)

We really don't need much in terms of expression support. Simple mx+b support is about all for positioning a pad with given shape. In the above example, the keyword choices are negotiable. The tokens like *_def are identifiers and would get more meaningful names than the ones presented. Using a smart copy and paste routine accessible from within the footprint editor, using the STRINGFORMATTER that I presented already, a person could copy the footprint to the clipboard, from there paste it into a text editor, edit it, and then "smart paste" it back into the footprint editor. This is an alternative interactive trial and error opportunity for designing a footprint. The smart paste routine would have to report line number and offset of any syntax or grammar errors.


If you want another pad, simply copy a line of text in your text editor and add another pad row or two.


In the above example the (expr) element replaces the relative Y coordinate with an expression of mx+b. The same could be supported with X coordinate. In the second half of the pad instantiations, they are rotated 180 degrees. Re-use the specctra elements where they make sense, add our own when none exists that we need such as (expr).


KISS.
(When she's attractive only. Walk away if she's ugly.)


Dick








Follow ups

References