Is it possible to have a 3D model, relative path to custom footprint?


#1

I have created a custom footprint and 3D model, and would like to set a relative path between the footprint and the model, but using ./myModel.wrl etc doesnt see, to work.

Is there a way to do this.?


Per-project environment variables?
#2

try {KISYSPROJ}./myModel.wrl or perhaps {KISYSPROJ}…/myModel.wrl


#3

@Shack

Thanks for the suggestion, but I was hoping to put my 3D model in my custom libraries folder.

In this case the 3D model is very specific to the footprint and would not get used for any other purpose (as its a “BluePill” STM32F103C board), so linking it to the footprint would be the best outcome

Is there an env var for “path to parent symbol” ?


#4

Just add your own variables in the path settings found in kicad main window -> preferences -> configure paths.
Then add this path variable to the 3d model path of the footprint. (Your 3d path of your footprint starts with ${MY3dMOD}/
This would require a library setup where you have one directory where all your 3d model libs live.

Something like this :

  • my_3d_shapes (this is where MY3dMOD points to)
    • lib1.3dshapes
    • lib2.3dshapes
    • …

#5

OK…

So basically KiCad has no way to link a 3D Model to a footprint. :frowning:
Hence if I put my lib and footprint and 3D model in a repo in my github account, anyone who downloads them would need to mess around with setting up a path to them.


#6

as @Shack already pointed out the way is to use KISYSPROJ variable
have a look at here


#7

Hi Roger :slight_smile:

Yes, this is a deficiency in KiCad unfortunately. The only workaround I have is to tell prospective users to copy the 3d models to their KISYS3DMOD folder, which might also need admin access.


#8

Or tell them to copy them anywhere and have a custom path variable pointing there? That would not need admin rights and is easy to do from within kicad.


#9

Thanks guys

I will raise this as an issue on Github and see if I can rebuild the pcbnew and footprint editor sources myself to see if I can modify the code to address this deficiency

With a view to submitting a PR to get this into the official code

BTW.
If anyone could suggest ideas about this I would be interested, e.g some sort of ENV VAR which contains the path of the library etc, so that a relative path to the 3D model could be constructed ??


#10

Well the default setup has no local footprint libs. Which means there can not be a relative path from them. (Github plugin)

By the way: Did you look at the stuff posted by @maui? Because there is an environment var pointing to the project folder. There is also one pointing to the system directories.
And you can add your own path variables. What is missing for you? Why is your usecase not helped with any of the existing possibilities?

Also Github is not monitored (For the source code). Either submit your question to the mailing list or to the bug tracker.


#11

Rene,

I keep my custom libs in their own folder and simply added them using the library management system.

And because I specified a unique name for the footprint value in the schematic symbol, KiCad automatically found the footprint when I did the footprint association in the schematic editor.

IMHO it should be able to find matching 3D models e.g linkage between the Footprint and the 3D model in a similar way.

BTW.
I know that symbol -> footprint association has always been an are of contention with KiCad… So I guess this will be the same


#12

I posted a “bug” report as an enhancement

https://bugs.launchpad.net/kicad/+bug/1717735

(Yes I know I have a typo in the title, but there does not seem to be a way to edit this :frowning:


#13

You forgot the third option. Custom path variable. (Everything you describe in your bug report is fulfilled by this option. So you might want to make it clear in your report why this does not work for you. Otherwise the developers will tell you the same thing as i do here.)

And there is even a forth option. Moving the system 3d models to the user space and point KISYS3DMOD there. (Allows you do add your libs without admin rights without the need for a custom path variable.) This can be done via the 3d shapes downloader or by downloading the 3d models by hand and editing the path variable by hand.


#14

@Rene OK

I don’t think using KISYS3DMOD is ideal because if I wanted to use some built in KiCad models as well as my own library models I would have to copy all the KiCad built in modules into my library folder.

But merging custom / user models seems less than optimal, and is akin to saying all user applications must be copied into the system folder or vice versa


#15

I don’t think suggestions from Rene cam through so I will try in my own words:

You can use your own environment variables which hold the path to your own libraries. This will probably require you to change how your libraries are set up.

Anyhow using your own enviroment variables such as:
ROGER_CLARK_3D_MOD and ROGER_CLARK_MOD you can setup your own libraries and fp-lib-table entries. The fp-lib table entries should use ROGER_CLARK_MOD to point to the modules library while each module should use ROGER_CLARK_3D_MOD to point to its own 3D file.

This setup makes your module and 3D module library completely portable (for everybody who does not use the same environment variables for different purpose), so when you share the project you can share the library and person on receiving side should be able to use 3D files without any modifications (modules are already cached within the pcb file).

If you do not whish to share complete library there is always an option to write a script which scans your PCB file for 3D file references, copies the files into subfolder within the project and replace the reference such that it uses KISYSPROJ enviroment variable. (hmm this looks like a job for an Action plugin)

Only symbols libraries are somewhat difficult to share as you need absolute path. But usually it is one file only, so this not a big issue. Until v5 resolves this.


#16

have same problem, I’ve created my own set of libs/modules and its quite convenient to keep 3dmodel in subfolder of module than mirroring whole folder structure for 3dmodels

using builtin kisys3dmod increases mess for me, creating my own globalvar (and mirroring whole structure) is quite weird

relative paths in other case works in Kicad, so why not here?


#17

It’s still unclear to us why custom path substitution variables wouldn’t work.
add3d

Create your own variable (use Configure Paths). Add 3D shape. Use your own variable instead of KISYS3DMOD.


#18

because when you move it between directories eg. you change idea where it belongs
or you share link with sb, then you need additionally inform about global paths and update them in txt files (beacuse GUI sucks in most cases;/)

its not critical, after one hour with kicad you know about globalvars;] but it is really so complicated? and everyone use solution which prefer

btw I get rid with default libs/modules filtered them and make my own set of libs/modules and use one custom global var for all of it, and point all relative to it, its best for me that i invent

btw2 from what veriosn is screen which you upload?


#19

pre-5. I didn’t remember to check if everything is available in v4. It seems that Configure Paths isn’t in v4, it must be done elsewhere.


#20

What do you mean by “move it between directories”? Could you share a detailed use case with locations of relevant directories and files and environment variables?