New tool auto-rotates components in PnP files to match fab, panelizes PnP data - Page 1
Forum section: electronics / general

author: pastaclub
author_rank: Regular Contributor
timestamp: March 30, 2021, 07:18:44 am
content: I've developed a free open source tool to make life easier from exporting pick&place data to getting boards fabricated. Here's an excerpt from the description:PnPPP - Pick & Place Pre-ProcessorPnPPP is a tool for automatically converting PCB assembly files to the format required by your fab or machine, automatically rotate parts to the correct orientation and duplicate pick-and-place data with new positions for the purpose of panelization. All required meta data can be maintained directly within the CAD project. The tool was developed to process output files from Altium CircuitStudio for use with JLCPCB's self-service PCBA interface, but it can be configured flexibly and potentially be used with other CAD programs and different fabs.FeaturesParse and re-generate BOM (bill of materials) and PNP (pick and place) files in CSV formatContinuously scan sub directories of a given file path for changes and automatically process changed filesAuto-rotation: further rotate parts in pick-and-place file based on per-component setting in the BOM filePanelization: duplicate pick-and-place information with adjusted coordinates to generate PCB panels from a single boardRename, re-order and delete columns in BOM and PNP filesRemove extra lines not conforming with the CSV format (what were you thinking, Altium?)Move output files to alternate destination pathAll meta data (for auto-rotation, panelization etc.) can be managed from within the CAD projectInput and output format customizable through a JSON config file (needed only once, not per project)Auto-RotationI frequently ran into the problem that orientation of a part in my library was different than what the fab expected. As a result, the rotation of the part was wrong in the fab's preview. There were two ways to fix this: either rotating the graphics in the footprint (which breaks the design) or manually editing the generated pick-and-place file (tedious, error-prone and needed to be done again everytime the files were re-exported).PnPPP solves this problem once and for all: it automatically rotates components as needed and generates a modified pick-and-place file in the format the fab expects. In order to do this, PnPPP first needs to know which components need to be rotated and by what offset. Other tools rely on seperate files cotaining that information... however, from a logical point of view, this information is associated with the definition of a component, so I found it more logical to manage it where the component is defined: in the schematic library itself. To achieve this, I am using a custom parameter named JlcRotation on every schematic symbol that needs rotation. This parameter is automatically added by PnPPP to the rotation of all instances of the respective component.Note that Rotation is a mandatory per-instance parameter (i.e. it can be different for each instance of a component on the PCB), while JlcRotation is an optional per-symbol parameter (i.e. it is set only once per each schematic symbol and applied to all instances of the part). CircuitStudio does not let users configure which fields to export as part of a pick-and-place file, therefore PnPPP pulls this information out of the BOM and then applies it on the pick-and-place data.So whenever you find the rotation of a part to be incorrect, you can simply open the schematic symbol in your library, add a JlcRotation parameter, and let PnPPP do the work. From then on, whenever you use the Generate outputs feature, PnPPP will know what to do and automatically fix your pick-and-place files, in your current project as well as in all future projects until the end of days.By the way: you don't have to use the name JlcRotation for the parameter. You can configure a custom parameter name in config.json so your library could even contain different rotation offsets for different fabs.PanelizationThe optional panelization feature in PnPPP enables you to automatically generate BOM and pick-and-place files for 1- or 2-dimensional PCB panels. If using this feature, PnPPP automatically duplicates all components multiple times and adjusts the position of the copies to accomodate for a panel with multiple instances of the same PCB. The meta-data required can be edited conveniently within your schematic file.This feature is useful if you want to manually panelize a PCB. While CircuitStudio supports embedded board arrays (which allows you to generate gerbers for a panel), CircuitStudio can still only export BOM and pick-and-place files for a single PCB and not the whole panel. This is where PnPPP comes in: it takes the files for a single PCB as an input and outputs files for the panel.In order to use this feature, PnPPP requires 6 values: the number of columns and rows, the x and y offset of the bottom-leftmost PCB within the panel and the x and y spacing between boards. Since it makes a lot of sense to maintain this information within the CAD project instead of an external configuration file, PnPPP retrieves this information from a single special item within the BOM, named PnPPP_Panel. It is recommended that you create a schematic symbol with the default designator PnPPP_Panel and the type Mechanical (which puts the item in the BOM but not on the PCB). You can then place this symbol in your schematic file and set its Comment to the comma-seperated 6 values.Check it out!See repository for more info:https://github.com/pastaclub/PnPPPAnd please let me know what you think!

author: SMTech
author_rank: Frequent Contributor
timestamp: March 30, 2021, 09:21:29 am
content: I haven't looked but this sounds like a very good idea for machines that don't have software that dos this for you (Essemtec does). If I ever work out how to use Github properly, I may chip in some time. One feature Essemtec is missing that people often use a 3rd party tool for on all sorts of machines is combining the BOM containing proper part numbers for each RefId with a pick and place field that might be missing any part numbers or values at all. The most common tool to use is a piece of Freeware called SMT-Maestro which no longer officially exists.

author: pastaclub
author_rank: Regular Contributor
timestamp: March 30, 2021, 10:12:21 am
content: For the ID of the components in the fab, I use a custom parameter per component and simply export it as a column of the BOM with no extra tool needed. That works fine with fabs like JLCPCB which have unique IDs that never change. If you need to manage feeder IDs of your own machine (which could be loaded with different parts depending on the project), a mapping tool can make sense. I guess I could easily extend PnPPP to do that as well, but so far I don't own a machine.P.S: You don't have to work out github, you can even just download a ZIP file of the repository.

author: SMTech
author_rank: Frequent Contributor
timestamp: March 30, 2021, 10:38:34 am
content: Quote from: pastaclub on March 30, 2021, 10:12:21 amExample pick and place file from CAD package:ID,X,Y,R,FootprintR1,2,5,180,C1608etcExample BOM:InternalPN;IDs;value,SupplierNo;ManufacturerNo11-27156-08;R1,R2,R3,R8,R11;270k;772-813; GRM270A016etcWhat the machine wants to importRefId;InternalPN; X;Y;RR1;11-27156-08;2;5;180etcOf course if its YOU who is generating the BOMs and place files you are able to include that data in the export from your CAD package. However when they are provided by a 3rd party they are often separate and the assembler needs to merge the two.QuoteI meant to contribute code etc properly, never got round to finding the time to learn all the terminology.As an assembler I would point out that for me at least I never want a panelised pick and place file, the machine does that for me.

author: Mangozac
author_rank: Frequent Contributor
timestamp: March 31, 2021, 12:14:56 am
content: This sounds quite cool but having to run it through npm is a pain and I suspect will turn off a lot of potential adopters

author: pastaclub
author_rank: Regular Contributor
timestamp: March 31, 2021, 07:52:12 am
content: @SMTech: so you simply want to use a column (ID) from the PNP file, look it up in the BOM and put another column from the identified line (InternalID) back into the PNP file? That would be very easy to implement, since PnPPP already does almost the same thing for the auto-rotation. And renaming columns (ID -> RefId) is already a feature.

author: pastaclub
author_rank: Regular Contributor
timestamp: March 31, 2021, 08:20:09 am
content: Quote from: Mangozac on March 31, 2021, 12:14:56 amYou don't have to "run it through npm", you can simply run "node index.js" (that's all the npm start script does). But when you first install it, you still need npm to install the dependencies. Actually, what is the issue you see with npm?

author: Mangozac
author_rank: Frequent Contributor
timestamp: March 31, 2021, 09:31:53 pm
content: Quote from: pastaclub on March 31, 2021, 08:20:09 amIt's just another thing that has to be installed and built. I prefer not to.