X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f X-Recipient: geda-user AT delorie DOT com X-Virus-Scanned: Debian amavisd-new at mail.linetec.nl Content-Type: multipart/alternative; boundary="------------vXxc9gy0p56C9RV2mxBeIfKp" Message-ID: Date: Wed, 1 May 2024 13:40:33 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [geda-user] Gschem refdes autonumber over multiple pages? To: geda-user AT delorie DOT com References: <37de350c-1e5f-422f-b13a-c5a9a1e132ac AT linetec DOT nl> <20240429130455 DOT F01EF81AB8C5 AT turkos DOT aspodata DOT se> <20240430103043 DOT 32de22ff AT queeg DOT menasians DOT com> <20240430211916 DOT A6DBC81AB8C5 AT turkos DOT aspodata DOT se> From: "Richard Rasker (rasker AT linetec DOT nl) [via geda-user AT delorie DOT com]" Content-Language: nl-NL, en-US In-Reply-To: <20240430211916.A6DBC81AB8C5@turkos.aspodata.se> 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 This is a multi-part message in MIME format. --------------vXxc9gy0p56C9RV2mxBeIfKp Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hello Karl, Op 30-04-2024 om 23:19 schreef karl AT aspodata DOT se [via geda-user AT delorie DOT com]: > Richard: >>> Thank you for your explanation. So there is no easy solution that I >>> overlooked. This hierarchical numbering seems rather complicated; I >>> think I'll follow up  on your suggestion and write a simple script that >>> maintains a list of all RefDes-attributes in all relevant page files, >>> and simply coughs up the next free RefDes for the most common >>> categories of components (R, C, L, U, Q). > Hmm, I gave you an easy solution in a another mail. Yes, I downloaded the .sch and .pcb files, but I don't have the symbols referred to in the .sch file. I more or less follow your explanation about a hierarchical structure and prefixes in the RefDeses to distinguish between schematic pages. And yes, when I start a new project, I already use the strategy of using RefDes 100+ for page 1 (or channel 1), 200+ for page 2 (or channel 2), and so on; and RefDes in single and double digits are often used for common, not too large circuits, e.g. supply circuits and  other common stuff. However, I don't quite understand how this applies to the current situation here, where I have one project with several existing gschem pages, with RefDes numbering all over the place. > If you don't use subpages, then you already have global refdeses. > OK, by this you mean the normal numbering? > If you want subpages, you can temporarily accept the hierarchical > refdeses, and when your design finalizes, you can extract them with: > >> $ grep '^Element\[' styrkort.pcb | cut -f6 -d\" | sort | tee list | head " > I don't particularly want subpages or Refdeses with prefixes, but just a way to find the next free global RefDes for any component, without changing the gschem files themselves.I also don't understand what role PCB plays in this. The whole point is that at the moment, duplicate RefDeses only show up when importing everything in PCB, and I want to prevent this by checking just gschem files. I really appreciate the time you took to come up with all these bash commands to process gschem and PCB files, but to me it does not look all that simple. Maybe we're not quite on the same (gschem) page here (to use an appropriate metaphor...)? Stephen C. Menasian wrote: >> I wrote a simple program (geda_parts) which when invoked as follows: >> >> geda_parts >> >> reference type can be R, C, Q, U, L, T, Y This sounds more like what I'm looking for, but I thought about it, and it should be pretty easy to write a script that concatenates and sorts all gschem files listed in a project file, and then tries matching a counter to RefDes numbers for each component type, and simply spits out the counter values for which no RefDes is found. >> Instead of thoose single letter , why not search >> for the device attribute instead, like Capacitor, Resistor etc. >> >> ... >> It lists other significant part attributes. It was written to create >> starting points for parts lists. It has proven handy in manual >> renumbering to detect gaps n the parts list sequence or duplicated >> reference descriptors. >> >> Here is a typical output: >> ------------------------------------- >> C1 CAPACITOR, Polypropylene 0.10uF >> C2 CAPACITOR, VARIABLE 4-36pF, ceramic >> C3 CAPACITOR 0.03uF >> C4 CAPACITOR 250pF > ... > > Why not use (or the geda equiv.): > $ cat attribs > device > footprint > value > $ lepton-netlist -g bom styrkort.sch > $ grep Capacitor output.net | head -3 > 3C1 Capacitor ipc7351b_2012Ar.fp 1u > 3C2 Capacitor ipc7351b_2012Ar.fp 10n > 3C3 Capacitor ipc7351b_2012Ar.fp 1u > $ echo `grep Capacitor output.net | cut -f 1 | sort ` > 12C1 12C2 12C3 3C1 3C2 3C3 _C0 _C1 _C2 _C3 _Ca1 _Ca2 a3C1 a3C2 a3C3 a5C1 a5C2 a5C3 aC1 aC2 aC3 amC1 amCi1 anC1 anC2 anC3 apC1 apC2 apC3 dC1 dC2 pC1 pC2 pC3 pC4 pC5 pC6 pC7 pC8 pC9 sC1 sC2 sC3 sC4 sC5 sC6 sC7 srC1 srC2 srC3 srC4 srC5 t0C01 t0C1 t0C11 t0C12 t0C2 t0C21 t0C22 t0C31 t0C34 t1C01 t1C1 t1C11 t1C12 t1C2 t1C21 t1C22 t1C31 t1C34 t2C01 t2C1 t2C11 t2C12 t2C2 t2C21 t2C22 t2C31 t2C34 t3C01 t3C1 t3C11 t3C12 t3C2 t3C21 t3C22 t3C31 t3C34 t4C01 t4C1 t4C11 t4C12 t4C2 t4C21 t4C22 t4C31 t4C34 t5C01 t5C1 t5C11 t5C12 t5C2 t5C21 t5C22 t5C31 t5C34 t6C01 t6C1 t6C11 t6C12 t6C2 t6C21 t6C22 t6C31 t6C34 t7C01 t7C1 t7C11 t7C12 t7C2 t7C21 t7C22 t7C31 t7C34 yC1 yC2 > $ Sorry, once again you lost me. What does the above do exactly? I really think we have some sort of misunderstanding here. I'm not looking for lists of existing components or component attributes, nor do I want to convert gschem pages to a hierarchical structure; I'm just looking for the first unused Refdes for a particular component type over multiple gschem files. So something that works like this, assuming that C121, C133 and R89 are unused so far: $ nextcomp C C121 [-> entered a new capacitor C121 in one of the gschem files, saved it] $ nextcomp C C133 [-> entered C133, saved file] $ nextcomp R R89 (etcetera) > My guess is that your program doesn't provide anything new. So far, I can't find anything that does what I'm looking for, at least in a simple way as given above. I shall build this script of mine, and if you like, I can post the result here. So thanks again for your replies, your code and for trying to think alone, I really appreciate the effort! Regards, Richard --------------vXxc9gy0p56C9RV2mxBeIfKp Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Hello Karl,

Op 30-04-2024 om 23:19 schreef karl AT aspodata DOT se [via geda-user AT delorie DOT com]:
Richard:
Thank you for your explanation. So there is no easy solution that I 
overlooked. This hierarchical numbering seems rather complicated; I 
think I'll follow up  on your suggestion and write a simple script that 
maintains a list of all RefDes-attributes in all relevant page files, 
and simply coughs up the next free RefDes for the most common
categories of components (R, C, L, U, Q).
Hmm, I gave you an easy solution in a another mail.

Yes, I downloaded the .sch and .pcb files, but I don't have the symbols referred to in the .sch file.

I more or less follow your explanation about a hierarchical structure and prefixes in the RefDeses to distinguish between schematic pages.

And yes, when I start a new project, I already use the strategy of using RefDes 100+ for page 1 (or channel 1), 200+ for page 2 (or channel 2), and so on; and RefDes in single and double digits are often used for common, not too large circuits, e.g. supply circuits and  other common stuff.

However, I don't quite understand how this applies to the current situation here, where I have one project with several existing gschem pages, with RefDes numbering all over the place.

If you don't use subpages, then you already have global refdeses.

OK, by this you mean the normal numbering?

If you want subpages, you can temporarily accept the hierarchical refdeses, and when your design finalizes, you can extract them with:

$ grep '^Element\[' styrkort.pcb | cut -f6 -d\" | sort | tee list | head "

I don't particularly want subpages or Refdeses with prefixes, but just a way to find the next free global RefDes for any component, without changing the gschem files themselves. I also don't understand what role PCB plays in this. The whole point is that at the moment, duplicate RefDeses only show up when importing everything in PCB, and I want to prevent this by checking just gschem files.

I really appreciate the time you took to come up with all these bash commands to process gschem and PCB files, but to me it does not look all that simple. Maybe we're not quite on the same (gschem) page here (to use an appropriate metaphor...)?

Stephen C. Menasian wrote:

I wrote a simple program (geda_parts) which when invoked as follows:

geda_parts <schematic_file_base> <reference type>

reference type can be R, C, Q, U, L, T, Y

This sounds more like what I'm looking for, but I thought about it, and it should be pretty easy to write a script that concatenates and sorts all gschem files listed in a project file, and then tries matching a counter to RefDes numbers for each component type, and simply spits out the counter values for which no RefDes is found.

Instead of thoose single letter <reference type>, why not search
for the device attribute instead, like Capacitor, Resistor etc.

...
It lists other significant part attributes. It was written to create
starting points for parts lists. It has proven handy in manual
renumbering to detect gaps n the parts list sequence or duplicated
reference descriptors.

Here is a typical output:
-------------------------------------
C1      CAPACITOR, Polypropylene 0.10uF
C2      CAPACITOR, VARIABLE      4-36pF, ceramic
C3      CAPACITOR                0.03uF
C4      CAPACITOR                250pF
...

 Why not use (or the geda equiv.):
$ cat attribs 
device
footprint
value
$ lepton-netlist -g bom styrkort.sch 
$ grep Capacitor output.net  | head -3
3C1     Capacitor       ipc7351b_2012Ar.fp      1u
3C2     Capacitor       ipc7351b_2012Ar.fp      10n
3C3     Capacitor       ipc7351b_2012Ar.fp      1u
$ echo `grep Capacitor output.net | cut -f 1 | sort `
12C1 12C2 12C3 3C1 3C2 3C3 _C0 _C1 _C2 _C3 _Ca1 _Ca2 a3C1 a3C2 a3C3 a5C1 a5C2 a5C3 aC1 aC2 aC3 amC1 amCi1 anC1 anC2 anC3 apC1 apC2 apC3 dC1 dC2 pC1 pC2 pC3 pC4 pC5 pC6 pC7 pC8 pC9 sC1 sC2 sC3 sC4 sC5 sC6 sC7 srC1 srC2 srC3 srC4 srC5 t0C01 t0C1 t0C11 t0C12 t0C2 t0C21 t0C22 t0C31 t0C34 t1C01 t1C1 t1C11 t1C12 t1C2 t1C21 t1C22 t1C31 t1C34 t2C01 t2C1 t2C11 t2C12 t2C2 t2C21 t2C22 t2C31 t2C34 t3C01 t3C1 t3C11 t3C12 t3C2 t3C21 t3C22 t3C31 t3C34 t4C01 t4C1 t4C11 t4C12 t4C2 t4C21 t4C22 t4C31 t4C34 t5C01 t5C1 t5C11 t5C12 t5C2 t5C21 t5C22 t5C31 t5C34 t6C01 t6C1 t6C11 t6C12 t6C2 t6C21 t6C22 t6C31 t6C34 t7C01 t7C1 t7C11 t7C12 t7C2 t7C21 t7C22 t7C31 t7C34 yC1 yC2
$

Sorry, once again you lost me. What does the above do exactly? I really think we have some sort of misunderstanding here. I'm not looking for lists of existing components or component attributes, nor do I want to convert gschem pages to a hierarchical structure; I'm just looking for the first unused Refdes for a particular component type over multiple gschem files. So something that works like this, assuming that C121, C133 and R89 are unused so far:

$ nextcomp C
C121
[
-> entered a new capacitor C121 in one of the gschem files, saved it]
$ nextcomp C
C133
[
-> entered C133, saved file]
$ nextcomp R
R89
(etcetera)

My guess is that your program doesn't provide anything new.

So far, I can't find anything that does what I'm looking for, at least in a simple way as given above. I shall build this script of mine, and if you like, I can post the result here.

So thanks again for your replies, your code and for trying to think alone, I really appreciate the effort!

Regards,

Richard

--------------vXxc9gy0p56C9RV2mxBeIfKp--