Copy & paste assigned 3D models from one footprint to others

So I can assign a 3D model to a footprint and manually set all axis parameters so that the model is where it needs to be. That’s a lot of numbers. I have several of these identical footprints and all of them need the exact same 3D Model setup.

Will I have to take note of the file and all numbers on a piece of paper and repeat the same procedure for every single footprint? Or can I use some yet to be discovered copy/paste or other transfer command? Or should I manually patch the project files on disk to duplicate the model assignments? What’s the recommended strategy for this use case?

It is surprising.

None of my footprints are identical. What for to keep the same footprint in several copies?

Most of my 3D models have all numbers set to 0. Using Step-Up workbench in FreeCAD I open footprint and 3D model. Rotate and shift model correctly and then save as KiCad needed files.

Why is it surprising to have 16 of the same type of transistors? Or dozens of same-size resistors? Or in my case 8 of the same type of fuse holders (consisting of 2 models and a third for the fuse)? Now I’m surprised. Am I violating some component diversity rule here?

I haven’t seen any third-party STP file that would work with default orientation and placement. All of the models I found need at least 90° rotation in one axis, mostly two axes, and a lot of shifting around. Maybe you’re just using the very limited amount of models that come with KiCad. I’m talking about the models I need to add myself. The built-in ones are easy, there’s nothing to set up anyway.

I’m not using FreeCAD. Did the tutorial once and found it too complicated for my occasional use. And why would I when KiCad can do the alignment alone.

There are several ways to do what you want.

Some things to know:
• DIRectory = Folder
• By Default, all of your Footprint files are in the same Parent (top-Level) ‘footprints’ Directory
• Those files Tier-Down to specific footprint Folders and Files
• You can Change the Content of these files individually or, in Bulk
• Any Content is valid for changing, so be careful!

For only a small number of files, it would be easier to do Individually and the easiest way is by using a Text-Editor (they all have Search and Replace)

For doing it in a Bulk way (meaning, changing many files) there are some Choices, most useful being to use Code to do it.

Code, typically Python, can Walk through an entire Directory and change all files, thus, Use Caution!

To help ensure changing only what you want, it is helpful to include text from a String that is specific to the files and content (Footprints), thus avoiding unwanted changes.

This Demo Video shows using a Directory specific for this Demo But, most likely you’d want to do it on the Top-Level ‘footprints’ folder/Directory.

In my system, the Footprint file (called ‘.mod’ contains the Model, xyx positions at/near the bottom of the file.

The Video shows:
• Changing the root-path (you’ll want your path)
• The Text to search for to replace (R_1kΩ.step)
• The Replacement text (COFFEE)

Video shows verifying that Only the intended text was replaced (the Files in the Dir), nothing else was changed. I did Not change x,y,z positions or rotation angle… Could have done that just as easily.

Pay attention to what’s done in the Video.
Attached is the Python Code that should run on your system’s default Python. You can also run the Code from the Command-Line tool in Kicad’s PCB (need to learn how, Not shown in video)

The Code
GOLD_File_Contents_Search_Replace.py (1.4 KB)

Screenshot of the Files for the Video

It is not.

I have assigned 0603 resistor 3D model to my 0603 resistor footprint once (in 2017) and forgot it. No matter how many such resistors I use on a PCB, they all automatically have a 3D model.

When I have read FreeCAD KiCadStepUp Cheatsheet I didn’t understood (and I still don’t understand, even was tried to be explained) the reason why there is written that the only one of offsetting numbers in KiCad should be used and all other should be 0. So don’t knowing when it is wrong that these numbers are not 0 I decided to have them all being 0.

Limited use of FreeCAD is relative simple. But I have read that there are some problems when they updated from version 0.20 to 1.00 so I still have 0.20.

I was not doing it 2..3 years so don’t remember exactly but from StepUp I use one button to load footprint, second to load 3D file then probably using Move tools I shift rotate 3D model and then using one button I save it. I got 2 files (standard names as in KiCad 3D library).

When you align a 3D model in KiCAD you do it without any mechanical precision. It is just eyeballing.

To align a model precisely you need to know the real distance among the model, your footprint pads and PCB.

This can only be done having a mechanical kernel engine, as i.e. in FreeCAD.

KiCadStepUp is able to load KiCAD footprint in FreeCAD mechanical environment. When you align your model in FC, then your position related to KC footprint will be assigned to the origin of the footprint itself.

Then your values inside the footprint, when you will combine it with the exported 3D model, must be to set to 0,0,0 to keep the alignment.

The normal method is to assign the 3D settings to the footprint in the library. That way every instance you take out of the library already has all the 3D settings set properly.

In an ideal world translation and rotation is already handled in the footprint itself. This is even mandatory for KiCad’s own 3D libraries. See: KLC But the world is not perfect, so you have an option to add these parameters for your own models if needed.

2 Likes

This is the answer I understood the most. The footprint already comes with KiCad (“Fuse:Fuseholder_Littelfuse_445_030_series_5x20mm”), so I guess I would translate this to: I make a copy of the default footprint in a project-specific library, assign the models there and then use my own footprint instead of the default one, right?

PS: The library footprint comes with a model file name but that doesn’t exist. I think I’ve seen this more than once. Is it normal that KiCad’s footprints link to missing models?

Yes, correct.
KiCad’s own libraries are read-only because they can (and will) be updated / moved / during a KiCad update, and if you modified them, then your modifications will be overwritten. So if you want to make changes, you first put the footprint into a personal library. (Either project specific or global).

Yes this is normal. This allows for adding the 3D models later without having to change the footprint library itself.