Force all WRL to STP as default

What is the simplest way to force change all KiCAD WRL references to the KiCAD STP references instead?

WRL is a major time waste for me because when I export it must be in STEP for inclusion in programs like Fusion360. WRL serves no function at all, exported STEP have nothing but vacant pads. Sure WRL is fancy graphics to someone, maybe an artist, but not a developer, or a machine shop.

I need a way to quickly find and purge references at software update. It is a nuisance to have to copy over the footprint from it’s official install location into my own documents every time, one at a time, then manually locate the official STP saved right where the WRL is saved, but without any pointer to the the STP. I might as well be downloading fresh footprints and models since no time is saved with the built in. Unless I can force the switch at install/update.

I know this is probably like arguing to Fusion360 developers that their DXF is a trouble maker exporting 9 images in a compressed file, that makes older programs like Autocad2000 (used by machine shops) to see nothing but crisscrossing lines.

Unfortunately in the real world we don’t all have the latest and greatest so finding a way to develop forward but export backward is a requirement.

I hereby certify that I am not simply asking someone else to design a footprint for me.

This is an auto-generated message that is in place on the “footprints” section of the KiCad.info forum. If I remove it and ask for a footprint to be designed anyway, I understand that I will be subject to forum members telling me to go design my own footprint or referring me to a 3rd party footprint site.

.kicad_pcb files are just text files, so you could search and replace all .wrl strings to .stp. Take a backup copy first of the file.

If you’re using the KiCad step exporter, make sure you have the “substitute similarly named models” option checked. Any footprint in the KiCad libraries that has a WRL model will also have a STEP model, but it won’t get exported unless that option is checked.

2 Likes

I have seen in the files yes that the the models are normally in pair. But for reasons I am not familiar the WRL is the ONLY file names in the footprint. So to use the STP it must be changed manually and re saved outside the KiCAD files. I will test and see about the similar named files thing, and report back if that was a solution.

–edited a bit–
When I converted my library to database-driven last year I also took the opportunity to flush all the wrl files and just leave step 3d files. Here are a couple of handy linux command lines I used.

Removing the wrl files is easy enough, but all of the .kicad_mod files in the footprint dir may need to change. There is a “model” definition at the bottom of each file; for example:

(footprint "C_ceramic_0402_(m1005)" (version 20221018) (generator pcbnew)
  (layer "F.Cu")
  (descr "Capacitor, ceramic, 0402")
(blah, blah)
  (model "${KICAD_USER_3DMODEL_DIR}/C_ceramic_0402_(m1005).wrl"  <<<< change to .step
    (offset (xyz 0 0 0))
    (scale (xyz 1 1 1))
    (rotate (xyz 0 0 0))
  )
)

Make a copy of your footprint dir before you do this (just in case). From your linux terminal, change to the …/footprints dir of your personal library and run the following command to edit every file in the dir, replacing the text “wrl” with “step.”

To replace ‘wrl’ with ‘step’ in all files in dir:

$ find . -maxdepth 1 -type f -exec sed -i 's/wrl/step/g' {} \;

where, for find:
    . means start in current directory
    -maxdepth 1 means no sub-dir recursion
    -type f means only looking for files, not directories
    -exec to execute following command
    {} placeholder represents each filename
    \; escaped-semicolon is used to indicate the end of the parameter list
where, for sed:
    -i is in-place (save back to the original file)
    s is substitute
    g is global (replace all and not just the first occurrence)

Also, to find all files in dir that contain ‘wrl’:

(which you can do before and after the above edits, just to verify)

$ find . -maxdepth 1 -type f -exec grep -E 'wrl' {} \;

where, for find:
    . means start in current directory
    -maxdepth 1 means no sub-dir recursion
    -type f means only looking for files, not directories
    -exec to execute following command
    {} placeholder represents each filename
    \; escaped-semicolon is used to indicate the end of the parameter list
2 Likes

Some powerfull tips. Thank you.

Running on Windows at this time. Sorry. Though have absolutely run under both in days past.

Your first instruction, is that command line in Windows or directly from KiCAD?

I just gave the topic below an upvote (Current count is now 5):

I think WRL support was added long ago because the used libraries could not handle transparency and colors for STEP models, but that has improved over the last few years.

3D models (in two formats) are also around 90% of the size of a complete KiCad installation, and when I read that WRL does not even support units related to any real life measurements (KiCad Stepup applies some weird scaling factor to generate WRL models compatible with KiCad) I almost fell of my chair.

Those are linux shell commands. I don’t know a win shell alternate, but perhaps someone here does. I will edit my above post to tidy up. thanks

Yes I have read over and over that WRL is supported because it does things that STEP cannot. Like Transparency, but then we run into issues of support like that Autodesk is the Juggernaut in the engi8neering world and they refuse to support WRL, they wont even import it. At least in any product I use. I didn’t know about it not supporting dimensional accuracy.

What concerns me is the issue of the overwhelming demand to use WRL for artistic purposes. But seriously how many of us, use KiCAD to make museum art?
If there is a greater issue it is that some of the developers dont understand why WRL is a problem and why it should not be the default, and exemplified by the comment from jean-pierre charras ¡ GitLab. Thankfully there are voices like kliment ¡ GitLab, who pointed out why we need STEP.
EDIT: And I can confirm, yes I did misunderstand his post. I had to read that one specific reply several times. But I see I was mistaken in interpreting his reply for a defense of WRL.

If size of download is an issue, then why not just make the two formats their own download? I don’t care if they are otherwise dedicated to the same directories. Let each KiCAD sourced footprint come with both addresses predefined and whichever one is available will render as apposed to current where ONLY WRL is defined, and all files are downloaded regardless.

The topic itself as posted is a little concerning as I don’t have a internal need to decide for others what they should use. Just to gain the tools that I need to get work down, and if it helps others, great.

I see you removed the first section. Honestly I would have left it in place just add clarification that it was a Linux command. I might not be able to use it directly, but others who visit the topic might.

Some good info in this FAQ if you haven’t seen it already . . .

You should rather assume you misunderstood what was written. The developer you mentioned seems to be aware of the issues involved. The point was whether the WRL files should be removed from the official KiCad library or not. Then there were several details about default behavior etc. in that discussion (in the issue linked to by Paul), but I didn’t see real disagreements about them.

FYI - I recently upgraded to v7.0.10 and finally got around to do some Kicad file/setup cleaning. I’ve done this enough times (from v4 thru v7) such that it’s very quick to do and includes my resetting the Footprints and Symbols. The result’s are:

• Loads Footprints and Symbols instantly, Zero time (you know, that pop-up message with Time counting while loading). Not enough time for it to even pop-up now.

What I did:
• Deleted 1.4 Gig’s of .WRL files (I never use them)
• Disabled Footprints and Symbols I never use
• Bulk changed All links in Footprints from .WRL to .STEP (one-click and done)
• Bulk changed All Project PCB’s to ensure using .STEP and Not .WRL (one-click and done)

When you say bulk changed, this is what I am looking for, what did you do that could be done at install to make a change?


image

Not quite the same window

Tested Export with option checked. No change. No STEP files loaded. Exported object is a barren PCB save only for footprints manually edited to include reference to STEP.

I am pretty sure that as recent as V6, footprints did include reference to both WRL and STEP but now under V7 it is WRL only. I think it is clear the Developer Artists won the argument ignoring the Developer Engineers.

I also just noticed that no traces exported as part of the model. I guess they are also WRL? I mean I don’t need them for fit check but I am pretty sure they had been modeled on STEP exports prior.

They never have been as far as I know (in STEP), it is an option in V8 though

1 Like

Assuming a User has some programming skill (could be done in any programming language):

• Either Run Code from IDE or from homegrown App
Code/App to do Search and Replace (via walking through the DIR)
(I Place a Dummy Footprint in Kicad’s Shared Support>footprints, and a Dummy PCB in my Project DIR to start the Walking through all folders/files)

• Can do for Symbols, if that’s needed

Assuming a User has No or, only Minimal programming skill:

Some options:

  • Use the Terminal and Commands to do it (search for Commands for your System (Mac, Window, Linux)

  • Search for "Search and Replace: Python code (you’ll get many with examples)

    • Can Run code from any Python IDE

• You may have a Text-Editor that will do it

I made an App to do it (for Mac) screenshot below. I suppose I could spend a few minutes to produce one for Win/Linux…

2 Likes

Sorry, but it is clear you don’t know what you are talking about.

FWIW, I tried STEP export from v7 and 8.0.0-RC1 (release candidate for the soon to be released v8). In both of them the official KiCad footprints have only .wrl file names in footprint “3D Models” properties, and both exported them fine to STEP which I opened with FreeCAD. This just required the “Substitute…” checkbox ticked.

1 Like

Wow the salt. There are no “developer artists” on the team, I’m serious, we usually don’t take amusement in people trying to abuse PCBs as art projects :stuck_out_tongue:

V6 never had STEP files in the model paths, the substitute checkbox in the export dialog was all that was required.

The screenshot I took was from v8. The Substitute checkbox is supposed to do the same.

Does the export log not show mentions of substituing step files for WRL? It is going to for each file it substitutes.

1 Like