yaqwsx / KiKit

Automation tools for KiCAD
https://yaqwsx.github.io/KiKit
MIT License
1.55k stars 201 forks source link

Add the option to relabel the component names such that they are unique #619

Closed bem22 closed 10 months ago

bem22 commented 12 months ago

Prerequisites

Description

When using OpenPnP, it would be great if the .pos file generated by KiCad after panelization with KiKit had unique ids.

The new boards are "generated" with KiKit so I think this is the point where the parts could receive new names?

yaqwsx commented 12 months ago

Could you provide (even a simple) example? What are "IDs"? References? Making the references unique across panels is not a good idea, as it will also change the silkscreen.

Generally, I am familiar with two workflows (on industrial machines):

Please, describe your use case more in detail. Then we can design the feature appropriately.

bem22 commented 12 months ago

Hello,

Thank you for responding to my request.

My use case is the second workflow you described. I have PCBs on a panel with fiducials on a frame.

I understand the limitation with the references affecting the silkscreen - I thought there could be a workaround.

Unfortunately, OpenPNP complains about having the same reference for components: for example C1 in this file

panel-top.zip

In OpenPNP the references from KiCad are turned into IDs and they need to be unique. They are generated from the Ref column.

Ideally, I would run a script to make the Ref's unique in the file after exporting a panelized board .pos file so OpenPnP can work with it.

I'm attempting to create this script myself but I was wondering if there's already an integrating workflow for this.

yaqwsx commented 12 months ago

In that case, I think what we need is to have kikit fab openpn that renames the components such that their references are unique. If OpenPNP can handle arbitrary strings, I suggest something like board-{n}-{originalRef}.

bem22 commented 12 months ago

OpenPNP can handle arbitrary strings. I tested this yesterday

bem22 commented 12 months ago

image I would assume this is the part of the file that is interesting for parsing.

This gives the position, the Reference and the package.

What would be the workflow to integrate this into KiKit? And I assume this is python?

yaqwsx commented 12 months ago

You missed my point - we shouldn't change how we build the panel. We should provide specialized fabrication output for OpenPNP.

bem22 commented 12 months ago

I got that. I meant what would the workflow to implement this be?

Also, what would be the design workflow?

After the penalization is done do you want KiKit to work by itself or is generating a .pos file by KiCad acceptable and then KiKit operates on it?

Would generating the .pos file outside KiCad (but by KiCad) be possible and is this action triggerable by KiKit?

Otherwise - there are some other formats OpenPNP would accept, but I think .pos file format is very sensible and would integrate well with the single-kicad-pcb-to-openPNP workflow.

Screenshot 2023-12-03 211320

P.S (yes that's my bottom vision, and yes that is my ceiling, thanks for asking :sweat_smile: )

bem22 commented 11 months ago

One question, what does "renameRefs" function do exactly?

yaqwsx commented 11 months ago

renamenet, renameref: A pattern by which to rename the nets and references. You can use {n} and {orig} to get the board number and original name. Default values are Board_{n}-{orig} for nets and {orig} for references. (https://yaqwsx.github.io/KiKit/v1.4/panelization/cli/#layout)

bem22 commented 11 months ago

This should... in principle solve my request?

I'll check it out today.

yaqwsx commented 10 months ago

OpenPNP fabrication output was added in db18615