Wishlist: Automatic value field substitution when creating footprints

Bug #1570120 reported by Camilo Tejeiro
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
Wishlist
Jeff Young

Bug Description

/*
Application: kicad
Version: 4.0.2-4+6225~38~ubuntu14.04.1-stable release build
wxWidgets: Version 3.0.2 (debug,wchar_t,compiler with C++ ABI 1002,GCC 4.8.4,wx containers,compatible with 2.8)
Platform: Linux 3.13.0-24-generic x86_64, 64 bit, Little endian, wxGTK
Boost version: 1.54.0
         USE_WX_GRAPHICS_CONTEXT=OFF
         USE_WX_OVERLAY=OFF
         KICAD_SCRIPTING=ON
         KICAD_SCRIPTING_MODULES=ON
         KICAD_SCRIPTING_WXPYTHON=ON
         USE_FP_LIB_TABLE=HARD_CODED_ON
         BUILD_GITHUB_PLUGIN=ON
*/

This wishlist is specifically for PcbNew when creating and placing footprints.

It would be nice if there was a special string that you could use (e.g. VALUE**) so that the value field in the footprint is automatically populated from the part name upon placement.

This is so that you don't have to retype the footprint name in the value text field every time you create a new footprint (to be compliant with the Kicad Library Conventions).

This wishlist came about from a forum discussion here: https://forum.kicad.info/t/ref-val-text-substitution/2774/6

Revision history for this message
Novak Tamas (novak-7) wrote :

I think no need to use any special string: any Values given in eeschema goes through to footprint.

1 - in eeschema I place a component (e.g. 74xx - 74LS245) where Value=74LSD245, and Footprint=empty.
2 - I Edit component, in Fields I select Footprint, and Browse Footprint
3 - I browse to Housing_DIP - DIP-20_W7.62mm and push "Insert Footprint in board" button
4 - I close component edit window by OK
5 - I click Annotate schematic - Annotate - Close
5 - Click Generate netlist ...
6 - Start pcbnew and load/create pcb
7 - Click Read netlist...and place fine new DIP20 package.

When I edit this footprint, I have a "Reference=U1', "Value=74HC245".

If i start Footprint Editor and load footprint "Housing_DIP - DIP-20_W7.62mm", I see "Reference=REF**" and "Value=DIP-20_W7.62mm".
So Value is not "VAL**" or any other special string, still it will be replaced by Value from the netlist!!

So please tell us how to reproduce the issue?

Application: kicad
Version: (2016-04-22 BZR 6709, Git 5d6f8d1)-product, release build
Libraries: wxWidgets 3.0.2
           libcurl/7.46.0 OpenSSL/1.0.2d zlib/1.2.8 libidn/1.32 libssh2/1.6.0 librtmp/2.3
Platform: Windows 7 (build 7601, Service Pack 1), 64-bit edition, 64 bit, Little endian, wxMSW
- Build Info -
wxWidgets: 3.0.2 (wchar_t,wx containers,compatible with 2.8)
Boost: 1.57.0
Curl: 7.46.0
KiCad - Compiler: GCC 5.2.0 with C++ ABI 1009
        Settings: USE_WX_GRAPHICS_CONTEXT=OFF
                  USE_WX_OVERLAY=OFF
                  KICAD_SCRIPTING=ON
                  KICAD_SCRIPTING_MODULES=ON
                  KICAD_SCRIPTING_WXPYTHON=ON
                  USE_FP_LIB_TABLE=HARD_CODED_ON
                  BUILD_GITHUB_PLUGIN=ON

Novak Tamas (novak-7)
Changed in kicad:
status: New → Incomplete
Revision history for this message
Camilo Tejeiro (camilo-tejeiro) wrote :

Hi Novak, Thanks for replying.
The desired behavior is not to related to value replacement from Eeschema (this is already supported).

The desired behavior involves solely PcbNew functionality. It would be nice to have a variable that you could use (e.g. Value**) that automatically gets replaced with the footprint name (i.e. the .kicad_mod filename) as soon as you place the footprint on the board.

Here is a use case with the desired behavior, let say I am building a new transistor footprint in PcbNew:
1. I draw the footprint, i.e. I Place pads, draw the assembly, silkscreen layers ...etc
2. I define the footprint properties (Edit -> edit properties):
- Reference = Ref** (this will be replaced by RefDes from schematic) - This works fine.
- Value = Val** (should be replaced with footprint name from .pretty library) - This is not supported.

This means I have to type Value = SOT-23_BC817-40LT3G by hand. However this information is already available as the footprint name so it could be auto-replaced.

I hope this makes sense. Let me know if it doesn't, I could try to clarify.

Revision history for this message
xzcvczx (xzcvczx) wrote :

but i don't want all my resistor values replaced by 0603, nor do i want my value replaced with QFN-32 for example, With the way the footprints are seperated from the symbols in kicad a footprint != value

Revision history for this message
Camilo Tejeiro (camilo-tejeiro) wrote :

Ahh you are right, an oversight from my part: right now VAL** or %V is used to map to the "value" field from the schematic, this functionality is useful (e.g. for passive elements) and should be kept.

It would be a different variable available to the user, for example "FOOT**" or "LPAT**" or anything else for that matter. This would be extremely useful given that for a lot of footprint components the value field is the same as the footprint name.

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

There is a misunderstanding.
The value field text will always be replaced by the component value text.
VALUE** is a dummy text. Regardless its value, it will be replaced.

"This is so that you don't have to retype every time you create a new footprint"

Obviously, the footprint name must be entered, but only once.

You just have to type (not retype) the footprint name in the value text field.
It will be the default file name when saving the new footprint.

Revision history for this message
Camilo Tejeiro (camilo-tejeiro) wrote : Re: [Bug 1570120] Re: Wishlist: Automatic value field substitution when creating footprints

Ok I think I know why I am running into this problem.

When I want to create a new footprint based on an existing footprint, I
do as follows:

* Select an active library.
* Load reference footprint from active library (Load footprint from
library).
* Save footprint in active library (Ctrl+S).
* Prompt asks me to save footprint with a new name: I change the name.
** A copied footprint is created with a new filename. However the value
field remains with the old footprint value, So I have to re-type it**

What works:
* When I create a new footprint from scratch (New Footprint), it asks me
for a new name and the value field is updated automatically to reflect
the footprint name.
* Saving footprint in a new library, importing or exporting keeps the
old filename so the value field remains unchanged.

Other notes:
If you use VAL** or %V in the footprint value field. It does gets
replaced from the schematic component value field whenever the netlist
is read in PcbNew.

A couple of options:

1. When creating a new footprint based on an existing footprint, the
value field is updated with the new filename accordingly.

2. If a different variable existed (FVAL**, LVAL** ...etc), and
footprint creation defaulted to this variable in the value field (the
way the REF** variable works currently for the Reference field) then one
could simply forget about the value field for most cases (no typing
involved) as it will be replaced with the footprint filename during
board placement. Of course if you want something different in the value
field, simply remove (FVAL** or LVAL**) and put whatever you want.

Just some ideas, let me know what you think.

On 05/28/2016 11:28 PM, jean-pierre charras wrote:
> There is a misunderstanding.
> The value field text will always be replaced by the component value text.
> VALUE** is a dummy text. Regardless its value, it will be replaced.
>
> "This is so that you don't have to retype every time you create a new
> footprint"
>
> Obviously, the footprint name must be entered, but only once.
>
> You just have to type (not retype) the footprint name in the value text field.
> It will be the default file name when saving the new footprint.
>

--
Camilo Tejeiro
Be honest, be grateful, be humble.
https://www.linkedin.com/in/camilotejeiro
http://camilotejeiro.wordpress.com
http://osohm.org/

Revision history for this message
Novak Tamas (novak-7) wrote :

Still not clear, if that makes sense.
Most of the standard footprints (SO, SOT, DIP, LQFP, TQFP, SMD-RC...) are shared among a lot of schematic components . Only a few specific parts (like switches, connectors) have a unique footprint, where the footprint's name worth to be the part's own name.

Let's assume, I have a new PicoBlade connector Molex 53261-0471, which probably has a unique footprint. My workflow is:
1 - I create the footprint in Footprint Editor. Value="Molex_53261-0471" and Reference="CN?"
2 - in eeschema I place a conn lib / CONN_01X04 connector
3 - I fill the Value with "Molex_53261-0471" (yes, I need to type it again)
4 - I select Footprint "Connectors:Molex_53261-0471" previously created for the connector.

The order will be 2 - 3 - 1 - 4 when I forget to create footprint in advance.

It rarely happens, that I place a footprint in pcb_new what does'nt have the corresponding eeschema part (e.g. mounting holes), but no significant names for those footprints.
Parts' typenames are *always* come from schematic parts' Value field, through the netlist.
I can't find any reason for automatic filling footprint's Value with its name.

@Camilo, would you describe a case in details, when it makes sense?

Revision history for this message
Camilo Tejeiro (camilo-tejeiro) wrote :
Download full text (3.5 KiB)

@Novak, see my answers below:
> Still not clear, if that makes sense.
> Most of the standard footprints (SO, SOT, DIP, LQFP, TQFP, SMD-RC...) are shared among a lot of schematic components . Only a few specific parts (like switches, connectors) have a unique footprint, where the footprint's name worth to be the part's own name.
Makes sense. In my case I mostly re-use schematic components, I try not
to re-use footprints (except for standard passives) because different
manufacturers often recommend slightly different land patterns (even for
standard packages) and I like to stick with their recommendations
instead; to be completely safe and avoid having the board come back wrong.
> Let's assume, I have a new PicoBlade connector Molex 53261-0471, which probably has a unique footprint. My workflow is:
> 1 - I create the footprint in Footprint Editor. Value="Molex_53261-0471" and Reference="CN?"
> 2 - in eeschema I place a conn lib / CONN_01X04 connector
> 3 - I fill the Value with "Molex_53261-0471" (yes, I need to type it again)
> 4 - I select Footprint "Connectors:Molex_53261-0471" previously created for the connector.
>
> The order will be 2 - 3 - 1 - 4 when I forget to create footprint in
> advance.
>
> It rarely happens, that I place a footprint in pcb_new what does'nt have the corresponding eeschema part (e.g. mounting holes), but no significant names for those footprints.
> Parts' typenames are *always* come from schematic parts' Value field, through the netlist.
> I can't find any reason for automatic filling footprint's Value with its name.
>
> @Camilo, would you describe a case in details, when it makes sense?
Here is my workflow (e.g. for BC817-40LT3G - NPN BJT):
1. Create a new footprint in footprint editor.
Value="SOT-23_BC817-40LT3G" (i.e. same as footprint name/filename) and
Reference="REF**"
2. In eeschema, from my own library I place a
Bipolar_Transistors_BJT_Single lib / Q-NPN-BEC
3. I annotate schematic components (e.g. Reference="Q1")
4. I run CvPcb to associate components and footprints. I select the
SOT-23_BC817-40LT3G and save footprint association.

In eeschema if I were to open the component properties for the
transistor it would look like:

Reference: Q1
Value: Q-NPN-BEC
Footprint: ON_Semiconductor_Bipolar_Transistors:SOT-23_BC817-40LT3G

Here is a snapshot:
https://dl.dropboxusercontent.com/u/44438953/eeschema_component_properties.png

Note that: in eeschema I only modify the footprint field, either through
CvPcb or directly through the component properties menu (as recommended
in the KiCad docs, "KiCad workflow
<http://docs.kicad-pcb.org/en/getting_started_in_kicad.html#kicad-work-flow>").
I don't modify the Value (except for passives) as this is a property of
the schematic component and is unrelated to the footprint, though I can
see how overwriting this field works for you.

So, It would be nice if you could do this in the PCB footprint editor:
https://dl.dropboxusercontent.com/u/44438953/footprint.png
https://dl.dropboxusercontent.com/u/44438953/footprint_properties.png

Such that, for footprints where the value is just the footprint name
(e.g. SOT-23_BC817-40LT3G), you can have the text auto-replac...

Read more...

Revision history for this message
Camilo Tejeiro (camilo-tejeiro) wrote :
Download full text (4.0 KiB)

Actually, the footprint name *is* available in the netlist read by
Pcbnew (of course, it has to be), so it is possible. Still only worth it
if it is useful to others.

On 06/09/2016 03:41 PM, camilo tejeiro wrote:
> @Novak, see my answers below:
>> Still not clear, if that makes sense.
>> Most of the standard footprints (SO, SOT, DIP, LQFP, TQFP, SMD-RC...) are shared among a lot of schematic components . Only a few specific parts (like switches, connectors) have a unique footprint, where the footprint's name worth to be the part's own name.
> Makes sense. In my case I mostly re-use schematic components, I try
> not to re-use footprints (except for standard passives) because
> different manufacturers often recommend slightly different land
> patterns (even for standard packages) and I like to stick with their
> recommendations instead; to be completely safe and avoid having the
> board come back wrong.
>> Let's assume, I have a new PicoBlade connector Molex 53261-0471, which probably has a unique footprint. My workflow is:
>> 1 - I create the footprint in Footprint Editor. Value="Molex_53261-0471" and Reference="CN?"
>> 2 - in eeschema I place a conn lib / CONN_01X04 connector
>> 3 - I fill the Value with "Molex_53261-0471" (yes, I need to type it again)
>> 4 - I select Footprint "Connectors:Molex_53261-0471" previously created for the connector.
>>
>> The order will be 2 - 3 - 1 - 4 when I forget to create footprint in
>> advance.
>>
>> It rarely happens, that I place a footprint in pcb_new what does'nt have the corresponding eeschema part (e.g. mounting holes), but no significant names for those footprints.
>> Parts' typenames are *always* come from schematic parts' Value field, through the netlist.
>> I can't find any reason for automatic filling footprint's Value with its name.
>>
>> @Camilo, would you describe a case in details, when it makes sense?
> Here is my workflow (e.g. for BC817-40LT3G - NPN BJT):
> 1. Create a new footprint in footprint editor.
> Value="SOT-23_BC817-40LT3G" (i.e. same as footprint name/filename) and
> Reference="REF**"
> 2. In eeschema, from my own library I place a
> Bipolar_Transistors_BJT_Single lib / Q-NPN-BEC
> 3. I annotate schematic components (e.g. Reference="Q1")
> 4. I run CvPcb to associate components and footprints. I select the
> SOT-23_BC817-40LT3G and save footprint association.
>
> In eeschema if I were to open the component properties for the
> transistor it would look like:
>
> Reference: Q1
> Value: Q-NPN-BEC
> Footprint: ON_Semiconductor_Bipolar_Transistors:SOT-23_BC817-40LT3G
>
> Here is a snapshot:
> https://dl.dropboxusercontent.com/u/44438953/eeschema_component_properties.png
>
> Note that: in eeschema I only modify the footprint field, either
> through CvPcb or directly through the component properties menu (as
> recommended in the KiCad docs, "KiCad workflow
> <http://docs.kicad-pcb.org/en/getting_started_in_kicad.html#kicad-work-flow>").
> I don't modify the Value (except for passives) as this is a property
> of the schematic component and is unrelated to the footprint, though I
> can see how overwriting this field works for you.
>
> So, It would be nice if you cou...

Read more...

Revision history for this message
Novak Tamas (novak-7) wrote :

Hmm. I see the differences of our workflows. The example is very good, as I have a "SOT-23-123" and "SOT-23-132" footprint, and I use one of them for every SOT-23 package (no distinguished pad sizes for different manufacturers). That's why I fill "Value" field with "BC817-40LT3G" when placing schematic component, and select "SOT-23-123" for footprint. I never run CvPcb.

It also follows the design logic, as I've selected the actual part (BC817-40LT3G) based on required Vceo, Ic, hfe, package, procurement possibility etc. *when I placed* the component.
It is not realistic that "I place a transistor of don't-care-the-parameters and later (when running CvPcb) I assign the type."

IMHO despite we both have (different) opinion, everyone should be able to work in his/her own style, so our wish:

Automatic copying of footprint name into Value should be a button on CvPcb's UI. It might happen for all selected parts (you can multiple select parts in middle pane for automatic Value filling).

What is your opinion: should this go to wishlist?

Revision history for this message
Camilo Tejeiro (camilo-tejeiro) wrote :

Actually I think it could be simpler than this:

> Automatic copying of footprint name into Value should be a button on
> CvPcb's UI. It might happen for all selected parts (you can multiple
> select parts in middle pane for automatic Value filling).
>
> What is your opinion: should this go to wishlist?

Right now, there are variables that implement similar functionality
already. For example REF** and VAL** map to the "ref" and "value" field
from the netlist and are commonly used.

See a little netlist snippet here
<https://dl.dropboxusercontent.com/u/44438953/netlist_snippet.png>.

In the same way support for a new variable FOOT** could be added to map
to the "footprint" field in the netlist (omitting the library prefix).
Then users can make footprints using the REF**, VAL** or FOOT**
variables, or they can simply continue to use hard-coded strings
(depending on user's style/needs/library conventions ...etc). Also the
technical implementation would be very similar to what's already done
for mapping the REF** and VAL** variables (which makes it easier to
implement).

--
Camilo Tejeiro
Be honest, be grateful, be humble.
https://www.linkedin.com/in/camilotejeiro
http://camilotejeiro.wordpress.com
http://osohm.org/

Revision history for this message
Novak Tamas (novak-7) wrote :

I suppose there is a part in code, where new footprint's fields are checked against speciality strings like "REF**", and there could be a supplement of FOOT**

Changed in kicad:
status: Incomplete → Triaged
importance: Undecided → Wishlist
Revision history for this message
Camilo Tejeiro (camilo-tejeiro) wrote :

Great, thanks Novak,

On 06/14/2016 03:49 AM, Novak Tamas wrote:
> I suppose there is a part in code, where new footprint's fields are
> checked against speciality strings like "REF**", and there could be a
> supplement of FOOT**
>
> ** Changed in: kicad
> Status: Incomplete => Triaged
>
> ** Changed in: kicad
> Importance: Undecided => Wishlist
>

--
Camilo Tejeiro
Be honest, be grateful, be humble.
https://www.linkedin.com/in/camilotejeiro
http://camilotejeiro.wordpress.com
http://osohm.org/

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

Saving a footprint in the library now checks the value to see if it used to match the name, and if so, updates it to the new name.

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

Fixed in revision 8a2639325d0ddb9fb78eb6f5fadddca72db4aeb0
https://git.launchpad.net/kicad/patch/?id=8a2639325d0ddb9fb78eb6f5fadddca72db4aeb0

Changed in kicad:
status: Triaged → Fix Committed
assignee: nobody → Jeff Young (jeyjey)
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.

Other bug subscribers

Remote bug watches

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