delorie.com/archives/browse.cgi   search  
Mail Archives: geda-help/2014/03/27/15:48:40

X-Authentication-Warning: delorie.com: mail set sender to geda-help-bounces using -f
X-Recipient: geda-help AT delorie DOT com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=date:from:to:subject:message-id:mail-followup-to:references
:mime-version:content-type:content-disposition:in-reply-to
:user-agent;
bh=2yS/WaQGOgPblXCXr/m0XUqwlvYkO/w40pJZRciy8Zs=;
b=gdTACzaVnWU2PnimGtDAskvHYAnjZGgxmvbkjQE4k1mZFp3ePW5bKpLffql+1H8dvw
HCX0ijsxDtmVSHwrB0QzAe01y/gFjLJhtl6Pd9Uc07z0wYfQIlFCCGRquzAR/dZyLr+l
OUFCAefCOiVnZfhwuwoSG2Y/SryOuPgZJrsNz+QLmchYDwzdE8QJyCo7vCH/LEnvQ6b+
BeHwdVncG9GfMZTd39/M1yx9xx2/bdst/RH2apO0VbJZs+YoaYmaYXdX9e2n6Jy2Vcim
m2RpQOoc/opeyEznM9tAQROItS79343sMEnAAGcXOd3jIbQimMJQG6SICd4MOtTFDuQF
cMsA==
X-Received: by 10.112.39.97 with SMTP id o1mr2045509lbk.38.1395949686992;
Thu, 27 Mar 2014 12:48:06 -0700 (PDT)
Date: Thu, 27 Mar 2014 23:48:03 +0400
From: Vladimir Zhbanov <vzhbanov AT gmail DOT com>
To: geda-help AT delorie DOT com
Subject: Re: [geda-help] how2 change pinlabel of a symbol in a schematic
Message-ID: <20140327194803.GB24939@localhost.localdomain>
Mail-Followup-To: geda-help AT delorie DOT com
References: <1395860707 DOT 4192 DOT 9 DOT camel AT micky>
MIME-Version: 1.0
In-Reply-To: <1395860707.4192.9.camel@micky>
User-Agent: Mutt/1.5.21 (2010-09-15)
Reply-To: geda-help AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: geda-help AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

--YiEDa0DAkWCtVeE4
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline

On Wed, Mar 26, 2014 at 08:05:07PM +0100, Kurt Burger wrote:
>    Dear community,
>    I designed a 8-pin 1 row connector as a symbol in gschem. I defined the
>    pinlabels from 1-8.
>    After putting this connector (symbol) into my new schematic I want to
>    change some pinlabels, eg pinlabel pin 1 change pinlabel from "1" to
>    "12V".
>    I've no glue how to do it. I do now want to change the original symbol.
>    I spent already hours in searching but without result.
>    Any ideas are very welcome.
>    Kurt

You can use attached Scheme script. It should work for unstable
and, I hope, stable versions of gschem. See comments on how to use
it in the file itself.

--YiEDa0DAkWCtVeE4
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment; filename="rename.scm"

; This script contains a procedure to change pin attributes of a
; component.
;
; Usage:
;   (change-attrib-value "attrib-name" "old-value" "new-value")
;
; Details:
;   Place this file into the directory where your schematics
;     resides.
;   Open gschem and hit ':' (colon).
;   Type '(load "rename.scm")' (without outer quotes).
;   You can add the above command into one of your gafrc files to do
;     this automatically everytime gschem is run. To make it work,
;     place the file into the directory where the gafrc file
;     resides.
;
;   Then, everytime you want to rename some attributes do as
;   follows:
;     select the symbol(s) in question;
;     embed it hitting E B if it is not yet embedded;
;     hit ':' and type something like
;      (change-attrib-value "pinlabel" "1" "Vcc")
;
;   NOTE: ALL pin attributes with the given name and value will be
;   changed for ALL selected components.
(use-modules (geda object))
(use-modules (geda attrib))
(use-modules (gschem selection))

(define (change-attrib-value name old-value new-value)
 (for-each
  (lambda (obj)
    (if (component? obj)
      (for-each
        (lambda (primitive)
          (if (pin? primitive)
            (for-each
              (lambda(attr)
                (and
                  (attribute? attr)
                  (equal? (attrib-name attr) name)
                  (equal? (attrib-value attr) old-value)
                  (set-attrib-value! attr new-value)
                  (gschem-log (string-append
                                name ": "
                                old-value " -> " new-value
                                "\n"))
                  ))
              (object-attribs primitive))
            )
          )
        (component-contents obj)
        )
      )
    )
  (page-selection (active-page))))

--YiEDa0DAkWCtVeE4--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019