eeschema: annotate hierarchy: no control over sheet numbers

Bug #1154131 reported by
78
This bug affects 17 people
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
Wishlist
Unassigned

Bug Description

When I place several hierarchial sheets, I can't alter (not even see) the sheetnumber. When i then annotate, the resulting component references are not always what I wanted.

Suppose I have 2 functional blocks, let's call them A.sch and B.sch. I would like to create a PCB with 3A's, and 2 B's. Here's what happens when I create them in this order:
1-create the main sheet hierarchy.sch
2-place hierarchial sheet A.sch (called A1)
3-place hierarchial sheet B.sch (called B1)
4-copy hierarchial sheet A1 and rename to A2
5-copy hierarchial sheet A1 and rename to A3
6-copy hierarchial sheet B1 and rename to B2

When I now annotate (entire schematic, start to sheet number *100) then I get the following result:
A1: components start with 201
A2: components start with 401
A3: components start with 501
B1: components start with 301
B2: components start with 601
Topmost sheet: components start with 101

Is it possible to make the sheet number editable, so I can take the above schematic, and change the numbers so they become like this?
A1: components start with 101
A2: components start with 201
A3: components start with 301
B1: components start with 401
B2: components start with 501
Topmost sheet: components start with 601

Best regards,
Cedric

Revision history for this message
Cé (cedric-dewijs-telfort) wrote :

Sorry, I forgot to post my version:
Application: KiCad
Version: (2013-03-04 BZR 3984)-stable
Build: wxWidgets 2.9.4 (wchar_t,compiler with C++ ABI 1002,GCC 4.7.2,wx containers,compatible with 2.8)
Platform: Windows XP (build 2600, Service Pack 3), 32 bit, Little endian, wxMSW
Boost version: 1.53.0
Options: USE_PCBNEW_NANOMETRES=ON
         KICAD_GOST=OFF
         USE_WX_GRAPHICS_CONTEXT=OFF
         USE_WX_OVERLAY=OFF
         KICAD_SCRIPTING=OFF
         KICAD_SCRIPTING_MODULES=OFF
         KICAD_SCRIPTING_WXPYTHON=OFF

Changed in kicad:
importance: Undecided → Wishlist
Revision history for this message
Karl Zeilhofer (zeilhofer) wrote :

I have the same problem.

At lest I found a workaround:
Edit the .sch file in a text editor of your choice, and rearange the blocks of $Sheet to $EndSheet in your favour order.

When you reopen the file in eeshema, the sheet order has changed.

It would be a necessary feature for eeschema.
My problem especially was, that I changed a large project, and added some sheets. And then the sheet numbers got mixed up, so that for example all the U6xx components where on sheet 3. And the newly added parts on this sheet got the name U3xx, and didn't match to their neighboured U6xx-parts on the sheet.

What you can not change with this workaround is the order of sub-sub-sheets. these will allways get a number after the parent sheet (= sub-sheet). When adding sub-sub-sheets to an existing project, this will lead to the problem described above, unless you add such a sub-sub-sheet only to the last sub-sheet.

could this feature be expected in a near future version?

greets, Karl

Revision history for this message
Nik (nikbowdler) wrote :

This is a problem for me too.

Being able to manually set the desired page numbering would be a good feature. This could be a parameter in the create/edit sheet box.

Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

As long as it can be done with any changes to the current schematic file format then I'm OK with adding this feature. It will have to be done before the upcoming feature freeze (very soon hopefully) or be put off until the next development cycle. If it requires changes to the file format to save the ordering information then it will have to wait until the next development cycle because we are planning on changing the schematic file format to an s-expression format like the board file format. No changes will be allowed to the current file format.

Revision history for this message
jean-pierre charras (jp-charras) wrote :

I do not think this is possible to do that just by changing the order of sheets (but I can be wrong).

I am seeing at least 2 critical cases:
1 - complex hierarchies
2 - sheets inside sheets.

In every case, you need to have a hierarchy manager, and store the hierarchy structure (order of sheet paths) inside the root schematic file.

Revision history for this message
Nik (nikbowdler) wrote :

No change to the file format would be required, just the algorithm that does the sheet numbering: to use the user input box rather than save order. The box could default to the next available sheet number when creating.

Revision history for this message
Karl Zeilhofer (zeilhofer) wrote :

since the KiCad developers are too busy to implement this feature, I have written a simple external tool.
I'm sorry for not implementing it directly in the KiCad source code, but currently I have not the time to dig into this huge project code.

Please have a look here:
http://www.zeilhofer.co.at/kicad-sheet-rearranger

Greets,
Karl

Revision history for this message
A Wolfe (a-wolfie) wrote :

This appears to be a duplicate of earlier reported bug #864122. But this one has been elevated to wishlist, while the older one is still undecided.

Revision history for this message
Chris Pavlina (pavlina-chris) wrote :

This script was shared on IRC related to this feature request. Bear in mind it does not work for complex hierarchies with multiple instances of a single sheet. https://neo900.org/git/?p=ee;a=blob_plain;f=hw/sortsheets;hb=HEAD

Revision history for this message
Viktor Varga (vitius) wrote :

I found a workaround which does not involve manually editing the .sch file.

If you delete the hierarchical sheet from the Root and Undo (Ctrl-Z) the action. The sheet will became the last in the list.
You need to repeat this for all sheets, in the desired order.

Hope this helps until it gets solved.

Revision history for this message
Jeff Young (jeyjey) wrote :

We could add a textctrl into the Sheet dialog ("Start number" or something) and write it out within the sheet name:

F0 "PSU|300" 50

When reading we'd separate them and use the number if found, otherwise defaulting to our existing numbering algorithm.

This doesn't "really" change the file format; external tools might display the name with the number attached, but that wouldn't really be bad (and better than not displaying it at all).

This one has enough people interested in it that I'd hate to have to wait till 6.0....

Thoughts?

Revision history for this message
Wayne Stambaugh (stambaughw) wrote : Re: [Bug 1154131] Re: eeschema: annotate hierarchy: no control over sheet numbers

This would require a file format change (previous versions of eeschema
cannot deal with "PSU|300") which I do not want to introduce since the
new file format is one of the first things on my v6 list. I plan on
fixing the schematic numbering issue.

On 02/13/2018 05:16 PM, Jeff Young wrote:
> We could add a textctrl into the Sheet dialog ("Start number" or
> something) and write it out within the sheet name:
>
> F0 "PSU|300" 50
>
> When reading we'd separate them and use the number if found, otherwise
> defaulting to our existing numbering algorithm.
>
> This doesn't "really" change the file format; external tools might
> display the name with the number attached, but that wouldn't really be
> bad (and better than not displaying it at all).
>
> This one has enough people interested in it that I'd hate to have to
> wait till 6.0....
>
> Thoughts?
>

Revision history for this message
Jeff Young (jeyjey) wrote :

Previous versions will just print that out as the name, right? Is that so bad?

(Besides, previous versions of Pcbnew can’t read newer versions of the file at all.)

> On 13 Feb 2018, at 22:50, Wayne Stambaugh <email address hidden> wrote:
>
> This would require a file format change (previous versions of eeschema
> cannot deal with "PSU|300") which I do not want to introduce since the
> new file format is one of the first things on my v6 list. I plan on
> fixing the schematic numbering issue.
>
> On 02/13/2018 05:16 PM, Jeff Young wrote:
>> We could add a textctrl into the Sheet dialog ("Start number" or
>> something) and write it out within the sheet name:
>>
>> F0 "PSU|300" 50
>>
>> When reading we'd separate them and use the number if found, otherwise
>> defaulting to our existing numbering algorithm.
>>
>> This doesn't "really" change the file format; external tools might
>> display the name with the number attached, but that wouldn't really be
>> bad (and better than not displaying it at all).
>>
>> This one has enough people interested in it that I'd hate to have to
>> wait till 6.0....
>>
>> Thoughts?
>>
>
> --
> You received this bug notification because you are a member of KiCad Bug
> Squad, which is subscribed to KiCad.
> https://bugs.launchpad.net/bugs/1154131
>
> Title:
> eeschema: annotate hierarchy: no control over sheet numbers
>
> Status in KiCad:
> New
>
> Bug description:
> When I place several hierarchial sheets, I can't alter (not even see)
> the sheetnumber. When i then annotate, the resulting component
> references are not always what I wanted.
>
> Suppose I have 2 functional blocks, let's call them A.sch and B.sch. I would like to create a PCB with 3A's, and 2 B's. Here's what happens when I create them in this order:
> 1-create the main sheet hierarchy.sch
> 2-place hierarchial sheet A.sch (called A1)
> 3-place hierarchial sheet B.sch (called B1)
> 4-copy hierarchial sheet A1 and rename to A2
> 5-copy hierarchial sheet A1 and rename to A3
> 6-copy hierarchial sheet B1 and rename to B2
>
> When I now annotate (entire schematic, start to sheet number *100) then I get the following result:
> A1: components start with 201
> A2: components start with 401
> A3: components start with 501
> B1: components start with 301
> B2: components start with 601
> Topmost sheet: components start with 101
>
> Is it possible to make the sheet number editable, so I can take the above schematic, and change the numbers so they become like this?
> A1: components start with 101
> A2: components start with 201
> A3: components start with 301
> B1: components start with 401
> B2: components start with 501
> Topmost sheet: components start with 601
>
> Best regards,
> Cedric
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/kicad/+bug/1154131/+subscriptions

Revision history for this message
Wayne Stambaugh (stambaughw) wrote :
Download full text (3.2 KiB)

I would rather avoid special character hacks like this given our past
results. You can be rest assured someone will have a sheet name
"FOO|##" and will file a bug report that the sheet number has changed.
It never ceases to amaze me how often this happens.

On 02/13/2018 06:45 PM, Jeff Young wrote:
> Previous versions will just print that out as the name, right? Is that
> so bad?
>
> (Besides, previous versions of Pcbnew can’t read newer versions of the
> file at all.)
>
>
>> On 13 Feb 2018, at 22:50, Wayne Stambaugh <email address hidden> wrote:
>>
>> This would require a file format change (previous versions of eeschema
>> cannot deal with "PSU|300") which I do not want to introduce since the
>> new file format is one of the first things on my v6 list. I plan on
>> fixing the schematic numbering issue.
>>
>> On 02/13/2018 05:16 PM, Jeff Young wrote:
>>> We could add a textctrl into the Sheet dialog ("Start number" or
>>> something) and write it out within the sheet name:
>>>
>>> F0 "PSU|300" 50
>>>
>>> When reading we'd separate them and use the number if found, otherwise
>>> defaulting to our existing numbering algorithm.
>>>
>>> This doesn't "really" change the file format; external tools might
>>> display the name with the number attached, but that wouldn't really be
>>> bad (and better than not displaying it at all).
>>>
>>> This one has enough people interested in it that I'd hate to have to
>>> wait till 6.0....
>>>
>>> Thoughts?
>>>
>>
>> --
>> You received this bug notification because you are a member of KiCad Bug
>> Squad, which is subscribed to KiCad.
>> https://bugs.launchpad.net/bugs/1154131
>>
>> Title:
>> eeschema: annotate hierarchy: no control over sheet numbers
>>
>> Status in KiCad:
>> New
>>
>> Bug description:
>> When I place several hierarchial sheets, I can't alter (not even see)
>> the sheetnumber. When i then annotate, the resulting component
>> references are not always what I wanted.
>>
>> Suppose I have 2 functional blocks, let's call them A.sch and B.sch. I would like to create a PCB with 3A's, and 2 B's. Here's what happens when I create them in this order:
>> 1-create the main sheet hierarchy.sch
>> 2-place hierarchial sheet A.sch (called A1)
>> 3-place hierarchial sheet B.sch (called B1)
>> 4-copy hierarchial sheet A1 and rename to A2
>> 5-copy hierarchial sheet A1 and rename to A3
>> 6-copy hierarchial sheet B1 and rename to B2
>>
>> When I now annotate (entire schematic, start to sheet number *100) then I get the following result:
>> A1: components start with 201
>> A2: components start with 401
>> A3: components start with 501
>> B1: components start with 301
>> B2: components start with 601
>> Topmost sheet: components start with 101
>>
>> Is it possible to make the sheet number editable, so I can take the above schematic, and change the numbers so they become like this?
>> A1: components start with 101
>> A2: components start with 201
>> A3: components start with 301
>> B1: components start with 401
>> B2: components start with 501
>> Topmost sheet: components start with 601
>>
>> Best regards,
>> Cedric
>>
>> To manage notifications...

Read more...

Revision history for this message
jean-pierre charras (jp-charras) wrote :

@Jeff,
Your idea does not work with complex hierarchies.

Just because in a sheet instantiated twice, the field F0:
F0 "PSU|300" 50
exists only once, and need two different strings.

This is solved for AR fields (one by sheet path).

The sheet number is not one by sheet, but one by sheet path, and needs a file format change
to store it in the root sheet.

Revision history for this message
Jeff Young (jeyjey) wrote :

I may not understand this entirely, but the line I suggested amending is in the parent sheet (ie: is the reference to the sub-sheet). There’s one of those for each inclusion, isn’t there?

> On 14 Feb 2018, at 06:55, jean-pierre charras <email address hidden> wrote:
>
> @Jeff,
> Your idea does not work with complex hierarchies.
>
> Just because in a sheet instantiated twice, the field F0:
> F0 "PSU|300" 50
> exists only once, and need two different strings.
>
> This is solved for AR fields (one by sheet path).
>
> The sheet number is not one by sheet, but one by sheet path, and needs a file format change
> to store it in the root sheet.
>
> --
> You received this bug notification because you are a member of KiCad Bug
> Squad, which is subscribed to KiCad.
> https://bugs.launchpad.net/bugs/1154131
>
> Title:
> eeschema: annotate hierarchy: no control over sheet numbers
>
> Status in KiCad:
> New
>
> Bug description:
> When I place several hierarchial sheets, I can't alter (not even see)
> the sheetnumber. When i then annotate, the resulting component
> references are not always what I wanted.
>
> Suppose I have 2 functional blocks, let's call them A.sch and B.sch. I would like to create a PCB with 3A's, and 2 B's. Here's what happens when I create them in this order:
> 1-create the main sheet hierarchy.sch
> 2-place hierarchial sheet A.sch (called A1)
> 3-place hierarchial sheet B.sch (called B1)
> 4-copy hierarchial sheet A1 and rename to A2
> 5-copy hierarchial sheet A1 and rename to A3
> 6-copy hierarchial sheet B1 and rename to B2
>
> When I now annotate (entire schematic, start to sheet number *100) then I get the following result:
> A1: components start with 201
> A2: components start with 401
> A3: components start with 501
> B1: components start with 301
> B2: components start with 601
> Topmost sheet: components start with 101
>
> Is it possible to make the sheet number editable, so I can take the above schematic, and change the numbers so they become like this?
> A1: components start with 101
> A2: components start with 201
> A3: components start with 301
> B1: components start with 401
> B2: components start with 501
> Topmost sheet: components start with 601
>
> Best regards,
> Cedric
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/kicad/+bug/1154131/+subscriptions

Revision history for this message
jean-pierre charras (jp-charras) wrote :

"There’s one of those for each inclusion, isn’t there?"
Yes of course.

But this parent sheet can be instantiated twice, that broke your expectation.

Trust me: Complex hierarchies are *very* tricky.

Revision history for this message
Jeff Young (jeyjey) wrote :

Hmmm... indeed.

Regardless of how the information is stored, this is going to make the UI more complicated. And that's certainly not a 5.0 task.

Changed in kicad:
milestone: none → 6.0.0-rc1
Revision history for this message
Jeff Young (jeyjey) wrote :

Maybe we were shooting too high. Why not make it a partly-manual process?

Put a textbox after the Start From radio button in the Annotate dialog.
Make the dialog modeless.
The user can now switch between sheets and annotate in whatever order they want. No automation, but that might be OK.

Let me know what you think of the attached patch.

Revision history for this message
Jeff Young (jeyjey) wrote :

Updated patch which fixes dialog not closing automatically in modal mode when the "Keep Open" checkbox is checked. (We also now hide the checkbox in modal mode.)

Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

Fixed in revision 447fd1bf02462707c15f0109a2b44eb21e8cc3eb
https://git.launchpad.net/kicad/patch/?id=447fd1bf02462707c15f0109a2b44eb21e8cc3eb

Changed in kicad:
status: New → Fix Committed
Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

@Jeff, this is not the ideal way to do it but it does provide a solution to the problem until we resolve our sheet numbering issues. I merged your patch. Thanks.

Revision history for this message
Hildo Guillardi Júnior (hildogjr) wrote :

Agree with @jp-charras.
In my case I am using sheet inside sheet inside sheet and I am interested on the component references (#1728269) to on the future just print one of this replicated sheet.

Changed in kicad:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.