KiCad native export vs KicadStepUp board import - step color missing

I have been racking my brain for the past few days trying to narrow down a problem. I’m afraid I’ll have to ping Mr. KiCad StepUp maui for some assistance :slight_smile: (or someone who knows more about the native KiCad STEP exporter, as I think there is a bug here). There might also be a FreeCad issue, but I thought I’d start here.

Background

I have been recreating STEP models in FreeCad 0.20.2, trying to make use of the new configuration tables feature.

Long story short, when I use the native KiCad STEP export to export the PCB, I always seemed to lose colors of my extruded Shapestrings which I use to add markings to parts.

I thought this had something to do with the fact that Shapestrings aren’t really part of the PartDesign workflow.

However, if I use the KiCadStepUp workbench in FreeCad to import the entire PCB, the colors are retained.

My conclusions so far are:

  • There is something off with colors assigned to extruded parts using a Shapestring feature, when they are exported from the native KiCad STEP export. Other features (such as the black marking layer) retain their color, but the Shapestring feature loses its color.
  • When using KiCadStepUp to import the .kicad_pcb file, all the colors are retained.

I’ll attach my FreeCad file. It’ll have the original designed Part, the PCB as exported by KiCad’s STEP export, and the PCB as imported by KiCadStepUp. Also attached is the Part as exported from FreeCad (works fine both in FreeCad and KiCad), the PCB as exported from KiCad, the PCB as imported from KiCadStepUp, and the .kicad_pcb file I am using to test this.

Royal Ohm - General Purpose Chip Resistors Colortest.FCStd (167.0 KB)
Royal Ohm - General Purpose Chip Resistors Colortest - FreeCad Export.step (224.8 KB)
Royal Ohm - General Purpose Chip Resistors Colortest - KiCad PCB Export.step (710.4 KB)
Royal Ohm - General Purpose Chip Resistors Colortest - KiCadStepUp Import.step (250.5 KB)
Royal Ohm - General Purpose Chip Resistors Colortest.kicad_pcb (7.0 KB)

I know colors are a trivial feature, but is someone willing to play around with this, and verify my findings?

And I forgot the most important details ofcourse:

Application: KiCad PCB Editor x64 on x64

Version: 7.99.0-1589-g9f705f5e81, release build

Libraries:
	wxWidgets 3.2.2
	FreeType 2.12.1
	HarfBuzz 6.0.0
	FontConfig 2.14.1
	libcurl/7.88.1-DEV Schannel zlib/1.2.13

Platform: Windows 10 (build 19045), 64-bit edition, 64 bit, Little endian, wxMSW

Build Info:
	Date: Jun 22 2023 07:19:30
	wxWidgets: 3.2.2 (wchar_t,wx containers)
	Boost: 1.81.0
	OCC: 7.7.1
	Curl: 7.88.1-DEV
	ngspice: 40
	Compiler: Visual C++ 1936 without C++ ABI

Build settings:
OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.20.2.29603 (Git)
Build type: Release
Branch: releases/FreeCAD-0-20
Hash: 930dd9a76203a3260b1e6256c70c1c3cad8c5cb8
Python 3.8.10, Qt 5.15.2, Coin 4.0.1, Vtk 8.2.0, OCC 7.6.3
Locale: English/United States (en_US)
Installed mods: 
  * kicadStepUpMod 10.19.4
  * sheetmetal 0.2.63

I never Export Steps from StepUp (so, no comment on that)
I always Export Steps from PartDesign
I can Export PCB with part Steps from Kicad

I can Open Steps into FreeCAD - no problem
I can Open Steps into StepUp - no problem
I can open PCB, Traces and Steps into StepUp - no problem

(using Kicad v6.0.11 and FreeCAD 20.2)

Forgive my Typo’s in the Graphic’s…

I never Export Steps from StepUp (so, no comment on that)

Neither do I - I only use StepUp to import the board and its models into FreeCad.

I always Export Steps from PartDesign

So do I, no other place to do it :wink:

I can Export PCB with part Steps from Kicad

Yes, for most of the STEP parts this is no issue. Even in your example, most parts are/will be fine, but I suspect if you change the color of the 10 uF marking on the electrolytic to an obvious color such as red like I did, the color will be removed once you export the board from KiCad and load it into FreeCad (if you don’t do it via StepUp that is).

I can Open Steps into FreeCAD - no problem
I can Open Steps into StepUp - no problem
I can open PCB, Traces and Steps into StepUp - no problem

Same - it seems to be very specific to Shapestrings that have a color other than the default color, and the one model you show with a text appears to have the default color.

Would you care to adjust your model (change the text color to red) and check what the KiCad STEP export shows after re-importing into FreeCad? Or use my model for that matter.

Cheers for looking into this.

Nope… Still works fine.

I colored some of the Capacitor’s String faces and Exported. Then, Imported. No problem.

Nope - it’s a Tweak Color to increase the Whiteness.

I used Your Model and loaded it in StepUp. Then, I Colored the Faces, Exported in PartDesign. Reloaded into FreeCAD. All colors are as expected.

EDIT - ADDED: By the way, not promoting my junk but, this may interest you, at least for testing your stuff. My Step Colorizer App

Your StepFile, re-colored
Royal Ohm - all.step (224.8 KB)

Some of mine used in these tests
afterColoring.step (222.2 KB)
ColorTest.step (1.3 MB)
Key_Hole-CAPtest.step (696.8 KB)

1 Like

Hmm, if I take your “Royal Ohm - all.step” model, then export a PCB via KiCad (File > Export > STEP) and import that into FreeCad via File >Import, then the colors are gone.

I thought it might have to do with the way we color - you color individual faces wheras I set the color via right clicking on the feature > Appearance > Shape Color, but it seems the issue is on my end somewhere…

Brewing fresh coffee to investigate…

Spent another few minutes… ShapeStrings with Color.

Exported STEP Compound from FreeCAD and Opened STEP Compound in FreeCAD. No problems.

Imported the STEP Compound using StepUp, No Problems.

Here’s the file and screenshot
colortest-Compound.step (1.5 MB)

You can have Success if you - Appearance Color individual Bodies and/or Faces. Then, for a completer part, Compound them into One compound

You won’t have Success if you Appearance Color elements of a Body.

It’s mostly a matter of testing to understand how it all ties/works together… Once I figured it out, I never had anymore problems…

Again I notice a difference :slight_smile:

In FreeCad, I add my Shapestrings from the Draft Workbench, and then use the Part Workbench’s Extrude tool to Pad them. You seem to (be able to) use PartDesign’s Pad tool on the Shapestring.

I thought this was fixed in FreeCad (at least, I’m pretty sure I’ve used an older build where this was fixed, or maybe it was a separate branch by RealThunder), but trying to Pad a Shapestring gives me the following error.

Pad: Result has multiple solids. This is not supported at this time.

Yes - I Extrude (Pad) the ShapeString in PartDesign. Though FreeCAD workbenches have similarities and Non-similarities, succes (for me) means spending enough time to figure out what works/doesn’t work and how to best use it. Just like all OpenSouce software.

After all my curiosity testing, I figured out what tools/features works with what then, created custom Toolbars containing them so I don’t need to jump back and forth between workbenches.

Of course, what works today, may not work tomorrow - just like Kicad :rofl:

Multiple Solids are Not supported - thus, my comment re using ‘Individual’

There is a Problem with Kicad - I colored your part and it retains it’s colors through different Step File programs. But, when I use it in a Kicad Footprint, it looses some colors…

I haven’t looked into it - perhaps I will, perhaps, not…

I wholeheartedly agree - it’s just that my old workflow doesn’t seem to work with the updated FreeCad and/or Kicad (combination) anymore.

Somehow, there is a peculiarity with either the way I create and/or color Shapestrings and/or export them, and/or with KiCad’s STEP export and I can’t put my finger on which one it is. Based on my successful import via KiCadStepUp, I am inclined to think it has something to do with KiCad’s export.

Would you mind sending me some of your FreeCad source files with colored text for me to investigate?

Here I created a a quasi-cube via Part Design, the sphere via Part, and the Shapestring via Draft and Part. All are colored in the same way. Selected the Part, Sphere and Extrude, File > Export, attach as 3D model to a footprint on a board, File > Export> STEP in KiCad, and then Import in FreeCad via File > Import. Only the Shapestring loses its color. Again, if I load the PCB file via KiCadStepUp, the Shapestring color is retained.

Here is my test file:
tripletest.step (203.5 KB)

I’m afraid I’ll have to write up a very detailed report on how to exactly reproduce this, just so we don’t get lost or mixed up in the details.

Here’s my Step (Compound): It has Colors.
colortest-Compound.step (1.5 MB)

Opens fine in FreeCAD (PartDesign and Part) and in StepUp



I haven’t tried exporting a step from KiCad’s File > Export > STEP and then importing via StepUp’s STEP importer - only directly importing the .kicad_pcb file. I’ll try this later to see if it makes any difference.

I tried your file and I noticed the same color discrepancies as you did before aswell.

I need a good night’s rest I’m afraid - much obliged for looking into this though!

One of these was colored then exported in PartDesign
The other was exported in StepUp

Both produce the same colors…

Unnamed-Compound-fc.step (197.9 KB)

Unnamed-Compound-SU.step (197.9 KB)

Just gonna jot down one last note for myself to verify tomorrow, I’m losing my mind over here :crazy_face:

FreeCad > New Document > Draft Workbench > Shapestring > Part Workbench > Extrude > Appearance > Shape Color set to Red > File > Export STEP

KiCad > Add exported model from above as 3D model to footprint in KiCad PCB > File > Export > STEP > Import in FreeCad via default importer - THE COLOR IS RETAINED!

Using the same FreeCad file as before, but now I add the following:
PartDesign > Body > Sketch > Pad > Appearance > Color set to Green > File > Export STEP
KiCad > Add exported model from above as 3D model to footprint in KiCad PCB > File > Export > STEP > Import in FreeCad via default importer - aaaaand it’s gone. The PartDesign model still has its color but the Shapestring has lost its color :upside_down_face:

Over morning coffee, I decided to post a ‘Trick’. Recognize, that Trick’s change per the Model-Construction, meaning, the Exact steps may need to be further Tweaked as situation dictates.

As I previously said, you can do ‘whatever it is’ in multiple ways and not all of them produce the same results (thus, requiring different Tweaks and Testing)

Thus, another solution - Do this:
• Create a Test Model Containing a Base and ShapeString on it
• Color the Part and Export STEP
• Use in Footprint

• Export the PCB from Kicad
• Open it in FreeCAD - Color should be OK
• Open it in FreeCAD using StepUo - Color should be OK

Now, Back in Part or PartDesign with the Original Part, Select it and make it a ‘Compound’. The Result will Not be colored.
Color the Faces of the Compound and Export STEP.

Now, use that colored Compound for the Footprint’s STEP and place on PCB.

Export the STEP of PCB from Kicad.
Open it in FreeCAD and it should retain Colors.
Load it in FreeCAD using StepUp and it should retain Colors.

Here’s my resulting STEP for testing to compare to your testing…
text-asisColored-Compound-colors1.step (148.0 KB)

Forgive the Typo’s (Step In, not StepIn)… :rofl:

Fair to say this post adds more to an ‘already overgrown’ post and, perhaps you’ve already succeeded in your goal with or without trying my last post suggestion.

Nonetheless, I had some free time to demo using my Colorizer App to change the Text on your Royal Ohm Chip… for fun and to feel warm/fuzzy about using my App and the Process on another users Step file…

What I did:
In FreeCAD, I prepared your Royal Ohm Chip part for use with the App by setting the Colors of Numbers 1,2,3 (I also set #4 so it would Not change).
To ‘Visually’ differentiate your surrounding Black color from my Prepared/required setting’s (of Black=1) I set your Black to Dark Grey - screenshot

Then, exported it as STEP.

Then, used it in Footprint.
Then, used the App to change the RGB values. Success. And, I exported the PCB STEP from Kicad.

Then, in FreeCAD, I loaded the Exported STEP - Success.

Then, I loaded the ‘PCB’ using StepUp - Success.

Strings retained the set colors…

Video quality is Low to keep File-Size under 4meg limit for posting here. I didn’t bother trying to optimize size/quality…

https://forum.freecad.org/viewtopic.php?t=50308&sid=fc1ac0b7f669447f50756089004d06cc&start=10

@m852 this shouldn’t FreeCAD related, but kicad’s exporter

It is indeed becoming quite the longwinded thread. That being said, let me make another coffee and add some more to it :slight_smile:

First of all, let me express my gratitude for your engagement - not only in this thread but in others where I’ve seen you post aswell. I remember you posting about the STEP coloring app you’ve developed (and unfortunately not getting too much (positive) feedback about it if I recall correctly), but anyone developing their own solution to their own problems gets a big thumbs up in my book.
Also your ‘philosophy’ of helping out others not by giving them the entire ‘solution’ but by giving them just enough information to get nudged in the right direction and with a little brain engagement and commitment it’s possible for them to solve their problems themselves rather than getting spoon-fed a solution drew my attention and made you a noteworthy community member in my book :+1:

That being said, we have slightly different problems and solutions to them.

Your app allows you to easily and quickly adjust the colors of already existing models. As you’ve demonstrated, your solution works great on a small scale. My goal however is to generate a ton of models with as much automation as is reasonably possible and directly getting my desired outcome without too much manual tinkering during modeling or afterwards. That is why I am so hesitant to manually color faces of models, as it doesn’t work on my scale.

To give you an impression, over the weekend I’ve created 730 (yes, seven hundred and thirty) models of surface mount resistors (a ‘mere’ 130MB in total). Only one manufacturer, one series of parts, 10 sizes, and I currently settled only for E12 values, although scaling up to E192 wouldn’t be much more effort and putting a bit of effort into the whole ordeal once and for all then reaping the benefits for the rest of my life is valuable in and of its own, but I figured I wouldn’t use 99% of the values in my lifetime anyway. Why did I go through this trouble? Because I don’t want to settle for ‘generic’ models. I really want the markings on all the models. I’ll spare you most of the reasoning but I really value having an accurate representation of the model. Knowing I need to solder a 22k resistor somewhere, and having a physical part with marking “223” on it is easy to link together, but I like to know that a part having a “01A” marking is a 10R resistor and vice versa. A similar reasoning applies for colored resistor rings for THT parts.

What I’ve done is modeled a single resistor model using the Spreadsheet workbench. With a bit of copy-pasting from my database of part parameters (painstakingly created by manually extracting all the relevent parameters from the datasheet), I can easily adjust the dimensions of the resistor, aswell as the marking on it, and have the correct part number embedded in the model. I think you can agree that your method of coloring the individual faces just doesn’t scale up to my level of requirements (which are, I must admit, are of ‘over 9000’ level OCD :smiling_face_with_tear:). That’s why I ‘insist’ on coloring the entire Body of the part marking in one go. One parametric base model → Hundreds of accurate parts with minimal (i.e. no) post-processing.

To give you an impression, I present to you all what I consider the most needlessly accurate representation of surface mount resistors you’ll ever see :rofl: Royal Ohm, 0603 imperial size, only 10R - 82R. I now have 10R-10M in case sizes 2512 all the way down to 01005. The image shows the 100R resistors in all available sizes. I’m not satisfied with the marking being a little bit too wide for my taste on the 1206 and 1210 models, but that’s something for another day.

Royal Ohm - General Purpose Chip Resistors - 0603 - 10R-82R.FCStd (1.0 MB)

Now, the original goal of this thread was more to help the developers of KiCad and/or FreeCad, as I genuinely thought (and still think) there is a bug in either piece of software due to the exception that I described earlier. Yes, it’s a trivial edge-case, but I feel because the low likelyhood of someone catching these kinds of bugs, they are only more worthful to report. This does require, however, more effort on my end to write a very detailed report, as the devil is in the details here I’m afraid. Nonetheless, I agree with you that especially with FreeCad and KiCad, many roads lead to Rome. I was just wondering why at some intersection of FreeCad’s road and KiCad’s road to Rome, the path crumbles to pieces :wink:

That’s enough for now on my end, your replies and feedback are much appreciated!