X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f X-Recipient: geda-user AT delorie DOT com X-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=YPz0BGc1fuav+ClH2GjsRhXCLfGEWVcJlndibyp0aY8=; b=Zseh61gmq5XbJOjrf0MFpfOwWRVS0FHfYgWym8o7mNNowYq4JB6IwGADj9Bh685er+ Lw8zU308o4OzCx0VnLesJdFSaV/0hyQUXUg41djpk2s6WUSvzF+GDtOW/gZ7m++WOisS MnEbvU+W51wJ7A3mNsgWA+kA8A4T6pEgIzBQwsCzckVyHKrCw44ABzBzi8KqNO3OH8Mw 76DGP0MBnaP3tCjz+Orvm/E/ra1lcdXaohCbiCJjYd8vhFUPNFrx4P5n3a/7zrX+e9LW GlHdO8pb0AlKZ7th7M3W+fGIfnbEDWjqEriczEdNErLnoNIjtp+D6lp7J9meJbo/EgPB dEBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=YPz0BGc1fuav+ClH2GjsRhXCLfGEWVcJlndibyp0aY8=; b=VqSTNDS+0j1pV+FF/N3x8t7KoA3VNlsp7yMcn4TkZ/YkwdpNU/cPzcqBYchMboeHcb PDe2gIjWxlpcqeDaoazdjFGm10fLMeDg5j5HNledoy5z3gbb6ZSB5abMHNHd4vsJXoaP aZFv8uh76os3P+o4fVOgUQd67ps1wLIJ2okPFWRHNDAaYWmQaQh+w6qHqGhF/l7Ct2f5 hC4Rr+3DodoxS6t0S56usJhHkKavy4tXMbqSt03UzWAGjTIBsn/p6xCaQPk//wmJUXAK WfaLq/crF0d9EqDc+koNGNUocUpc9M3AaEkxdJ/IDFtk0Wwx3qZxTgssZiTOh+NBDB/5 pbrQ== X-Gm-Message-State: AOAM533vyuuNIs2QJVejyYDhwyQ4r56qRLgMDDtVcN9yMjLvos44ZBgo G+hDLPTg9wak43A3U3J1vqGkXzkv1Pzdz9fKfiduJ3ujf9M= X-Google-Smtp-Source: ABdhPJxItvEnM7xwiWVv7aFcORovR3+/QNa7hBGmIaYtpP4ZYBCMxZZoynnjEDnjyxQuq/Mk9kmbnbvDUW6JGMK5DRM= X-Received: by 2002:a25:d3cf:: with SMTP id e198mr13446940ybf.292.1607193314475; Sat, 05 Dec 2020 10:35:14 -0800 (PST) MIME-Version: 1.0 References: <20201205090422 DOT GB1617 AT newvzh DOT lokolhoz> In-Reply-To: <20201205090422.GB1617@newvzh.lokolhoz> From: "Britton Kerin (britton DOT kerin AT gmail DOT com) [via geda-user AT delorie DOT com]" Date: Sat, 5 Dec 2020 09:35:03 -0900 Message-ID: Subject: Re: [geda-user] automatically create a .sch file containing a single component? To: geda-user AT delorie DOT com Content-Type: text/plain; charset="UTF-8" Reply-To: geda-user AT delorie DOT com On Sat, Dec 5, 2020 at 12:42 AM Vladimir Zhbanov (vzhbanov AT gmail DOT com) [via geda-user AT delorie DOT com] wrote: > > Hi Britton, > > On Thu, Dec 03, 2020 at 11:12:41AM -0900, Britton Kerin (britton DOT kerin AT gmail DOT com) [via geda-user AT delorie DOT com] wrote: > > Another small thing I'd like to automate is my setup for validating > > footprints of symbols. I use heavy symbols with footprints associated > > with each part. To check a symbol I first create a .sym and .fpt, > > then create a file checkfpt.sch which contains just the .sym, then use > > gsh2pcb to create a pcb file containing the symbol, and launch pcb to > > take a look at it. > > > > The part that's pointlessly interactive is the creation of the .sch > > file. I have to have gschem launched and manually add the symbol. > > > > I'd like to do one of these instead: > > > > * create an sch containing just the sch using some batch mode op > > > > * just create the sch by script. but I don't get why some text > > elements (refdes=, device=) end up > > repeated in the .sch file and other stay in the element. what > > distinguishes these elements? > > > > * create the pcb file directly. sort of a hassle but probably what > > I'll do unless there's a better way, > > a little weird in my case since I have a lot of footprints using a > > text library of my own > > > > * view the footprint file in a way that shows the refdes. I know it > > possible to view footprints directly > > with pcb, the only problem with this is it doesn't show the refdes. > > Is there some way to make it > > do so? > > > > Britton > > I'm not sure if I understood anything correctly. Still I propose > my solution of the problem you mentioned as I understood it. > > The following Scheme script creates a schematic from one symbol: > > =======================================8<======================================= > (use-modules (lepton page) > (lepton object) > (srfi srfi-1)) > > ;;; First argument in program arguments is the name of the script > ;;; itself. > (define file-name (second (program-arguments))) > (define symbol-name (third (program-arguments))) > > (define (save-page page) > (display (page->string page))) > > (let ((page (make-page file-name))) > (page-append! page (make-component/library symbol-name '(0 . 0) 0 #f #f)) > (with-output-to-file file-name (lambda () (save-page page)))) > =======================================>8======================================= > > Its usage is simple: > lepton-cli shell -s ./schematic-from-symbol.scm /tmp/schematic.sch resistor-1.sym > > A call for lepton-schpcb could be added in the script as well > using '(system "lepton-sch2pcb" arg1 arg2 ...)', though I omit > this as not very significant here. Another way would be to use > some sh scripting for that. > > If you still use geda-gaf the above script should be changed a bit > (I suspect nothing changed in Scheme code there since 1.9.2), just > use '(geda object)' instead of '(lepton object)', etc, the 'gaf' > command instead of 'lepton-cli', and 'gsch2pcb' instead of > 'lepton-sch2pcb'. Thanks. This is probably much more correct and general than my hastilyassembled solution and I've added a pointer back to it so I can try it when mine breaks :) Britton