STEP model cache, or, why is my model incorrect?


#1

I have a bunch of STEP models exported from FreeCAD 0.18. Sometimes, the 3D viewer in KiCAD shows incorrect colors for an assigned model. The attached example shows, in KiCad incorrect colors (grey red red gold).

When I re-check my STEP file in FreeCAD it shows the correct colors (grey red green gold).

Can someone else verify this behaviour? I thought this might be a cache issue, but I’ve cleared 3D-related stuff from %APPDATA%, and I’ve deleted the 3d model association, saved the footprint and library, restart KiCad and re-do the 3d model association - no luck :frowning: Paths are correct - I double-triple checked.

R_CC25_P10.16_H_8.2M.step (36.3 KB)



#2

Not an answer to your problem but i would argue if you care about resistor band colours then step is most likely not the correct file format to use:


#3

Hi Jules
Would be possible to share the STEP model with me?

Also, if you want give it away (resistor body with pins and ring), I can add it to my library and make you a new resistor color library.
Have a look:


#4

I’m sure it isn’t :slight_smile: I’ve started learning FreeCAD because of the mechanical modeling of pcbs in enclosures, for which I need accurate models. Hence STEP.

But you do remind me to try a .wrl export from FC and see if the colors are correct. I can open the STEP file in Notepad++, but haven’t attempted to delve into the color values (appear to be alpha, r, g, b on a 0-1 scale).

Then again, I ‘expect(ed)’ KiCad to show the STEP model as I’ve exported (and re-imported) them from FC with the correct colors. There’s just something odd going on and I’d like to know why - maybe it’s a bug. So what does your 3d viewer say?


#5

Hi!

I came across your library before - it looks very good! - but because I wanted to parametrically create my parts, I decided to go traverse the hard path and learn FC and do it all myself.

That being said, I will look through that thread and your lib for more inspiration. I remember coming across a few pdfs with some technical details about the 3d viewer and wrl coloring, lighting etc.

Also, are you offering to ‘fix’ my source file in the same manner you’ve generated your library? The STEP file is attached in the first post, let me know if you want to .FcStd file.


#6

I’m one of 3D Viewer developers, I’m offering that I will check if I can find any bug on 3D Viewer.
Also, if you want give me authorization for use your model, I can add it to my library and generate all the color ring references.


#7

This seems to be a KiCAD importing/rendering issue.
No problem with your step model in DSM

As @Rene_Poschl suggested above, as workaround you can use your FC model to generate both STEP & WRL files… then use wrl in KiCAD but place both in your 3d lib folder.
.step will be used for STEP exporting, but .wrl will be catch for KiCAD 3d viewer, keeping all colors.


#8

Sure, be my guest to use the file as you wish. Free/Open yaddah yaddah :wink:R_CC25_P10.16_H_Bands.FCStd (50.5 KB)

Upon further testing, I’m starting to see a pattern here: see the 4.7 and 5.6 series.

Edit: ugh, why doesn’t the reply button automagically include the comment I’m replying to :thinking:


#9

But the step model does not need the colours of the rings. Meaning this is completely unnecessary for this usecase.

This is why one typically has a wrl model for rendering (should one need it) and one for exporting to freecad or some other cad.
Remember that these rings add quite a lot of additional information to the step file. If you then include quite a few of them in your pcb and then for example have your pcb combined with other complex pcbs then you might discover that your mechanical cad program (freecad) will slow down quite a bit. So my tip: keep the step models simple but good enough to identify which parts they are (so a plain resistor without rings should do here)


#10

I am yet to see someone who does complex designs and still cares about the resistor ring colors.
That does not invalidate your warning in any way though.


#11

This suggestion of two separate files seems ridiculous to me. What a lot of extra unnecessary bother keeping things in sync.

If color wasn’t useful for MCAD, the STEP format would not support it. No need to make silly excuses for a kicad bug.


#12

because you missed the difference between WRL and STEP as posted above


#13

yeah, explain to me what exactly I need WRL for though.

I use STEP exclusively in KiCAD and Solidworks, and barring weird bugs like this one, it does everything needed. I don’t want some silly VR crap obscuring my real models.


#14

wrl allows you to define shader colours which is needed for making much more realistic renderings than you would ever get from the flat single colour model of step.
Also wrl is a surface mesh model which can be directly used by rendering engines and therefore allows much more complex models to render much faster. Graphics cards are also optimised for this (because games use this type of modeling)


Also note that we are not excusing kicads bug. We are telling the user that there simply is a difference in which format is best used for which usecase.


#15

Hi Jules,
Could you report a with that STEP file added and screenshots on https://bugs.launchpad.net/kicad/+filebug
I looked into the issue but I have no knowledge on the STEP standard so I couldn’t understand where the issue comes from.