Re: gEDA-user: External attribute read/write - how?

2008-11-09 Thread fricker

On Oct 22, 2008, at 7:31 PM, John Doty wrote:


 On Oct 22, 2008, at 10:01 AM, Peter TB Brett wrote:

 On Wednesday 22 October 2008 16:36:47 Frank Miles wrote:
 While a geda-newbie, over the years I've developed a set of
 programs which
 use a (Postgresql-based) database to update and error check
 schematics
 originating in a DOS-based OrCAD.  I would like to have similar
 capabilities in gschem/pcb. A key requirement is to be able to
 read and
 write component information (attributes) by external programs.

 ** Where/how can an external program read and/or write component
 attributes?? **


 Your best bet is probably either:

 (1) Link against libgeda, or

 (2) Process the (pretty straightforward) file format yourself.


 or

 (3) write a gnetlist back end (not as hard as it looks): gnetlist is
 effectively the tool for libgeda scripting.

or

(4) use Parse:GEDA:Gschem to read/modify/write attributes with a perl  
program
 on the model of demo/demo_geda-usch.pl included in the package.

I am in the process of collecting a wish-lists about AML/PLM  
interaction in an effort to build and adapt such tool for broader  
audience for update and error check of schematics. Anyone interested  
please speak-up.

Thanks,
_jP

  


___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


Re: gEDA-user: Parsing and writing schematics with Perl

2008-11-08 Thread fricker
Please use http://rt.cpan.org/Public/Dist/Display.html?Name=Parse-GEDA-Gschem
to report bugs about Parse::GEDA::Gschem.

Thanks,
_jP

On Nov 8, 2008, at 8:55 AM, fricker wrote:

 http://search.cpan.org/dist/Parse-GEDA-Gschem/

 Parse::GEDA::Gschem version 1.00

 NAME

 Parse::GEDA::Gschem - gEDA/gaf gschem schematic file parser


 DESCRIPTION

 Collection of routines used to parse and write back schematic
 files of the
 format specified by gEDA gschem schematic capture tool as
 detailed at:
 http://www.geda.seul.org/wiki/geda:file_format_spec


 REQUIREMENTS:
 perl 5.10


 EXAMPLE:
 my @schFiles = (); # array of schematic file path/names
 my @files = ();# array of schematic objects
 bakSchFiles([EMAIL PROTECTED]); # backup schematic files in bak/year-m-
 d_h-m-s/
 $files = @{readSchFiles([EMAIL PROTECTED])}; # parses the schematic files
 writeMsg(1, Dumper([EMAIL PROTECTED])); # prints out the entire data
 structure
 writeSchFiles([EMAIL PROTECTED]); # write the data structure into 
 schematic
 files

 Parse::gaf::gschem is a collection of routines used to parse
 a .sch file
 into a convenient perl array of hashes data structure in memory.
 This array can then be used to extract information about the
 schematics,
 or it can be altered to apply specific changes to the schematics.
 The array can then be written back to the schematic files.
 One could even build such array of hashes data structure without
 reading
 any input schematic file to programmatically generate new
 schematic files.


 LIMITATIONS
 [see README file]

 Does not handle the new path objects, see 
 http://geda.seul.org/wiki/geda:file_format_spec
 , and does not check for the validity of the file format version
 either, sorry. I will fix this.

 You can't search for it on http://search.cpan.org yet, but you can
 browse to it, or use the link http://search.cpan.org/dist/Parse-GEDA-Gschem/

 You need perl 5.10.0 or higher.

 You need http://search.cpan.org/~dconway/Parse-RecDescent-1.96.0/, or
 higher, which you can only get by downloading it. Using the usual
 cpan install Parse::RecDescent will only get you version 1.94, which
 has known bugs.

 Tested on ubuntu-8.10-desktop-amd64, on VMWare Fusion 2.0.

 Please try it out, see the demo in the demo/ directory, and let me
 know of any issues.

 Stay tuned for more to come about an enhanced version of demo/
 demo_geda-usch.pl and design workflow.

 Enjoy! And please be gentle, I am no SW programmer...

 _jP

 On Apr 21, 2008, at 1:31 PM, Peter Clifton wrote:

 On Mon, 2008-04-21 at 13:03 +0200, fricker wrote:
 On 21 avr. 08, at 11:39, Peter Clifton wrote:
 On 21 avr. 08, at 10:22, fricker wrote:

 What I need to achieve all of this is a Perl module that offers:
 - readFiles([EMAIL PROTECTED]) that returns a reference to an array of  
 hashes
 (file names are pushed into the data structure)
 - writeFiles([EMAIL PROTECTED]) that writes the data structure back into 
 the
 files (file names are within the data structure already)

 I could package what I have and share it if anyone is interested.

 I think a lot of people would appreciate that, I'd certainly be
 interested.

 Hum, what would be the best way to distribute (and maintain) such
 thing then?
 1) make it part of the gEDA distribution
 2) keep it independent and post it on CPAN, as Parser::gschem by
 example
 3) ?

 My guess is that 2) is probably more effective, any other opinion?
 Please speak-up.

 Its been a long time since I coded with Perl (aside from modifying
 refdes_renum), so am not really up-to-date with how modules are
 distributed. Is it a single .pm file, or a more complex archive?

 Many contributors sign up for an account on http://
 www.gedasymbols.org/
 and post their scripts, footprints, symbols there.

 Best wishes,

 Peter C.




 ___
 geda-user mailing list
 geda-user@moria.seul.org
 http://www.seul.org/cgi-bin/mailman/listinfo/geda-user



 ___
 geda-user mailing list
 geda-user@moria.seul.org
 http://www.seul.org/cgi-bin/mailman/listinfo/geda-user



___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


Re: gEDA-user: Parsing and writing schematics with Perl

2008-11-08 Thread fricker
BTW: the demo_geda-usch.pl included in Parse::GEDA::Gschem allows you  
to update net cross page references attributes.

_jP

$./demo_geda-usch.pl -H
Usage: ./demo_geda-usch.pl [-hH] schematicFile1 schematicFile2 ...

   -hHelp; this message
   -HExtended help
   -v...vVerbosity level.
   -update_xref  Update xref attributes
   -no_bak   Do not create backup before processing files

This program provides a command line interface to handling gEDA  
schematics.
It uses Parse::GEDA::Gschem.pm module to parse and write back  
schematics.
The first thing is does is to create a backup into a directory of the  
form:
./bak/year-month-day_hour-minute-second/

-update_xref
Update xref attributes on net names to show on which page the
same netname is being used. Three or more consecutive pages are
aggregated as first-last. If the xref does not exist on a
net that appears on multiple pages then it is added and its
text properties are copied from the netname attribute with the
text origin mirrored horrizontally.



___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


Re: gEDA-user: Parsing and writing schematics with Perl

2008-11-07 Thread fricker
http://search.cpan.org/dist/Parse-GEDA-Gschem/

Parse::GEDA::Gschem version 1.00

NAME

 Parse::GEDA::Gschem - gEDA/gaf gschem schematic file parser


DESCRIPTION

 Collection of routines used to parse and write back schematic  
files of the
 format specified by gEDA gschem schematic capture tool as  
detailed at:
 http://www.geda.seul.org/wiki/geda:file_format_spec


REQUIREMENTS:
 perl 5.10


EXAMPLE:
 my @schFiles = (); # array of schematic file path/names
 my @files = ();# array of schematic objects
 bakSchFiles([EMAIL PROTECTED]); # backup schematic files in bak/year-m- 
d_h-m-s/
 $files = @{readSchFiles([EMAIL PROTECTED])}; # parses the schematic files
 writeMsg(1, Dumper([EMAIL PROTECTED])); # prints out the entire data  
structure
 writeSchFiles([EMAIL PROTECTED]); # write the data structure into 
schematic  
files

 Parse::gaf::gschem is a collection of routines used to parse  
a .sch file
 into a convenient perl array of hashes data structure in memory.
 This array can then be used to extract information about the  
schematics,
 or it can be altered to apply specific changes to the schematics.
 The array can then be written back to the schematic files.
 One could even build such array of hashes data structure without  
reading
 any input schematic file to programmatically generate new  
schematic files.


LIMITATIONS
 [see README file]

Does not handle the new path objects, see 
http://geda.seul.org/wiki/geda:file_format_spec 
, and does not check for the validity of the file format version  
either, sorry. I will fix this.

You can't search for it on http://search.cpan.org yet, but you can  
browse to it, or use the link http://search.cpan.org/dist/Parse-GEDA-Gschem/

You need perl 5.10.0 or higher.

You need http://search.cpan.org/~dconway/Parse-RecDescent-1.96.0/, or  
higher, which you can only get by downloading it. Using the usual  
cpan install Parse::RecDescent will only get you version 1.94, which  
has known bugs.

Tested on ubuntu-8.10-desktop-amd64, on VMWare Fusion 2.0.

Please try it out, see the demo in the demo/ directory, and let me  
know of any issues.

Stay tuned for more to come about an enhanced version of demo/ 
demo_geda-usch.pl and design workflow.

Enjoy! And please be gentle, I am no SW programmer...

_jP

On Apr 21, 2008, at 1:31 PM, Peter Clifton wrote:

 On Mon, 2008-04-21 at 13:03 +0200, fricker wrote:
 On 21 avr. 08, at 11:39, Peter Clifton wrote:
 On 21 avr. 08, at 10:22, fricker wrote:

 What I need to achieve all of this is a Perl module that offers:
 - readFiles([EMAIL PROTECTED]) that returns a reference to an array of 
 hashes
 (file names are pushed into the data structure)
 - writeFiles([EMAIL PROTECTED]) that writes the data structure back into 
 the
 files (file names are within the data structure already)

 I could package what I have and share it if anyone is interested.

 I think a lot of people would appreciate that, I'd certainly be
 interested.

 Hum, what would be the best way to distribute (and maintain) such
 thing then?
 1) make it part of the gEDA distribution
 2) keep it independent and post it on CPAN, as Parser::gschem by  
 example
 3) ?

 My guess is that 2) is probably more effective, any other opinion?
 Please speak-up.

 Its been a long time since I coded with Perl (aside from modifying
 refdes_renum), so am not really up-to-date with how modules are
 distributed. Is it a single .pm file, or a more complex archive?

 Many contributors sign up for an account on http:// 
 www.gedasymbols.org/
 and post their scripts, footprints, symbols there.

 Best wishes,

 Peter C.




 ___
 geda-user mailing list
 geda-user@moria.seul.org
 http://www.seul.org/cgi-bin/mailman/listinfo/geda-user



___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


gEDA-user: Symbol attributes not in the master attributes list

2008-11-06 Thread fricker
I'd like to better understand what should or shouldn't be done with  
symbol attributes.

I can see on http://geda.seul.org/wiki/geda:master_attributes_list  
which attributes are available for a resistor symbol by example:
device, graphical, description, author, comment, pinseq, pinnumber,  
pintype, pinlabel, numslots, slotdef, footprint, documentation,  
refdes, slot, net, value, symversion, dist-license, use-license

To automate some aspects of the BOM generation, I would like to have  
the following attributes on a instantiated resistor symbol:

refdes=R1
value=100
tol=1%
rating=.0625W
tech=CHIP
footprint=0402
device=104-1-01
bom=1,2

refdes, value and footprint are pretty clear to me.

tol=1% is used to specify the tolerance of the component.
rating=.0625W is used to specify its rating.
tech=CHIP is used to specify its technology, could be XR7 for a cap by  
example.
bom=1,2 is used to specify which assembly build of material options  
this components will be associated with, like BOM=0 means the  
components is not assembled, etc.
device=part-number is used to specify the actual part number to be  
assembled on the board.

While tol, rating, tech and bom are attributes that are not listed in 
http://geda.seul.org/wiki/geda:master_attributes_list 
  I am wondering if I should/can use them as such or if I would have  
to embed them in comment=tol=1%. I don't want to use comment= because  
it does not allow me to hide the tol= part of the tol=1% on the  
instantiated symbol in the schematics.

What are the implications of using attributes that are not defined in  
the master attribute list?

The device=104-1-01 attribute, where 104-1-01 is an arbitrary  
database index that uniquely identifies the device, should be a valid  
usage, right? What are the implications of doing so when using pcb or  
other gEDA/gaf tools?

Thanks,
_jP



___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


Re: gEDA-user: Parsing and writing schematics with Perl

2008-04-21 Thread fricker

On 21 avr. 08, at 02:53, Peter Clifton wrote:

 On Mon, 2008-04-21 at 00:05 +0200, fricker wrote:
 Hi all,

 Is there a Perl interface to gschem I could use to:
 - parse a given set of schematic (or symbol) pages and get a data
 structure of the full (flat) design
 - write back schematic (or symbol) pages given the same and modified
 data structure (and do a backup first)

 I already have something working that uses Parse::RecDescent (see
 http://search.cpan.org/~dconway/Parse-RecDescent-v1.95.1/, I wrote
 the grammar specification as an exercise based on http://
 geda.seul.org/wiki/geda:file_format_spec), but I know it might be
 just Yet Another Gschem Parser... and was wondering if there was some
 *simple user-level* API to libgeda I should be using instead (and  
 how?).

 No, libgeda isn't ready to define any external and gauranteed API, it
 changes every release.

 Also, due to some technical problems with Guile (the scripting  
 language
 it uses internally), we can't (in general) write language bindings for
 it, even if we could make any API guarantee.

 I started writing YANGP for Python, but realised it was going to be
 tricky. My end approach was to write a C utility program which can  
 work
 with libgeda, then communicate with that program.

 gschem's file format is quite simple and easy to parse, it may have  
 been
 quicker to implement the parser, but that's not really the kind of
 coding I enjoy.

Reading you it seems to me that the gschem file format changes less  
often than a potential API in libgeda. I should therefore keep such  
parser/writer completely independent from libgeda and base it only on  
the file format. I.e. I went down the right path so far... Thanks!

BTW: Parse:RecDescent provides the extra benefit of error handling,  
it flags quite nicely if the file has errors and where, in a top-down  
fashion. I didn't write any parsing code, just its grammar.


 Below is an example of such data structure output using Data::Dumper

 Thanks,
 _jP

 data = [
   {

 ...

 [snip example]

 This kindof feels like a DOM tree in HTML / XML. If its a convenient
 format for you to process, it looks quite neat.

It's just the way Data:Dumper outputs an internal data structure of  
arrays [] of hashes {} containing string elements and other arrays,  
containing hashes, etc. I can just access things like this then to  
change the sheet number on every sheet of a design:

$data[$file_idx]-{objects}-[$object_idx]-{Attributes}-[$attr_idx]- 
 {value} = $sheets++;

 What sort of processing are you needing to automate in this way?

Here is a short list:
- update/create sheet to sheet net cross references (with ~200  
sheets, this is a must have!)

- update current sheet number and total sheet numbers

- replicate similar subsections of schematics (a given schematic page  
used multiple times where you need to update refdes and netnames).  
Some might want to use hierarchical designs instead, but I stay away  
from such approach for board design!

- update component attributes based on an Approved Device  
List (output from a PLM database), i.e. add/update device=part  
number on passives based on value, tolerance and ratings attributes  
and verify the other active components

- design-wide component updates (with correct handling of attributes  
and symbol version changes)

- design-wide cleanup and checks (text size, alignment, location, not  
connected nets, etc., mostly to enforce drawing guidelines)

- generate multiple versions of a given root schematic based on a  
configuration file: simulation vs. prototype vs. production bom  
alternatives, each one having its own set of pdf, etc. I use a  
bom=1,2,... attribute to tag such alternatives in the root design,  
then change it to bom=NOSTUFF in the specific versions, this way the  
folks debugging the board don't have to look-up the bom options in a  
table. I then generate actual boms using gnetlist out of these  
derived schematic files. I also replace the CVS tags such that they  
look neat when printed.

- generate tagged pdf, with sheet to sheet net links and attributes  
pop-ups.

And all of this has to be controllable through Makefiles, this way  
the generation process is inherently documented for your coworkers or  
newbies.

I used to use Makefiles and sed s/.../.../ a lot but file-wide regex  
are dangerous since it isn't so easy to control what the s/.../.../  
is really going to change.

And I would not want this to be integrated in the gschem gui! gschem  
is - and IMHO should remain - just a drawing tool. It is far more  
powerful and convenient to control the above with perl scripts and  
Makefiles, including and especially bom handling stuff.

What I need to achieve all of this is a Perl module that offers:
- readFiles([EMAIL PROTECTED]) that returns a reference to an array of hashes  
(file names are pushed into the data structure)
- writeFiles([EMAIL PROTECTED]) that writes the data structure back into the  
files

Re: gEDA-user: Parsing and writing schematics with Perl

2008-04-21 Thread fricker

 On 21 avr. 08, at 11:39, Peter Clifton wrote:
 On 21 avr. 08, at 10:22, fricker wrote:

 What I need to achieve all of this is a Perl module that offers:
 - readFiles([EMAIL PROTECTED]) that returns a reference to an array of hashes
 (file names are pushed into the data structure)
 - writeFiles([EMAIL PROTECTED]) that writes the data structure back into the
 files (file names are within the data structure already)

 I could package what I have and share it if anyone is interested.

 I think a lot of people would appreciate that, I'd certainly be
 interested.

Hum, what would be the best way to distribute (and maintain) such  
thing then?
1) make it part of the gEDA distribution
2) keep it independent and post it on CPAN, as Parser::gschem by example
3) ?

My guess is that 2) is probably more effective, any other opinion?  
Please speak-up.

_jP


___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


gEDA-user: Re: gEDA: inter page connectors

2007-02-14 Thread fricker
Regarding the old thread (Mon, 05 Aug 2002) about inter page  
connectors (http://www.geda.seul.org/mailinglist/geda-dev54/ 
msg00053.html), I wrote a perl script which updates cross reference  
attributes. See quick help below. Anyone interested in giving it a try?

_jP

 ./geda-xref -h
Usage: ./geda-xref [OPTIONS] designName
  -hHelp; this message

Parses all schematic files and looks for net segments with an
attribute 'netname=', and:
- if no 'xref=' attribute is associated with the same net segment
  then add such attribute to the net segment
- if a 'xref=' attribute is associated with the same net segment
  then fix its size, orientation, justification, color and location
  such that its value is visible next to the end of the net segment
  that is closer to the origin of the 'netname' attribute.
  This works best when the 'netname' attribute is placed with its
  origin near the end of the dangling net.
- update the value of the 'xref=' attribute to show on which page
  the same 'netname' is being used:
  - If no other reference to this net is found anywhere in the design
then the attribute is removed.
  - References to the same page are included.
  - Multiple instances on a given page are shown as a single page
  - Multiple pages are separated by a comma: firstPage,secondPage,...
  - Consecutive pages are shortened: firstPage-lastPage
Assumes the following naming convention for schematic pages:
  designName_#.sch   where # is the page number.
Makes a backup copy of each schematic page to:
  bak/time stamp/designName_#.sch



___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


gEDA-user: Support for heterogeneous symbols?

2007-02-08 Thread fricker

Hi All,

I am evaluating gEDA and came across one feature I am extensively  
using today with a commercial EDA tool when dealing with large  
components, like SOC, FPGAs and ASICs: heterogeneous symbols.


I searched the doc, the mailing lists and the Web but could not find  
how I could create and use such symbols with gschem and gnetlist.


As Roger Williams defines it in his post: http://www.geda.seul.org/ 
mailinglist/geda-dev6/msg3.html


 Heterogeneous devices are non-identical symbols that represent
 different parts of the same device for REFDES and layout purposes.
 They can be tied together by the same 'HETERO=DEVICE1,DEVICE2...'
 attribute on each device.  Typical examples include:

   - large complex logic devices split between multiple symbols
 because of space constraints;

   - multi-function devices split so that each different functional
 block has its own symbol (relays, for instance);

Does gschem support such a way to deal with large devices?
If the answer is yes, then how?
If the answer is no, then how are people dealing with it?

Thanks,
_jP


___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


gEDA-user: Re: gEDA: inter page connectors

2007-02-08 Thread fricker
I googled the mailing lists to find a way to automatically number the  
inter page connections, i.e. to have the PAGES=? attribute on the  
page connector symbol being updated post schematic capture.


This is a purely visual cross-checking feature I am looking for.

Thanks,
_jP


___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


gEDA-user: Re: gEDA: inter page connectors

2007-02-08 Thread fricker

Hi All,

What I meant to ask was: is there a tool (like grenum for refdes=)  
that can be used to update the page= attribute of the inter page  
connectors?


Thanks,
_jP


___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user