[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: PCAD to GEDA (GSCHEM)



I was doing some digging today, and look what I found:

http://www.cedcc.psu.edu/cadtools/pcaddoc/pdif.pdf

Documentation on the format of the PDIF output from PCAD.  Hope it is  
helpful.

See also:  http://www.cedcc.psu.edu/cadtools/interfaces.html

-Steve


On Nov 28, 2007, at 6:43 PM, Steve Meier wrote:

> Just to show off what I have been working. The two attached files
> include a script for reading in a schematic file. The second is my
> attempt to document the api that either exists or that I have been
> implementing. Comments, suggestions are always welcome. If we can  
> figure
> out the pcad file formats I would be happy to modify or tweek the api
> for the sake of translating the pcad files.
>
> Depending on interest I can do a code release either (as i had  
> planned)
> after I have the vhdl, spice, verilog netlist formats, or earlier  
> (after
> i complete the basic schematic, symbol file io migration to guile)  
> and a
> trivial translation application.
>
> Steve Meier
>
>
>
> Dan McMahill wrote:
>> Steven Ball wrote:
>>
>>> The PDIF writer seems to be able to convert anything to an ASCII  
>>> output.
>>>
>>> http://snurkle.net/~hamster/geda/
>>>
>>
>> By any chance does the documentation for PCAD have details on that
>> format?  If not, it looks like it could largely be figured out.
>>
>>
>>> I'll dig around and see if I can find a .pcb file to convert and  
>>> post
>>> as well.  Let me know what you think and how I can be of help.
>>>
>>
>> just to clarify, pcad uses .pcb too as the suffix.  The format you'll
>> get there is similar in style to the schematics.
>>
>>
>>
>>
>> _______________________________________________
>> geda-user mailing list
>> geda-user@xxxxxxxxxxxxxx
>> http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
>>
>>
>
> ;;; AKEDA - Alaskan Electronic Design Automation
> ;;; aknetlist - GNU Netlist
> ;;; Copyright (C) 2007 Stephen F Meier
> ;;;
> ;;; This program is free software; you can redistribute it and/or  
> modify
> ;;; it under the terms of the GNU General Public License as  
> published by
> ;;; the Free Software Foundation; either version 2 of the License, or
> ;;; (at your option) any later version.
> ;;;
> ;;; This program is distributed in the hope that it will be useful,
> ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
> ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> ;;; GNU General Public License for more details.
> ;;;
> ;;; You should have received a copy of the GNU General Public License
> ;;; along with this program; if not, write to the Free Software
> ;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
>
> ;; Inport an AKEDA style schematic as a page in libakeda
>
> (use-modules (srfi srfi-13))
> (use-modules (ice-9 popen))
> (use-modules (ice-9 rdelim))
>
>
> (define OBJ_LINE        "L" );
> (define OBJ_BOX         "B" );
> (define OBJ_PICTURE     "G" );
> (define OBJ_CIRCLE      "V" );
> (define OBJ_NET_SEGMENT "N" );
> (define OBJ_BUS_SEGMENT "U" );
> (define OBJ_COMPLEX     "C" );
> (define OBJ_TEXT        "T" );
> (define OBJ_PIN         "P" );
> (define OBJ_ARC         "A" );
> (define OBJ_ROUTE       "R" );
> (define OBJ_THRU_HOLE   "H" );
> (define OBJ_BUSRIPPER   "S" );
> (define OBJ_EMPTY       "0" );
> (define OBJ_VERSION     "v" );
> (define OBJ_PLACEHOLDER "X" );
>
> (define STARTATTACH_ATTR	"{" );	
> (define ENDATTACH_ATTR		"}" );	
> (define START_EMBEDDED		"[" );	
> (define END_EMBEDDED		"]" );	
>
> (define (akeda-sch-read sch-filename tl_bool)
>  (let ((port (open-input-file sch-filename)))
>    (define my_page (ak-toplevel-new-page sch-filename tl_bool))
>    (define buffer "")
>    (define buf_str "")
>    (define my_line "")
>    (define new_obj_smob "")
>    (define attach_obj_smob "")
>    (define embed_obj_smob "")
>
>    (define str_list "")
>    (define my_string "")
>    (define index 0)
>    (define num_lines 0)
>
>    (define selected "0")
>    (define visible "0")
>    (define locked "0")
>
>    (define schematic_attrib_type "1")
>    (define symbol_attrib_type "0")
>
>    (define state_attach #f)
>    (define state_embed #f)
>    (define state_text #f)
>
>    (define x2 0)
>    (define y2 0)
>
>    (while (not (eof-object? buf_str))
> 	   (set! buffer (%read-line port))
> 	
> 	   (set! buf_str (car buffer))
> 	
> 	   (if (not (eof-object? buf_str))
> 	       (begin
> 		 (set! my_line (string-split buf_str #\space))
> 		
> 		 (if (string=? (list-ref my_line 0) STARTATTACH_ATTR)
> 		     (begin
> 		       (set! state_attach #t)
> 		       (set! attach_obj_smob new_obj_smob)
> 		       )
> 		     )
> 		
> 		 (if (string=? (list-ref my_line 0) ENDATTACH_ATTR)
> 		     (begin
> 		       (set! state_attach #f)
> 		       )
> 		     )
> 		
> 		 (if (string=? (list-ref my_line 0) START_EMBEDDED)
> 		     (begin
> 		       (set! state_embed #t)
> 		       (set! embed_obj_smob new_obj_smob)
> 		       )
> 		     )
> 		
> 		 (if (string=? (list-ref my_line 0) END_EMBEDDED)
> 		     (begin
> 		       (set! state_embed #f)
> 		       )
> 		     )
> 		
> 		 (if (string=? (list-ref my_line 0) OBJ_TEXT)
> 		     (begin
>
> 		       (set! new_obj_smob (ak-object-new OBJ_TEXT selected visible  
> locked))
> 		
> 		       (ak-text-new new_obj_smob (list-ref my_line 1) (list-ref  
> my_line 2) (list-ref my_line 4) (list-ref my_line 8)
> 				    (list-ref my_line 7) (list-ref my_line 9) (list-ref my_line  
> 5) (list-ref my_line 6) (list-ref my_line 3))
> 		
> 		       (set! index 0)
> 		
> 		       (set! num_lines (list-ref my_line 9))
>
> 		       (set! num_lines (string->number (list-ref my_line 9)))
> 		
> 		       (set! str_list (make-list num_lines))
>
> 		       (while (< index num_lines)
> 			      (begin
> 				(set! my_string (car (%read-line port)))
> 				(display my_string)
> 				(display "\n")
> 				(list-set! str_list index my_string)
> 				(set! index (+ index 1))
> 				)
> 			      )
> 		
> 		       (set! my_string (string-join str_list " "))
> 		
> 		       (ak-text-set-string new_obj_smob my_string)
> 		
> 		       (if state_attach
> 			   (begin
> 			     (ak-object-attrib-new attach_obj_smob new_obj_smob  
> schematic_attrib_type)
> 			     )
> 			   (begin
> 			     (if state_embed
> 				 (begin
> 				   (ak-complex-attach-object embed_obj_smob new_obj_smob)
> 				   (ak-object-attrib-new embed_obj_smob new_obj_smob  
> symbol_attrib_type)
> 				   )
> 				 (begin
> 				   (ak-page-attach-object my_page new_obj_smob)
> 				   )
> 				 )
> 			     )
> 			   )
> 		       )
> 		     )
> 		
> 		 (if (string=? (list-ref my_line 0) OBJ_BUS_SEGMENT)
> 		     (begin
> 		       (set! new_obj_smob (ak-object-new OBJ_BUS_SEGMENT selected  
> visible locked))
> 		       (ak-segment-new new_obj_smob (list-ref my_line 1) (list-ref  
> my_line 2) (list-ref my_line 3) (list-ref my_line 4)  "1")
> 		       (ak-page-attach-object my_page new_obj_smob)
> 		       )
> 		     )
> 		
> 		 (if (string=? (list-ref my_line 0) OBJ_COMPLEX)
> 		     (begin
> 		       (set! new_obj_smob (ak-object-new OBJ_COMPLEX selected  
> visible locked))
> 		       (ak-complex-new new_obj_smob (list-ref my_line 1) (list-ref  
> my_line 2) "0" "0" "0" (list-ref my_line 6))
> 		       (ak-page-attach-object my_page new_obj_smob)
> 		       )
> 		     )
> 		
> 		 (if (string=? (list-ref my_line 0) OBJ_NET_SEGMENT)
> 		     (begin
> 		       (set! new_obj_smob (ak-object-new OBJ_NET_SEGMENT selected  
> visible locked))
> 		       (ak-segment-new new_obj_smob (list-ref my_line 1) (list-ref  
> my_line 2) (list-ref my_line 3) (list-ref my_line 4)  "0")
> 		       (ak-page-attach-object my_page new_obj_smob)
> 		       )
> 		     )
> 		
> 		 (if (string=? (list-ref my_line 0) OBJ_ARC)
> 		     (begin
> 		       (set! new_obj_smob (ak-object-new OBJ_ARC selected visible  
> locked))
> 		       (ak-arc-new new_obj_smob (list-ref my_line 1) (list-ref  
> my_line 2) (list-ref my_line 1) (list-ref my_line 2)
> 				   (list-ref my_line 1) (list-ref my_line 2) (list-ref my_line 1))
> 		
> 		       (if state_embed
> 			   (begin
> 			     (ak-complex-attach-object embed_obj_smob new_obj_smob)
> 			     )
> 			   (begin
> 			     (ak-page-attach-object my_page new_obj_smob)
> 			     )
> 			   )
> 		       )
> 		     )
> 		
> 		 (if (string=? (list-ref my_line 0) OBJ_BOX)
> 		     (begin
> 		       (set! new_obj_smob (ak-object-new OBJ_BOX selected visible  
> locked))
> 		
> 		       (set! x2 (+ (string->number (list-ref my_line 1)) (string- 
> >number (list-ref my_line 3))))
> 		
> 		       (set! y2 (+ (string->number (list-ref my_line 2)) (string- 
> >number (list-ref my_line 4))))
> 		
> 		       (ak-box-new new_obj_smob (list-ref my_line 1) (list-ref  
> my_line 2) (number->string x2) (number->string y2)
> 				   (list-ref my_line 5) (list-ref my_line 8) (list-ref my_line 6))
> 		
> 		       (if state_embed
> 			   (begin
> 			     (ak-complex-attach-object embed_obj_smob new_obj_smob)
> 			     )
> 			   (begin
> 			     (ak-page-attach-object my_page new_obj_smob)
> 			     )
> 			   )
> 		       )
> 		     )
> 		
> 		 (if (string=? (list-ref my_line 0) OBJ_CIRCLE)
> 		     (begin
> 		       (set! new_obj_smob (ak-object-new OBJ_CIRCLE selected  
> visible locked))
> 		
> 		       (if state_embed
> 			   (begin
> 			     (ak-complex-attach-object embed_obj_smob new_obj_smob)
> 			     )
> 			   (begin
> 			     (ak-page-attach-object my_page new_obj_smob)
> 			     )
> 			   )
> 		       )
> 		     )
> 		
> 		 (if (string=? (list-ref my_line 0) OBJ_LINE)
> 		     (begin
> 		       (set! new_obj_smob (ak-object-new OBJ_LINE selected visible  
> locked))
> 		       (ak-line-new new_obj_smob (list-ref my_line 5) (list-ref  
> my_line 8)
> 				    (list-ref my_line 1) (list-ref my_line 2) (list-ref my_line 3)
> 				    (list-ref my_line 4) (list-ref my_line 7))
> 		
> 		       (if state_embed
> 			   (begin
> 			     (ak-complex-attach-object embed_obj_smob new_obj_smob)
> 			     )
> 			   (begin
> 			     (ak-page-attach-object my_page new_obj_smob)
> 			     )
> 			   )
> 		       )
> 		     )
> 		
> 		 (if (string=? (list-ref my_line 0) OBJ_PICTURE)
> 		     (begin
> 		       (set! new_obj_smob (ak-object-new OBJ_PICTURE selected  
> visible locked))
> 		
> 		       (if state_embed
> 			   (begin
> 			     (ak-complex-attach-object embed_obj_smob new_obj_smob)
> 			     )
> 			   (begin
> 			     (ak-page-attach-object my_page new_obj_smob)
> 			     )
> 			   )
> 		       )
> 		     )
> 		
> 		 (if (string=? (list-ref my_line 0) OBJ_PIN)
> 		     (begin
> 		       (set! new_obj_smob (ak-object-new OBJ_PIN selected visible  
> locked))
> 		
> 		       (if state_embed
> 			   (begin
> 			     (ak-complex-attach-object embed_obj_smob new_obj_smob)
> 			     )
> 			   (begin
> 			     (ak-page-attach-object my_page new_obj_smob)
> 			     )
> 			   )
> 		       )
> 		     )
> 		
> 		
> 		 )
> 	       )
> 	   )
>
>      (close-input-port port)
>      )
>  )
> <guile_interface_rev0.02.odt>
>
> _______________________________________________
> geda-user mailing list
> geda-user@xxxxxxxxxxxxxx
> http://www.seul.org/cgi-bin/mailman/listinfo/geda-user



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