3D Models & FreeCAD

Dear all …

a short request for a “tutorial”: I still have a large set of 3D models (in FreeCAD) to convert to STEP for KiCAD (basically all the newer THT-Cap, THT-Res, THT-Inductor, THT-LED and THT-Diode-models currently available in newer KICAD-lib versions). So I would like to have some directions on converting them:

  1. Which version of FreeCAD should be used 0.15+StepUP should create correct STEPs+WRLs, correct? Or is there by now a 0.16 or even 0.17-version that works for Windows? If so, could you driect me to the installer.
  2. Which method should be used to fuse the single elements of the model together? Part|Boolean|Union?
  3. What happens to the materials that have been assigned before the fusing-optation?
  4. Are the electronics materials, defined in StepUP available for assignment in FreeCAD, or do I have to make the assignment when exporting?
  5. Is there a batch mode for StepUP that e.g. exports all opened 3D models to STEP&WRL? Or is there a simple option to call the function behind the EXPORT-button from a Python-script (preferably for me!).

Best & Thanks already,
JAN

1 Like

0.15 or the 0.17 daily build

Yes union in general but Maurice made a fusewithmaterials functions in the CQ scripts

With stepup you first assign a color, do the fusion and afterwards add the material properties to a specific color

Hmm I suppose you could use some of the export part from the CQ scripts, your models are also script based right?

I don’t think there is a batch mode but it should definitely be possible to export everything from script, it’s being done in all the CQ scripts

2 Likes

Is there a problem with 0.16? That is the current stable

Yes. https://forum.freecadweb.org/viewtopic.php?t=20455

Then only 0.17 from April 2017 contains the bug fix?
So far I haven’t seen any hints from the developers on when a 0.17 fork from trunk is going to happen.

the bug is present in FC 0.16 when saving STEP models … it will gives you an extra Product if the model is a single object… this bug is self hiding because FC0.16 and even FC0.15 will not show the extra level in hierarchy when loading the exported STEP model (both releases don’t decode hierarchy levels)
in FC0.17 this bug has been fixed and the STEP reader has also been improved to load/decode hierarchy; then FC 0.17 will display the extra Product when present…
You can also check this using CADAssistance of OCC or DesignSpark Mechanicals that can read hierarchy when loading step models…
FC0.17 is fine, as already pointed out in this thread, from this commit
git commit/7901cf7 which should be FC 0.17 release 10647

2 Likes

Hi Jan,
Part Union is fine, but if you want to your models to be scripted you would probably better have a look at the CQ scripts as @Shack suggested (have a look at the ‘capacitors_SMD’ script dir to see the basic functions) …
But before I would suggest to review some models… for example I noticed that when exporting the file
R_Axial_DIN0204_L3.6mm_D1.6mm_P5.08mm_Horizontal.FCStd
to step, the result is wrong…
I found you need to fix some points of the sweep path and made them coincident… then your STEP export will produce a nice result


Maurice

Perhaps you could consider porting your scripts to cadquery, it would be really nice for consistency :slight_smile: (the THT radial caps are already made)

Are you doing it macro style now or how? :slight_smile:

Dear all!

thanks for the hints. A few comments on them:

The models are only let’s say “semi-scripted”. The rationale is as follows. For each group of packages (e.g. vertical round resistors, honrizontal box-shaped resistors, …) I made a parametrized 3D model in FreeCAD (I use a spreadsheet to set the parameters). then I created Python scripts to generate the footprints, which ALSO output a Python script for each group of parametrized models. I then load the parametrized model and run the generated Python-script. For each footprint it sets the correct parameters into the Spreadsheet, recalculates the model and exports it (currently WRL+FCStd).

Currently I don’t ahve time to recreate all the models as scripts (also some are fairly complex, e.g. common-mode chokes and diodes or LEDs). What I would be willing to do is open the existing FCStd-files, run a script that fuses them and then exports them to STEP+WRL with the better export of StepUP … but for that I will have to run StepUP in an automated mode (thus the questions above) … if I don’t find a way to get it doen that way, I may hand-convert some of the models and the rest will stay as it is for now.

Best,
JAN

Hey Jan is it possible you can upload this spreadsheet? Or the parameters used in it

The spreadsheet is included in the FCStd file
If you have a look at kicad library and download the resistor model I used as example in my post you can see it … The conversion could be done creating a macro that will open the file, assign the right colors and materials to parts and then make a union of parts and export the final part to step and WRL with materials…
This can’t be done with StepUp but using and modifying the CQ routines used to create models

But before the model has to be fixed to export a correct step model

Please have a look at this:

(small Testbaloon for handywork :wink:

OK, I found an interesting problem with the Part|Boolean|Union-Approach: I worked on some LEDs that have some stuff inside:

If I fuse this with Part|Boolean|Union I loose the internal structure:

Is there any way of overcoming this problem? I.e. having the internal structure inside the LED in the STEP (and WRL)?
I can make a Part|Compound, but then the STEP-file ends up with several separate items:

Any ideas on that problem?

Best,
JAN

You would need to design the main body of the led such that it is a shell and not a completely filled solid. A real led has only a thin sheet of plastic on the outside.

I think @Joan_Sparky made described something similar here:

actually the LED is not hollow, but filled with transparent casting compound! So have one solid inside a second is not so far from reality … anything else would really make the models VERY complex!

Hi Jan,
STEP doesn’t have transparency, so your internal structure will not be displayed at all when the model will be exported… to have it displayed in WRL you can export your wrl model before Union
i.e. you can have your model and a simple copy of it that will be fused as a single part…
then export the multipart as wrl and the single part as STEP
Maurice

1 Like

@jkriege2 here the example file:
LED_D3.0mm-3.FCStd (40.1 KB)
and the results:


LED_D3.0mm-3.wrl (64.9 KB)
LED_D3.0mm-3.step (44.7 KB)

1 Like

Thanks,

maybe I’ll go that extra mile for that :wink: … let’s see what my schedule says in the next weeks.

Best,
JAN

A new 0.16 PPA today, that appears to include the Products fix

2 Likes

I know it :wink:
you can see my request for this patch at FreeCAD forum
https://forum.freecadweb.org/viewtopic.php?f=3&t=20455&start=20#p170721
I was waiting to mark this as solved until the windows and osx builds are provided

2 Likes