Mail Archives: geda-user/2015/07/14/08:19:16
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
--0-414698107-1436876341=:6924
Content-Type: TEXT/PLAIN; charset=UTF-8; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE
On Tue, 14 Jul 2015, Mitch Davis (mjd+geda-user AT hackvana DOT com) [via geda-use=
r AT delorie DOT com] wrote:
>On Sat, Jul 11, 2015 at 7:34 AM, Roland Lutz <rlutz AT hedmen DOT org> wrote:
> On Fri, 10 Jul 2015, gedau AT igor2 DOT repo DOT hu wrote:
> So next time I have something similar to solve, I
> will first ask you for the scheme code and only if
> that fails I do the dirty sch-parsing awk fewliner.
>
>
> You could use Xorn.=C2=A0 Since this uses the actual gEDA parsing
> code, the result is exactly what gEDA would see when reading the
> file.=C2=A0 Taking the "outputting coords of line segments" task as
> an example, this would be:
>
> =C2=A0 =C2=A0 import xorn.storage
> =C2=A0 =C2=A0 from xorn.geda.read import read
>
> =C2=A0 =C2=A0 sch =3D read('some-schematic.sch')
>
> =C2=A0 =C2=A0 for ob in sch.toplevel_objects():
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 data =3D ob.data()
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 if isinstance(data, xorn.storage.Line):
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 print 'X1: %d Y1: %d X2: %=
d Y2: %d' % (
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 data.x, data=
=2Ey, data.x + data.width, data.y +
> data.height)
>
>
>I don't know why everyone is complaining about Scheme.=C2=A0 I can read th=
is just
>fine, the first time I ever saw it.
One of the reasons for that might be that the above code is not in Scheme.
</sarcasm>
--0-414698107-1436876341=:6924--
- Raw text -