X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f X-Recipient: geda-user 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=OVfXPyDp3uT029r03DZwc3yp0wyE9q92IGpq+uSPhTY=; b=Px4VssMkHDZFYMkfyqSpaQ7RFuMKv6FTvSTEgegjzGOPntD2iUQYS7/2etAqKhsYY2 5h8Yn2QNS/swz4VZLGDHrBEZ9X3iYaNdDNb8QWzZ+pq86hKRSYowYgUeuJVxW+FNpZEO Vzs4v5XDx0tJfhzLQIzPUIY5/oVe7KdzKoqG13pOG87DjtdGhMlwQjqDEp1eVnjG/cf/ Ksxw9kcypJuWFgDtiLflsARhXFpxVHuB7pGBkfeZPYvpmRQQaHa8+ZqPDy6R/Hf5s4Y7 fnWI7rruxliaAa/gWlS748jdGXKa2tyVsyPlJMNfYaGtuFy2naLGUHmMqueSnaSIpfoM i2nQ== X-Received: by 10.112.140.202 with SMTP id ri10mr12486943lbb.9.1394224349045; Fri, 07 Mar 2014 12:32:29 -0800 (PST) Date: Sat, 8 Mar 2014 00:32:25 +0400 From: Vladimir Zhbanov To: geda-user AT delorie DOT com Subject: Re: [geda-user] How to dgenerate BOM with supplier codes ? Message-ID: <20140307203225.GA3301@localhost.localdomain> Mail-Followup-To: geda-user AT delorie DOT com References: <8C4 DOT JWW9 DOT 2t9UKSzjwti DOT 1J6UDb AT seznam DOT cz> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="4Ckj6UjgE2iN1+kY" Content-Disposition: inline In-Reply-To: <8C4.JWW9.2t9UKSzjwti.1J6UDb@seznam.cz> User-Agent: Mutt/1.5.21 (2010-09-15) Reply-To: geda-user AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: geda-user AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk --4Ckj6UjgE2iN1+kY Content-Type: text/plain; charset=utf-8 Content-Disposition: inline On Fri, Mar 07, 2014 at 04:19:01PM +0100, Vaclav Peroutka wrote: > Hello all, > for generating BOM, I currently use partslist3 script. But I want to > make some modification to have supplier code to generate the order, as > well. > Now the output looks like: > ..device value footprint quantity refdes > and I would see the list like: > ..suppliercode quantity device value footprint refdes > I added suppliercode into partslist-common.scm to the first column but > now I want to change gnet-partslist3.scm But I am not able to > understand guile at all. Can somebody help me to change the SCM file to > reorder columns ? Try the attached patch. > Or do you use some different approach to automatically generate the > order list ? Have you tried other gnetlist backends? Some of them might suit your needs (probably with minor processing with awk, perl or whatever). --4Ckj6UjgE2iN1+kY Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="partslist3.diff" diff --git a/gnetlist/scheme/gnet-partslist3.scm b/gnetlist/scheme/gnet-partslist3.scm index 8e3f2f5..c86e38b 100644 --- a/gnetlist/scheme/gnet-partslist3.scm +++ b/gnetlist/scheme/gnet-partslist3.scm @@ -20,7 +20,7 @@ (define partslist3:write-top-header (lambda (port) (display ".START\n" port) - (display "..device\tvalue\tfootprint\tquantity\trefdes\n" port))) + (display "..suppliercode\tquantity\tdevice\tvalue\tfootprint\trefdes\n" port))) (define (partslist3:write-partslist ls port) (if (null? ls) @@ -52,9 +52,23 @@ (define partslist3 (lambda (output-filename) (let ((port (open-output-file output-filename)) - (parts-table (marge-sort-with-multikey (get-parts-table packages) '(1 2 3 0)))) + (parts-table (marge-sort-with-multikey (get-parts-table packages) '(1 2 3 0))) + (new-parts-table '())) (set! parts-table (count-same-parts parts-table)) (partslist3:write-top-header port) - (partslist3:write-partslist parts-table port) + (for-each + (lambda (entry) + (set! new-parts-table + (append + new-parts-table + (list (list + (list-ref entry 0) ; list of refdes - special, don't touch it + (list-ref entry 1) ; suppliercode + (list-ref entry 5) ; quantity + (list-ref entry 2) ; device + (list-ref entry 3) ; value + (list-ref entry 4) ; footprint + ))))) parts-table) + (partslist3:write-partslist new-parts-table port) (partslist3:write-bottom-footer port) (close-output-port port)))) diff --git a/gnetlist/scheme/partslist-common.scm b/gnetlist/scheme/partslist-common.scm index d4c235d..bd475d5 100644 --- a/gnetlist/scheme/partslist-common.scm +++ b/gnetlist/scheme/partslist-common.scm @@ -22,6 +22,7 @@ (if (string=? (get-device package) "include") (get-parts-table (cdr packages)) (cons (list package + (gnetlist:get-package-attribute package "suppliercode") (get-device package) (get-value package) (gnetlist:get-package-attribute package "footprint")) ;; sdb change --4Ckj6UjgE2iN1+kY--