Re: gEDA-user: gschem saving symbols

2011-06-15 Thread Kai-Martin Knaak
Josh Jordan wrote:

> What I am trying to do is save symbols that were modified in the 
> schematic.  For instance, making a schematic and add a generic 
> capacitor.  Then add a value, footprint, partnumber and documentation.

This does not change the symbol but adds attributes to the instance 
in the schematic. 

If I want to change a generic symbol I'd:

1) copy and rename the symbol to some other place with some 
external tool like the bash shell, or a file browser.

2) open the symbol with gschem 

3) do my changes

4) save and quit.


Alternatively:  

1) copy and rename the generic symbol to some other place.

2) open the schematic and add the copied symbol

3) do down-symbol from the hierarchy menu ([shift-h s])
This opens the symbol from the lib in symbol edit mode 
(not the instance in the schematic).

4) do my changes

5) save

6) do "Up" from the hierarchy menu

7) do "Update-Symbol" from the edit menu [ep]
This last step is not really necessary. The symbol will be 
reread every time the schematic is opened, anyway.


If you really need to copy attributes from an instance to a 
symbol in a library, you can do so by:

1) open schematic with symbol augmented by attributes

2) select the attributes to be copied

3) copy the attributes [ctrl-c]

4) open the symbol in the lib with open from the file menu [fo]

5) paste the attributes [ctrl-v] and move them to proper places

6) make the attributes visible. This will make them "promoted" 
on instantiation.

7) save [fs]

Seems a bit awkward. But it is not that bad. Changing symbols
directly in your personal lib is the recommended way. 

---<)kaiamrtin(>---
-- 
Kai-Martin Knaak
Email: k...@familieknaak.de
Öffentlicher PGP-Schlüssel:
http://pool.sks-keyservers.net:11371/pks/lookup?search=0x6C0B9F53



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


Re: gEDA-user: gschem saving symbols

2011-06-15 Thread Josh Jordan
I'm not sure you understand my question.  What I am trying to do is
save symbols that were modified in the schematic.  For instance, making
a schematic and add a generic capacitor.  Then add a value, footprint,
partnumber and documentation.  Now if you would like to save the
modified symbol, where do you go from here?  Shift-H-s and 'save as'
should do this but it brings up the original generic capacitor so if
you want to save the modified part you have to make all of your changes
again.  Is there no way to save a modified symbol?
--- On Wed, 6/15/11, Kai-Martin Knaak  wrote:

  From: Kai-Martin Knaak 
  Subject: Re: gEDA-user: gschem saving symbols
  To: geda-u...@seul.org
  Date: Wednesday, June 15, 2011, 4:59 PM

Josh Jordan wrote:
> Is it possible to load a symbol into a schematic, change it up, and
> save it as another symbol?
yes.
Make sure, it is placed at a path, gschem knows about. This can be
modified in gafrc. A common setting is to include the current working
directory:
/--excerpt from gafrc--
; Allow to source symbols from the current working directory
(define current-working-directory ".")
(component-library current-working-directory "symbols in project dir")
(source-library  current-working-directory)
\---
Also make sure, that the symbols name does not clash with existing
names.
Else, you have to worry about precedence.
> This would be straight-forward but when you edit a symbol from a
schematic,
> it loads the original before it was modified so you have to make all
of the
> modifications again.
You have to load the modified symbol instead.
1) type [i] to get the symbol chooser
2) If you are still in the same session as during the save-as: click on
the
funny arrow to the right of the filter entry field. This will update
the
cache of symbols.
3) locate the new symbol
4) insert as usual.
If the change affects many symbols, it may be easier to change the
symbol
name in the *.sch with text editing tools like sed or gedit.
---<)kaimartin(>---
--
Kai-Martin Knaak
Email: [1]k...@familieknaak.de
Öffentlicher PGP-Schlüssel:
[2]http://pool.sks-keyservers.net:11371/pks/lookup?search=0x6C0B9F53
___
geda-user mailing list
[3]geda-user@moria.seul.org
[4]http://www.seul.org/cgi-bin/mailman/listinfo/geda-user

References

   1. file://localhost/mc/compose?to=k...@familieknaak.de
   2. http://pool.sks-keyservers.net:11371/pks/lookup?search=0x6C0B9F53
   3. file://localhost/mc/compose?to=geda-user@moria.seul.org
   4. 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: gschem saving symbols

2011-06-15 Thread Kai-Martin Knaak
Josh Jordan wrote:

> Is it possible to load a symbol into a schematic, change it up, and 
> save it as another symbol?

yes.
Make sure, it is placed at a path, gschem knows about. This can be
modified in gafrc. A common setting is to include the current working 
directory:

/--excerpt from gafrc--
; Allow to source symbols from the current working directory
(define current-working-directory ".")
(component-library current-working-directory "symbols in project dir")
(source-library  current-working-directory)
\---

Also make sure, that the symbols name does not clash with existing names. 
Else, you have to worry about precedence.


> This would be straight-forward but when you edit a symbol from a schematic,
> it loads the original before it was modified so you have to make all of the
> modifications again.

You have to load the modified symbol instead.

1) type [i] to get the symbol chooser 

2) If you are still in the same session as during the save-as: click on the 
funny arrow to the right of the filter entry field. This will update the 
cache of symbols.

3) locate the new symbol

4) insert as usual.

If the change affects many symbols, it may be easier to change the symbol
name in the *.sch with text editing tools like sed or gedit.

---<)kaimartin(>---
-- 
Kai-Martin Knaak
Email: k...@familieknaak.de
Öffentlicher PGP-Schlüssel:
http://pool.sks-keyservers.net:11371/pks/lookup?search=0x6C0B9F53



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


gEDA-user: gschem saving symbols

2011-06-15 Thread Josh Jordan
Is it possible to load a symbol into a schematic, change it up, and
save it as another symbol?  This would be straight-forward but when you
edit a symbol from a schematic, it loads the original before it was
modified so you have to make all of the modifications again.
Thanks!


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


gEDA-user: Please test updates to auto-uref.scm

2011-06-15 Thread Krzysztof Kościuszkiewicz
Hello,

Taking advice from Peter B I have implemented some changes to the
auto-uref script.  It does not cache refdeses anymore, and allows
refdes reuse after deleting components from the schematic.

Another change allows to specify refdes numbering offset that is applied
automatically - for example:

Page contains R10, R121 and R33, offset set to 100.
Resistors will be numbered: R1, R2, R3...

Page contains R123, R223, R102, offset set to 100.
Resistors will be numbered: R101, R102, R103...

Script requires recent modifications to libgeda, so test with git HEAD.

Comments & ideas welcome.
-- 
Krzysztof Kościuszkiewicz
"Simplicity is the ultimate sophistication" -- Leonardo da Vinci
;; gEDA - GPL Electronic Design Automation
;; gschem - gEDA Schematic Capture
;; Copyright (C) 1998-2010 Ales Hvezda
;; Copyright (C) 1998-2010 gEDA Contributors (see ChangeLog for details)
;;
;; 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

(use-modules (ice-9 regex) (srfi srfi-1))

(define auto-uref-page-offset 0)

;; Redefine value of page-offset.
;; Refdeses will be numbered from integer multiples of page-offset,
;; depending on the lowest refdes value found on the page.
;; If lowest value is 323 and page offset is 100, then next refdes
;; will be 301.
;; Setting to 0 disables the feature.
(define (auto-uref-set-page-offset new-offset)
  (set! auto-uref-page-offset new-offset))

;; Modify attributes of an object to assign next unused refdes value
(define (auto-uref attribs)

  ; Return (prefix . number) on match or #f on failure
  (define (split-value value)
(let ((match (string-match "^([A-Za-z]+)([0-9]+)$" value)))
  (if match
(cons (match:substring match 1)
  (string->number (match:substring match 2)))
#f)))

  ; Extract prefix from a refdes attribute value
  (define (get-prefix value)
(let ((prefix (string-match "^[A-Za-z]+" value)))
  (if (= 0 (match:end prefix))
  #f
  (match:substring prefix

  ; Filter non-inherited refdes values
  (define (refdes-attrs attribs)
(filter (lambda (a)
  (and
(not (attrib-inherited? a))
(string=? "refdes" (car (get-attribute-name-value a)
attribs))

  ; Extract numbers from refdeses that have given prefix
  (define (extract-numbers object prefix)
(let* ((refdeses (refdes-attrs (get-object-attributes object)))
   (vals (map (lambda (a)
(cdr (get-attribute-name-value a)))
  refdeses))
   (prefix-numbers (filter-map split-value vals))
   (numbers (filter-map (lambda (n.v)
  (if (string=? prefix (car n.v))
  (cdr n.v)
  #f))
prefix-numbers)))
  numbers))

  ; Collect all numbers associated with prefix on current page
  (define (collect-all-numbers prefix)
(let ((objects (get-objects-in-page (get-current-page
  (concatenate (map (lambda (o)
  (extract-numbers o prefix))
objects

  ; Return first number not present in used greater or equal to minimum
  (define (find-first-unused used minimum)
(define (go n xs)
  (cond ((null? xs) n)
((< n (car xs)) n)
((= n (car xs)) (go (1+ n) (cdr xs)))
(else (go n (cdr xs)
(go minimum used))

  ; Do the work - first check if attributes contain refdes with prefix
  (let* ((refdeses (refdes-attrs attribs))
 (refdes (if (null? refdeses)
 #f
 (car refdeses)))
 (prefix (if refdes
 (get-prefix (cdr (get-attribute-name-value refdes)))
 #f)))
(if prefix
(let* ((used-nums (sort-list (collect-all-numbers prefix) <))
   ; minimum value considering the page-offset
   (min-num (if (or
  (null? used-nums)
  (<= auto-uref-page-offset 0))
0
(* (floor (/ (car used-nums)
 auto-uref-page-offset))
   auto-uref-page-offset)))
   ; next refde