Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] variable expansion problem when using NET_NAME #511

Closed
laurencedv opened this issue Oct 24, 2023 · 1 comment
Closed

[BUG] variable expansion problem when using NET_NAME #511

laurencedv opened this issue Oct 24, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@laurencedv
Copy link

I am trying to build a kibot configuration to generate documentation for test-jigs, as such I need to filter to only select some parts like test points. The filtering works, but I also use variable expansion in the value field of the testpoint itself to store which nets is connected to the testpoint.

Describe the bug
The variable expansion in the value field seems to not work when kibot filters for some parts

To Reproduce
I attached a barebone project highlighting the behavior: varexpansion.zip

filter used

filters:
  # Select only testpoints
  - name: "only_tp"
    type: generic
    comment: "Select only testpoints"
    include_only:
      - column: References
        regex: '^[t,P][p,P]\d+'

output defined

  - name: tp_pos
    comment: "filtered parts list"
    type: position
    options:
      output: "%f-%r-%i-tp-flt.%x"
      format: ASCII
      only_smd: false
      use_aux_axis_as_origin: true
      separate_files_for_front_and_back: true
#      pre_transform:
#        - "expand_var"
      dnf_filter:
        - "only_tp"
  - name: tp_pos_noflt
    comment: "no filtering"
    type: position
    options:
      output: "%f-%r-%i-tp.%x"
      format: ASCII
      only_smd: false
      use_aux_axis_as_origin: true
      separate_files_for_front_and_back: true

Expected behavior
In the output folder of kibot you can see both resulting position files one with the actual netname expanded (not filtered) and one with the variable calls (filtered). In a real project where there is a lot of other parts, I need to filter for only relevant parts and also need the variable to be expanded. Maybe there is a boolean I missed somewhere to enable post-filtering expansion but I can not find it :/

Unfiltered result (variable correctly expanded)

### Module positions - created on Tue 24 Oct 2023 05:46:38 PM  ###
### Printed by KiBot
## Unit = mm, Angle = deg.
## Side : top
# Ref   Val       Package   PosX      PosY      Rot        Side  
TP1     /mytest   TP_1mm    18.4000   22.6000   0.0000     top   
## End

Filtered result (variable not expanded)

### Module positions - created on Tue 24 Oct 2023 05:46:38 PM  ###
### Printed by KiBot
## Unit = mm, Angle = deg.
## Side : top
# Ref   Val              Package   PosX      PosY      Rot        Side  
TP1     ${NET_NAME(1)}   TP_1mm    18.4000   22.6000   0.0000     top   
## End

Screenshots
SCH:
image

PCB:
image

Environment (please complete the following information):

kibot-check
KiBot installation checker

Core:
Linux: 5.15.0.87 (Linux asgard 5.15.0-87-generic #97-Ubuntu SMP Mon Oct 2 21:09:21 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux)
Python: 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]
KiCad: 7.0.8-7.0.8~ubuntu22.04.1
Kibot: 1.6.3

Modules:
Colorama: 0.4.4
LXML: 4.8.0
Lark: 1.1.1
PyYAML: 5.4.1
QRCodeGen: Ok
Requests: 2.31.0
XLSXWriter: 3.0.2
Xvfbwrapper: Ok
markdown2: 2.4.1
mistune: 3.0.2
numpy: 1.21.5

Tools:
Bash: 5.1.16 (GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu))
Blender: Not available
Ghostscript: 9.55.0
Git: 2.34.1 (git version 2.34.1)
ImageMagick: 6.9.11.60 (Version: ImageMagick 6.9.11-60 Q16 x86_64 2021-01-25 https://imagemagick.org)
Failed to run /home/laurencedv/.pyenv/shims/python3, error 1
Interactive HTML BoM: *UNKNOWN*
KiBoM: 1.9.0 (KiBOM Version: 1.9.0)
KiCad Automation tools (kiauto): 2.2.8 (pcbnew_do 2.2.8 - Copyright 2018-2023, INTI/Productize SPRL - License: Apache)
KiCad PCB/SCH Diff (kidiff): 2.4.7 (kicad-diff.py 2.4.7 - Copyright 2020-2023, INTI/Salvador E. Tropea - License:)
KiCost: 1.1.18 (KiCost v1.1.18)
KiKit: 1.4.0.1 (kikit, version 1.4.0-1)
OpenSCAD: 2021.1.0 (OpenSCAD version 2021.01)
Pandoc: 2.9.2.1 (pandoc 2.9.2.1)
RAR: 5.50.0 (RAR 5.50   Copyright (c) 1993-2017 Alexander Roshal   11 Aug 2017)
RSVG tools: 2.52.5 (rsvg-convert version 2.52.5)
Xvfb: Ok (xvfb-run)

Additional context
In the same project I added an ibom output but it always fail on downloading the ibom extension from your fork. I don't want to mix up two problem, but opening an other bug report for a user error seems high energy for everybody, so my question is this, is it supposed to work currently with latest stable kicad from ubuntu repo and your repo? if so I'll open up another bug report on it.

And thanks a lot for your awesome tool, it is a life saver for complex production board in this chip-apocalyse time!

@set-soft set-soft added the enhancement New feature or request label Nov 8, 2023
@set-soft set-soft changed the title [BUG] variable expansion not working after dnf filtering Footprint specific variable expansion not working after dnf filtering Nov 8, 2023
@set-soft set-soft changed the title Footprint specific variable expansion not working after dnf filtering [BUG] variable expansion problem when using NET_NAME Nov 8, 2023
@set-soft set-soft added bug Something isn't working and removed enhancement New feature or request labels Nov 8, 2023
@set-soft
Copy link
Member

set-soft commented Nov 8, 2023

Hi @laurencedv !

This is a very specific case. The problem is that this expansion is local to the component, so you can't get it using the expand_text_vars filter. At the same time KiCad lacks an API for the schematic, so we get the bare Value name.

I'm adding a workaround that reads the value from the PCB (when available). Should fix the problem for this use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants